Remove the judgement "bio_data_dir(bi) != WRITE" in md_write_start().Put it before call md_write_start. Signed-off-by: majianpeng <majianpeng@xxxxxxxxx> --- drivers/md/md.c | 4 +--- drivers/md/md.h | 2 +- drivers/md/raid1.c | 4 ++-- drivers/md/raid10.c | 3 ++- drivers/md/raid5.c | 3 ++- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 1c2f904..e009f1d 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -7198,11 +7198,9 @@ void md_done_sync(struct mddev *mddev, int blocks, int ok) * in superblock) before writing, schedule a superblock update * and wait for it to complete. */ -void md_write_start(struct mddev *mddev, struct bio *bi) +void md_write_start(struct mddev *mddev) { int did_change = 0; - if (bio_data_dir(bi) != WRITE) - return; BUG_ON(mddev->ro == 1); if (mddev->ro == 2) { diff --git a/drivers/md/md.h b/drivers/md/md.h index 7b4a3c3..906e3db 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -593,7 +593,7 @@ extern struct md_thread *md_register_thread( extern void md_unregister_thread(struct md_thread **threadp); extern void md_wakeup_thread(struct md_thread *thread); extern void md_check_recovery(struct mddev *mddev); -extern void md_write_start(struct mddev *mddev, struct bio *bi); +extern void md_write_start(struct mddev *mddev); extern void md_write_end(struct mddev *mddev); extern void md_done_sync(struct mddev *mddev, int blocks, int ok); extern void md_error(struct mddev *mddev, struct md_rdev *rdev); diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 835de71..4bfa77d 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -893,8 +893,8 @@ static void make_request(struct mddev *mddev, struct bio * bio) * thread has put up a bar for new requests. * Continue immediately if no resync is active currently. */ - - md_write_start(mddev, bio); /* wait on superblock update early */ + if (rw == WRITE) + md_write_start(mddev); /* wait on superblock update early */ if (bio_data_dir(bio) == WRITE && bio->bi_sector + bio->bi_size/512 > mddev->suspend_lo && diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 987db37..b10cb99 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -1098,7 +1098,8 @@ static void make_request(struct mddev *mddev, struct bio * bio) return; } - md_write_start(mddev, bio); + if (rw == WRITE) + md_write_start(mddev); /* * Register the new request and wait if the reconstruction diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 5653125..8e330f8 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -3983,7 +3983,8 @@ static void make_request(struct mddev *mddev, struct bio * bi) chunk_aligned_read(mddev,bi)) return; - md_write_start(mddev, bi); + if (rw == WRITE) + md_write_start(mddev); logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1); last_sector = bi->bi_sector + (bi->bi_size>>9); -- 1.7.5.4 -------------- majianpeng?韬{.n?????%??檩??w?{.n???{炳盯w???塄}?财??j:+v??????2??璀??摺?囤??z夸z罐?+?????w棹f