diff options
Diffstat (limited to 'include/linux/device-mapper.h')
-rw-r--r-- | include/linux/device-mapper.h | 58 |
1 files changed, 44 insertions, 14 deletions
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index 82b2195efaca..cb95951547ab 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h @@ -93,7 +93,14 @@ typedef void (*dm_status_fn) (struct dm_target *ti, status_type_t status_type, typedef int (*dm_message_fn) (struct dm_target *ti, unsigned int argc, char **argv, char *result, unsigned int maxlen); -typedef int (*dm_prepare_ioctl_fn) (struct dm_target *ti, struct block_device **bdev); +/* + * Called with *forward == true. If it remains true, the ioctl should be + * forwarded to bdev. If it is reset to false, the target already fully handled + * the ioctl and the return value is the return value for the whole ioctl. + */ +typedef int (*dm_prepare_ioctl_fn) (struct dm_target *ti, struct block_device **bdev, + unsigned int cmd, unsigned long arg, + bool *forward); #ifdef CONFIG_BLK_DEV_ZONED typedef int (*dm_report_zones_fn) (struct dm_target *ti, @@ -180,6 +187,11 @@ int dm_get_device(struct dm_target *ti, const char *path, blk_mode_t mode, void dm_put_device(struct dm_target *ti, struct dm_dev *d); /* + * Helper function for getting devices + */ +int dm_devt_from_path(const char *path, dev_t *dev_p); + +/* * Information about a target type */ @@ -294,6 +306,9 @@ struct target_type { #define dm_target_supports_mixed_zoned_model(type) (false) #endif +#define DM_TARGET_ATOMIC_WRITES 0x00000400 +#define dm_target_supports_atomic_writes(type) ((type)->features & DM_TARGET_ATOMIC_WRITES) + struct dm_target { struct dm_table *table; struct target_type *type; @@ -358,22 +373,17 @@ struct dm_target { bool discards_supported:1; /* - * Set if this target requires that discards be split on - * 'max_discard_sectors' boundaries. - */ - bool max_discard_granularity:1; - - /* - * Set if this target requires that secure_erases be split on - * 'max_secure_erase_sectors' boundaries. + * Automatically set by dm-core if this target supports + * REQ_OP_ZONE_RESET_ALL. Otherwise, this operation will be emulated + * using REQ_OP_ZONE_RESET. Target drivers must not set this manually. */ - bool max_secure_erase_granularity:1; + bool zone_reset_all_supported:1; /* - * Set if this target requires that write_zeroes be split on - * 'max_write_zeroes_sectors' boundaries. + * Set if this target requires that discards be split on + * 'max_discard_sectors' boundaries. */ - bool max_write_zeroes_granularity:1; + bool max_discard_granularity:1; /* * Set if we need to limit the number of in-flight bios when swapping. @@ -397,6 +407,27 @@ struct dm_target { * bio_set_dev(). NOTE: ideally a target should _not_ need this. */ bool needs_bio_set_dev:1; + + /* + * Set if the target supports flush optimization. If all the targets in + * a table have flush_bypasses_map set, the dm core will not send + * flushes to the targets via a ->map method. It will iterate over + * dm_table->devices and send flushes to the devices directly. This + * optimization reduces the number of flushes being sent when multiple + * targets in a table use the same underlying device. + * + * This optimization may be enabled on targets that just pass the + * flushes to the underlying devices without performing any other + * actions on the flush request. Currently, dm-linear and dm-stripe + * 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); @@ -503,7 +534,6 @@ int dm_post_suspending(struct dm_target *ti); int dm_noflush_suspending(struct dm_target *ti); void dm_accept_partial_bio(struct bio *bio, unsigned int n_sectors); void dm_submit_bio_remap(struct bio *clone, struct bio *tgt_clone); -union map_info *dm_get_rq_mapinfo(struct request *rq); #ifdef CONFIG_BLK_DEV_ZONED struct dm_report_zones_args { |