Skip to content

Commit 78f1fe9

Browse files
YuKuai-huaweiopsiff
authored andcommitted
md/raid1,raid10: don't ignore IO flags
commit e879a0d upstream. If blk-wbt is enabled by default, it's found that raid write performance is quite bad because all IO are throttled by wbt of underlying disks, due to flag REQ_IDLE is ignored. And turns out this behaviour exist since blk-wbt is introduced. Other than REQ_IDLE, other flags should not be ignored as well, for example REQ_META can be set for filesystems, clearing it can cause priority reverse problems; And REQ_NOWAIT should not be cleared as well, because io will wait instead of failing directly in underlying disks. Fix those problems by keep IO flags from master bio. Fises: f51d46d ("md: add support for REQ_NOWAIT") Fixes: e34cbd3 ("blk-wbt: add general throttling mechanism") Fixes: 5404bc7 ("[PATCH] Allow file systems to differentiate between data and meta reads") Link: https://lore.kernel.org/linux-raid/20250227121657.832356-1-yukuai1@huaweicloud.com Signed-off-by: Yu Kuai <yukuai3@huawei.com> [ Harshit: Resolve conflicts due to missing commit: f2a38ab ("md/raid1: Atomic write support") and commit: a1d9b4f ("md/raid10: Atomic write support") in 6.12.y, we don't have Atomic writes feature in 6.12.y ] Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 73506e581c0b1814cdfd2229d589f30751d7de26)
1 parent 4ed7f88 commit 78f1fe9

File tree

2 files changed

+0
-11
lines changed

2 files changed

+0
-11
lines changed

drivers/md/raid1.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,8 +1315,6 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio,
13151315
struct r1conf *conf = mddev->private;
13161316
struct raid1_info *mirror;
13171317
struct bio *read_bio;
1318-
const enum req_op op = bio_op(bio);
1319-
const blk_opf_t do_sync = bio->bi_opf & REQ_SYNC;
13201318
int max_sectors;
13211319
int rdisk;
13221320
bool r1bio_existed = !!r1_bio;
@@ -1399,7 +1397,6 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio,
13991397
read_bio->bi_iter.bi_sector = r1_bio->sector +
14001398
mirror->rdev->data_offset;
14011399
read_bio->bi_end_io = raid1_end_read_request;
1402-
read_bio->bi_opf = op | do_sync;
14031400
if (test_bit(FailFast, &mirror->rdev->flags) &&
14041401
test_bit(R1BIO_FailFast, &r1_bio->state))
14051402
read_bio->bi_opf |= MD_FAILFAST;
@@ -1619,7 +1616,6 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
16191616

16201617
mbio->bi_iter.bi_sector = (r1_bio->sector + rdev->data_offset);
16211618
mbio->bi_end_io = raid1_end_write_request;
1622-
mbio->bi_opf = bio_op(bio) | (bio->bi_opf & (REQ_SYNC | REQ_FUA));
16231619
if (test_bit(FailFast, &rdev->flags) &&
16241620
!test_bit(WriteMostly, &rdev->flags) &&
16251621
conf->raid_disks - mddev->degraded > 1)

drivers/md/raid10.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,8 +1146,6 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio,
11461146
{
11471147
struct r10conf *conf = mddev->private;
11481148
struct bio *read_bio;
1149-
const enum req_op op = bio_op(bio);
1150-
const blk_opf_t do_sync = bio->bi_opf & REQ_SYNC;
11511149
int max_sectors;
11521150
struct md_rdev *rdev;
11531151
char b[BDEVNAME_SIZE];
@@ -1226,7 +1224,6 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio,
12261224
read_bio->bi_iter.bi_sector = r10_bio->devs[slot].addr +
12271225
choose_data_offset(r10_bio, rdev);
12281226
read_bio->bi_end_io = raid10_end_read_request;
1229-
read_bio->bi_opf = op | do_sync;
12301227
if (test_bit(FailFast, &rdev->flags) &&
12311228
test_bit(R10BIO_FailFast, &r10_bio->state))
12321229
read_bio->bi_opf |= MD_FAILFAST;
@@ -1240,9 +1237,6 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio,
12401237
struct bio *bio, bool replacement,
12411238
int n_copy)
12421239
{
1243-
const enum req_op op = bio_op(bio);
1244-
const blk_opf_t do_sync = bio->bi_opf & REQ_SYNC;
1245-
const blk_opf_t do_fua = bio->bi_opf & REQ_FUA;
12461240
unsigned long flags;
12471241
struct r10conf *conf = mddev->private;
12481242
struct md_rdev *rdev;
@@ -1261,7 +1255,6 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio,
12611255
mbio->bi_iter.bi_sector = (r10_bio->devs[n_copy].addr +
12621256
choose_data_offset(r10_bio, rdev));
12631257
mbio->bi_end_io = raid10_end_write_request;
1264-
mbio->bi_opf = op | do_sync | do_fua;
12651258
if (!replacement && test_bit(FailFast,
12661259
&conf->mirrors[devnum].rdev->flags)
12671260
&& enough(conf, devnum))

0 commit comments

Comments
 (0)