mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 04:02:20 +00:00
dm: introduce the target flag mempool_needs_integrity
This commit introduces the dm target flag mempool_needs_integrity. When the flag is set, device mapper will call bioset_integrity_create on it's bio sets. The target can then call bio_integrity_alloc on the bios allocated from the table's mempool. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
This commit is contained in:
parent
d176fadb9e
commit
617069741d
@ -1050,6 +1050,7 @@ static int dm_table_alloc_md_mempools(struct dm_table *t, struct mapped_device *
|
||||
unsigned int min_pool_size = 0, pool_size;
|
||||
struct dm_md_mempools *pools;
|
||||
unsigned int bioset_flags = 0;
|
||||
bool mempool_needs_integrity = t->integrity_supported;
|
||||
|
||||
if (unlikely(type == DM_TYPE_NONE)) {
|
||||
DMERR("no table type is set, can't allocate mempools");
|
||||
@ -1074,6 +1075,8 @@ static int dm_table_alloc_md_mempools(struct dm_table *t, struct mapped_device *
|
||||
|
||||
per_io_data_size = max(per_io_data_size, ti->per_io_data_size);
|
||||
min_pool_size = max(min_pool_size, ti->num_flush_bios);
|
||||
|
||||
mempool_needs_integrity |= ti->mempool_needs_integrity;
|
||||
}
|
||||
pool_size = max(dm_get_reserved_bio_based_ios(), min_pool_size);
|
||||
front_pad = roundup(per_io_data_size,
|
||||
@ -1083,13 +1086,13 @@ static int dm_table_alloc_md_mempools(struct dm_table *t, struct mapped_device *
|
||||
__alignof__(struct dm_io)) + DM_IO_BIO_OFFSET;
|
||||
if (bioset_init(&pools->io_bs, pool_size, io_front_pad, bioset_flags))
|
||||
goto out_free_pools;
|
||||
if (t->integrity_supported &&
|
||||
if (mempool_needs_integrity &&
|
||||
bioset_integrity_create(&pools->io_bs, pool_size))
|
||||
goto out_free_pools;
|
||||
init_bs:
|
||||
if (bioset_init(&pools->bs, pool_size, front_pad, 0))
|
||||
goto out_free_pools;
|
||||
if (t->integrity_supported &&
|
||||
if (mempool_needs_integrity &&
|
||||
bioset_integrity_create(&pools->bs, pool_size))
|
||||
goto out_free_pools;
|
||||
|
||||
|
@ -405,6 +405,12 @@ struct dm_target {
|
||||
* support it.
|
||||
*/
|
||||
bool flush_bypasses_map:1;
|
||||
|
||||
/*
|
||||
* Set if the target calls bio_integrity_alloc on bios received
|
||||
* in the map method.
|
||||
*/
|
||||
bool mempool_needs_integrity:1;
|
||||
};
|
||||
|
||||
void *dm_per_bio_data(struct bio *bio, size_t data_size);
|
||||
|
Loading…
Reference in New Issue
Block a user