diff options
| author | Yu Kuai <[email protected]> | 2024-08-26 07:44:11 +0000 |
|---|---|---|
| committer | Song Liu <[email protected]> | 2024-08-27 17:14:14 +0000 |
| commit | 2db4fa1b7e1897908d5cd11b1e22233ff0c6ba49 (patch) | |
| tree | 8de15c7dba1f3026cb039f7b7e5bc67f20ce5d11 /drivers/md/raid1.c | |
| parent | md/raid1: Clean up local variable 'b' from raid1_read_request() (diff) | |
| download | kernel-2db4fa1b7e1897908d5cd11b1e22233ff0c6ba49.tar.gz kernel-2db4fa1b7e1897908d5cd11b1e22233ff0c6ba49.zip | |
md/raid1: use md_bitmap_wait_behind_writes() in raid1_read_request()
Use the existed helper instead of open coding it to make the code cleaner.
There are no functional changes, and also avoid dereferencing bitmap
directly to prepare inventing a new bitmap.
Noted that this patch also export md_bitmap_wait_behind_writes(), which
is necessary for now, and the exported api will be removed in following
patches to convert bitmap apis into ops.
Signed-off-by: Yu Kuai <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Song Liu <[email protected]>
Diffstat (limited to 'drivers/md/raid1.c')
| -rw-r--r-- | drivers/md/raid1.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 531ddfc6efbd..18aaa7247bba 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1311,7 +1311,6 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, struct r1conf *conf = mddev->private; struct raid1_info *mirror; struct bio *read_bio; - struct bitmap *bitmap = mddev->bitmap; const enum req_op op = bio_op(bio); const blk_opf_t do_sync = bio->bi_opf & REQ_SYNC; int max_sectors; @@ -1364,15 +1363,13 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, (unsigned long long)r1_bio->sector, mirror->rdev->bdev); - if (test_bit(WriteMostly, &mirror->rdev->flags) && - bitmap) { + if (test_bit(WriteMostly, &mirror->rdev->flags)) { /* * Reading from a write-mostly device must take care not to * over-take any writes that are 'behind' */ mddev_add_trace_msg(mddev, "raid1 wait behind writes"); - wait_event(bitmap->behind_wait, - atomic_read(&bitmap->behind_writes) == 0); + md_bitmap_wait_behind_writes(mddev); } if (max_sectors < bio_sectors(bio)) { |
