Skip to content

Commit 0dd00cb

Browse files
Christoph Hellwigliu-song-6
authored andcommitted
raid5-cache: fully initialize flush_bio when needed
Stop using bio_reset and just initialize the bio fully when needed. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Song Liu <song@kernel.org>
1 parent 9f7c3f8 commit 0dd00cb

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/md/raid5-cache.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,6 +1266,8 @@ static void r5l_log_flush_endio(struct bio *bio)
12661266
r5l_io_run_stripes(io);
12671267
list_splice_tail_init(&log->flushing_ios, &log->finished_ios);
12681268
spin_unlock_irqrestore(&log->io_list_lock, flags);
1269+
1270+
bio_uninit(bio);
12691271
}
12701272

12711273
/*
@@ -1301,7 +1303,7 @@ void r5l_flush_stripe_to_raid(struct r5l_log *log)
13011303

13021304
if (!do_flush)
13031305
return;
1304-
bio_reset(&log->flush_bio, log->rdev->bdev,
1306+
bio_init(&log->flush_bio, log->rdev->bdev, NULL, 0,
13051307
REQ_OP_WRITE | REQ_PREFLUSH);
13061308
log->flush_bio.bi_end_io = r5l_log_flush_endio;
13071309
submit_bio(&log->flush_bio);
@@ -3105,7 +3107,6 @@ int r5l_init_log(struct r5conf *conf, struct md_rdev *rdev)
31053107
INIT_LIST_HEAD(&log->io_end_ios);
31063108
INIT_LIST_HEAD(&log->flushing_ios);
31073109
INIT_LIST_HEAD(&log->finished_ios);
3108-
bio_init(&log->flush_bio, NULL, NULL, 0, 0);
31093110

31103111
log->io_kc = KMEM_CACHE(r5l_io_unit, 0);
31113112
if (!log->io_kc)

0 commit comments

Comments
 (0)