Skip to content

Commit c749435

Browse files
YuKuai-huaweiharshimogalapalli
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) Conflicts: Unlike 6.12.y, UEK8 has atomic writes feature, so we had to resolve conflicts to match it more like upstream commit as opposed to stable 6.12.y commit Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
1 parent 85b8eaa commit c749435

File tree

2 files changed

+0
-13
lines changed

2 files changed

+0
-13
lines changed

drivers/md/raid1.c

Lines changed: 0 additions & 5 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, error;
13221320
bool r1bio_existed = !!r1_bio;
@@ -1404,7 +1402,6 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio,
14041402
read_bio->bi_iter.bi_sector = r1_bio->sector +
14051403
mirror->rdev->data_offset;
14061404
read_bio->bi_end_io = raid1_end_read_request;
1407-
read_bio->bi_opf = op | do_sync;
14081405
if (test_bit(FailFast, &mirror->rdev->flags) &&
14091406
test_bit(R1BIO_FailFast, &r1_bio->state))
14101407
read_bio->bi_opf |= MD_FAILFAST;
@@ -1650,8 +1647,6 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
16501647

16511648
mbio->bi_iter.bi_sector = (r1_bio->sector + rdev->data_offset);
16521649
mbio->bi_end_io = raid1_end_write_request;
1653-
mbio->bi_opf = bio_op(bio) |
1654-
(bio->bi_opf & (REQ_SYNC | REQ_FUA | REQ_ATOMIC));
16551650
if (test_bit(FailFast, &rdev->flags) &&
16561651
!test_bit(WriteMostly, &rdev->flags) &&
16571652
conf->raid_disks - mddev->degraded > 1)

drivers/md/raid10.c

Lines changed: 0 additions & 8 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];
@@ -1231,7 +1229,6 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio,
12311229
read_bio->bi_iter.bi_sector = r10_bio->devs[slot].addr +
12321230
choose_data_offset(r10_bio, rdev);
12331231
read_bio->bi_end_io = raid10_end_read_request;
1234-
read_bio->bi_opf = op | do_sync;
12351232
if (test_bit(FailFast, &rdev->flags) &&
12361233
test_bit(R10BIO_FailFast, &r10_bio->state))
12371234
read_bio->bi_opf |= MD_FAILFAST;
@@ -1250,10 +1247,6 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio,
12501247
struct bio *bio, bool replacement,
12511248
int n_copy)
12521249
{
1253-
const enum req_op op = bio_op(bio);
1254-
const blk_opf_t do_sync = bio->bi_opf & REQ_SYNC;
1255-
const blk_opf_t do_fua = bio->bi_opf & REQ_FUA;
1256-
const blk_opf_t do_atomic = bio->bi_opf & REQ_ATOMIC;
12571250
unsigned long flags;
12581251
struct r10conf *conf = mddev->private;
12591252
struct md_rdev *rdev;
@@ -1272,7 +1265,6 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio,
12721265
mbio->bi_iter.bi_sector = (r10_bio->devs[n_copy].addr +
12731266
choose_data_offset(r10_bio, rdev));
12741267
mbio->bi_end_io = raid10_end_write_request;
1275-
mbio->bi_opf = op | do_sync | do_fua | do_atomic;
12761268
if (!replacement && test_bit(FailFast,
12771269
&conf->mirrors[devnum].rdev->flags)
12781270
&& enough(conf, devnum))

0 commit comments

Comments
 (0)