Skip to content

Commit 50bc215

Browse files
Christoph Hellwigaxboe
authored andcommitted
dm: use bio_list_merge_init
Use bio_list_merge_init instead of open coding bio_list_merge and bio_list_init. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mike Snitzer <snitzer@kernel.org> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Link: https://lore.kernel.org/r/20240328084147.2954434-4-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 7a324d8 commit 50bc215

8 files changed

Lines changed: 17 additions & 36 deletions

File tree

drivers/md/dm-bio-prison-v2.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,7 @@ static bool __unlock(struct dm_bio_prison_v2 *prison,
321321
{
322322
BUG_ON(!cell->exclusive_lock);
323323

324-
bio_list_merge(bios, &cell->bios);
325-
bio_list_init(&cell->bios);
324+
bio_list_merge_init(bios, &cell->bios);
326325

327326
if (cell->shared_count) {
328327
cell->exclusive_lock = false;

drivers/md/dm-cache-target.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ static void __commit(struct work_struct *_ws)
115115
*/
116116
spin_lock_irq(&b->lock);
117117
list_splice_init(&b->work_items, &work_items);
118-
bio_list_merge(&bios, &b->bios);
119-
bio_list_init(&b->bios);
118+
bio_list_merge_init(&bios, &b->bios);
120119
b->commit_scheduled = false;
121120
spin_unlock_irq(&b->lock);
122121

@@ -565,8 +564,7 @@ static void defer_bio(struct cache *cache, struct bio *bio)
565564
static void defer_bios(struct cache *cache, struct bio_list *bios)
566565
{
567566
spin_lock_irq(&cache->lock);
568-
bio_list_merge(&cache->deferred_bios, bios);
569-
bio_list_init(bios);
567+
bio_list_merge_init(&cache->deferred_bios, bios);
570568
spin_unlock_irq(&cache->lock);
571569

572570
wake_deferred_bio_worker(cache);
@@ -1816,8 +1814,7 @@ static void process_deferred_bios(struct work_struct *ws)
18161814
bio_list_init(&bios);
18171815

18181816
spin_lock_irq(&cache->lock);
1819-
bio_list_merge(&bios, &cache->deferred_bios);
1820-
bio_list_init(&cache->deferred_bios);
1817+
bio_list_merge_init(&bios, &cache->deferred_bios);
18211818
spin_unlock_irq(&cache->lock);
18221819

18231820
while ((bio = bio_list_pop(&bios))) {
@@ -1847,8 +1844,7 @@ static void requeue_deferred_bios(struct cache *cache)
18471844
struct bio_list bios;
18481845

18491846
bio_list_init(&bios);
1850-
bio_list_merge(&bios, &cache->deferred_bios);
1851-
bio_list_init(&cache->deferred_bios);
1847+
bio_list_merge_init(&bios, &cache->deferred_bios);
18521848

18531849
while ((bio = bio_list_pop(&bios))) {
18541850
bio->bi_status = BLK_STS_DM_REQUEUE;

drivers/md/dm-clone-target.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,8 +1181,7 @@ static void process_deferred_discards(struct clone *clone)
11811181
struct bio_list discards = BIO_EMPTY_LIST;
11821182

11831183
spin_lock_irq(&clone->lock);
1184-
bio_list_merge(&discards, &clone->deferred_discard_bios);
1185-
bio_list_init(&clone->deferred_discard_bios);
1184+
bio_list_merge_init(&discards, &clone->deferred_discard_bios);
11861185
spin_unlock_irq(&clone->lock);
11871186

11881187
if (bio_list_empty(&discards))
@@ -1215,8 +1214,7 @@ static void process_deferred_bios(struct clone *clone)
12151214
struct bio_list bios = BIO_EMPTY_LIST;
12161215

12171216
spin_lock_irq(&clone->lock);
1218-
bio_list_merge(&bios, &clone->deferred_bios);
1219-
bio_list_init(&clone->deferred_bios);
1217+
bio_list_merge_init(&bios, &clone->deferred_bios);
12201218
spin_unlock_irq(&clone->lock);
12211219

12221220
if (bio_list_empty(&bios))
@@ -1237,11 +1235,9 @@ static void process_deferred_flush_bios(struct clone *clone)
12371235
* before issuing them or signaling their completion.
12381236
*/
12391237
spin_lock_irq(&clone->lock);
1240-
bio_list_merge(&bios, &clone->deferred_flush_bios);
1241-
bio_list_init(&clone->deferred_flush_bios);
1242-
1243-
bio_list_merge(&bio_completions, &clone->deferred_flush_completions);
1244-
bio_list_init(&clone->deferred_flush_completions);
1238+
bio_list_merge_init(&bios, &clone->deferred_flush_bios);
1239+
bio_list_merge_init(&bio_completions,
1240+
&clone->deferred_flush_completions);
12451241
spin_unlock_irq(&clone->lock);
12461242

12471243
if (bio_list_empty(&bios) && bio_list_empty(&bio_completions) &&

drivers/md/dm-era-target.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,8 +1272,7 @@ static void process_deferred_bios(struct era *era)
12721272
bio_list_init(&marked_bios);
12731273

12741274
spin_lock(&era->deferred_lock);
1275-
bio_list_merge(&deferred_bios, &era->deferred_bios);
1276-
bio_list_init(&era->deferred_bios);
1275+
bio_list_merge_init(&deferred_bios, &era->deferred_bios);
12771276
spin_unlock(&era->deferred_lock);
12781277

12791278
if (bio_list_empty(&deferred_bios))

drivers/md/dm-mpath.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,8 +704,7 @@ static void process_queued_bios(struct work_struct *work)
704704
return;
705705
}
706706

707-
bio_list_merge(&bios, &m->queued_bios);
708-
bio_list_init(&m->queued_bios);
707+
bio_list_merge_init(&bios, &m->queued_bios);
709708

710709
spin_unlock_irqrestore(&m->lock, flags);
711710

drivers/md/dm-thin.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -592,12 +592,6 @@ struct dm_thin_endio_hook {
592592
struct dm_bio_prison_cell *cell;
593593
};
594594

595-
static void __merge_bio_list(struct bio_list *bios, struct bio_list *master)
596-
{
597-
bio_list_merge(bios, master);
598-
bio_list_init(master);
599-
}
600-
601595
static void error_bio_list(struct bio_list *bios, blk_status_t error)
602596
{
603597
struct bio *bio;
@@ -616,7 +610,7 @@ static void error_thin_bio_list(struct thin_c *tc, struct bio_list *master,
616610
bio_list_init(&bios);
617611

618612
spin_lock_irq(&tc->lock);
619-
__merge_bio_list(&bios, master);
613+
bio_list_merge_init(&bios, master);
620614
spin_unlock_irq(&tc->lock);
621615

622616
error_bio_list(&bios, error);
@@ -645,8 +639,8 @@ static void requeue_io(struct thin_c *tc)
645639
bio_list_init(&bios);
646640

647641
spin_lock_irq(&tc->lock);
648-
__merge_bio_list(&bios, &tc->deferred_bio_list);
649-
__merge_bio_list(&bios, &tc->retry_on_resume_list);
642+
bio_list_merge_init(&bios, &tc->deferred_bio_list);
643+
bio_list_merge_init(&bios, &tc->retry_on_resume_list);
650644
spin_unlock_irq(&tc->lock);
651645

652646
error_bio_list(&bios, BLK_STS_DM_REQUEUE);

drivers/md/dm-vdo/data-vio.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,8 +604,7 @@ static void assign_discard_permit(struct limiter *limiter)
604604

605605
static void get_waiters(struct limiter *limiter)
606606
{
607-
bio_list_merge(&limiter->waiters, &limiter->new_waiters);
608-
bio_list_init(&limiter->new_waiters);
607+
bio_list_merge_init(&limiter->waiters, &limiter->new_waiters);
609608
}
610609

611610
static inline struct data_vio *get_available_data_vio(struct data_vio_pool *pool)

drivers/md/dm-vdo/flush.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,7 @@ void vdo_dump_flusher(const struct flusher *flusher)
369369
static void initialize_flush(struct vdo_flush *flush, struct vdo *vdo)
370370
{
371371
bio_list_init(&flush->bios);
372-
bio_list_merge(&flush->bios, &vdo->flusher->waiting_flush_bios);
373-
bio_list_init(&vdo->flusher->waiting_flush_bios);
372+
bio_list_merge_init(&flush->bios, &vdo->flusher->waiting_flush_bios);
374373
}
375374

376375
static void launch_flush(struct vdo_flush *flush)

0 commit comments

Comments
 (0)