Skip to content

Commit 28d7d12

Browse files
Christoph Hellwigaxboe
authored andcommitted
dm-thin: use blkdev_issue_flush instead of open coding it
Use blkdev_issue_flush, which uses an on-stack bio instead of an opencoded version with a bio embedded into struct pool. Signed-off-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent eba33b8 commit 28d7d12

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

drivers/md/dm-thin.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,6 @@ struct pool {
282282
struct dm_bio_prison_cell **cell_sort_array;
283283

284284
mempool_t mapping_pool;
285-
286-
struct bio flush_bio;
287285
};
288286

289287
static void metadata_operation_failed(struct pool *pool, const char *op, int r);
@@ -2906,7 +2904,6 @@ static void __pool_destroy(struct pool *pool)
29062904
if (pool->next_mapping)
29072905
mempool_free(pool->next_mapping, &pool->mapping_pool);
29082906
mempool_exit(&pool->mapping_pool);
2909-
bio_uninit(&pool->flush_bio);
29102907
dm_deferred_set_destroy(pool->shared_read_ds);
29112908
dm_deferred_set_destroy(pool->all_io_ds);
29122909
kfree(pool);
@@ -2987,7 +2984,6 @@ static struct pool *pool_create(struct mapped_device *pool_md,
29872984
pool->low_water_triggered = false;
29882985
pool->suspended = true;
29892986
pool->out_of_data_space = false;
2990-
bio_init(&pool->flush_bio, NULL, 0);
29912987

29922988
pool->shared_read_ds = dm_deferred_set_create();
29932989
if (!pool->shared_read_ds) {
@@ -3194,13 +3190,8 @@ static void metadata_low_callback(void *context)
31943190
static int metadata_pre_commit_callback(void *context)
31953191
{
31963192
struct pool *pool = context;
3197-
struct bio *flush_bio = &pool->flush_bio;
3198-
3199-
bio_reset(flush_bio);
3200-
bio_set_dev(flush_bio, pool->data_dev);
3201-
flush_bio->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH;
32023193

3203-
return submit_bio_wait(flush_bio);
3194+
return blkdev_issue_flush(pool->data_dev);
32043195
}
32053196

32063197
static sector_t get_dev_size(struct block_device *bdev)

0 commit comments

Comments
 (0)