diff options
author | Mike Snitzer <snitzer@redhat.com> | 2018-02-28 15:59:59 -0500 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2018-04-03 15:04:10 -0400 |
commit | 1eb5fa849f2bf9186a618e85bea23f02e527540a (patch) | |
tree | b0f5e85395f06f86e7db283155c5f73a5b942c8b | |
parent | da5dadb4f11660ca67580cd4a7420161266d6254 (diff) |
dm: allow targets to return output from messages they are sent
Could be useful for a target to return stats or other information.
If a target does DMEMIT() anything to @result from its .message method
then it must return 1 to the caller.
Signed-off-By: Mike Snitzer <snitzer@redhat.com>
-rw-r--r-- | drivers/md/dm-cache-target.c | 3 | ||||
-rw-r--r-- | drivers/md/dm-crypt.c | 3 | ||||
-rw-r--r-- | drivers/md/dm-era-target.c | 3 | ||||
-rw-r--r-- | drivers/md/dm-ioctl.c | 2 | ||||
-rw-r--r-- | drivers/md/dm-log-writes.c | 3 | ||||
-rw-r--r-- | drivers/md/dm-mpath.c | 3 | ||||
-rw-r--r-- | drivers/md/dm-raid.c | 3 | ||||
-rw-r--r-- | drivers/md/dm-switch.c | 3 | ||||
-rw-r--r-- | drivers/md/dm-thin.c | 3 | ||||
-rw-r--r-- | include/linux/device-mapper.h | 3 | ||||
-rw-r--r-- | include/uapi/linux/dm-ioctl.h | 4 |
11 files changed, 21 insertions, 12 deletions
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 47407e43b96a..da208638fba4 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -3387,7 +3387,8 @@ static int process_invalidate_cblocks_message(struct cache *cache, unsigned coun | |||
3387 | * | 3387 | * |
3388 | * The key migration_threshold is supported by the cache target core. | 3388 | * The key migration_threshold is supported by the cache target core. |
3389 | */ | 3389 | */ |
3390 | static int cache_message(struct dm_target *ti, unsigned argc, char **argv) | 3390 | static int cache_message(struct dm_target *ti, unsigned argc, char **argv, |
3391 | char *result, unsigned maxlen) | ||
3391 | { | 3392 | { |
3392 | struct cache *cache = ti->private; | 3393 | struct cache *cache = ti->private; |
3393 | 3394 | ||
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 8168f737590e..dd9b5332b39c 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -2942,7 +2942,8 @@ static void crypt_resume(struct dm_target *ti) | |||
2942 | * key set <key> | 2942 | * key set <key> |
2943 | * key wipe | 2943 | * key wipe |
2944 | */ | 2944 | */ |
2945 | static int crypt_message(struct dm_target *ti, unsigned argc, char **argv) | 2945 | static int crypt_message(struct dm_target *ti, unsigned argc, char **argv, |
2946 | char *result, unsigned maxlen) | ||
2946 | { | 2947 | { |
2947 | struct crypt_config *cc = ti->private; | 2948 | struct crypt_config *cc = ti->private; |
2948 | int key_size, ret = -EINVAL; | 2949 | int key_size, ret = -EINVAL; |
diff --git a/drivers/md/dm-era-target.c b/drivers/md/dm-era-target.c index 73a5c198113a..8e48920a3ffa 100644 --- a/drivers/md/dm-era-target.c +++ b/drivers/md/dm-era-target.c | |||
@@ -1635,7 +1635,8 @@ err: | |||
1635 | DMEMIT("Error"); | 1635 | DMEMIT("Error"); |
1636 | } | 1636 | } |
1637 | 1637 | ||
1638 | static int era_message(struct dm_target *ti, unsigned argc, char **argv) | 1638 | static int era_message(struct dm_target *ti, unsigned argc, char **argv, |
1639 | char *result, unsigned maxlen) | ||
1639 | { | 1640 | { |
1640 | struct era *era = ti->private; | 1641 | struct era *era = ti->private; |
1641 | 1642 | ||
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index a89fd8f44453..5acf77de5945 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c | |||
@@ -1595,7 +1595,7 @@ static int target_message(struct file *filp, struct dm_ioctl *param, size_t para | |||
1595 | DMWARN("Target message sector outside device."); | 1595 | DMWARN("Target message sector outside device."); |
1596 | r = -EINVAL; | 1596 | r = -EINVAL; |
1597 | } else if (ti->type->message) | 1597 | } else if (ti->type->message) |
1598 | r = ti->type->message(ti, argc, argv); | 1598 | r = ti->type->message(ti, argc, argv, result, maxlen); |
1599 | else { | 1599 | else { |
1600 | DMWARN("Target type does not support messages"); | 1600 | DMWARN("Target type does not support messages"); |
1601 | r = -EINVAL; | 1601 | r = -EINVAL; |
diff --git a/drivers/md/dm-log-writes.c b/drivers/md/dm-log-writes.c index 3362d866793b..e4c015dfef43 100644 --- a/drivers/md/dm-log-writes.c +++ b/drivers/md/dm-log-writes.c | |||
@@ -887,7 +887,8 @@ static int log_writes_iterate_devices(struct dm_target *ti, | |||
887 | * Messages supported: | 887 | * Messages supported: |
888 | * mark <mark data> - specify the marked data. | 888 | * mark <mark data> - specify the marked data. |
889 | */ | 889 | */ |
890 | static int log_writes_message(struct dm_target *ti, unsigned argc, char **argv) | 890 | static int log_writes_message(struct dm_target *ti, unsigned argc, char **argv, |
891 | char *result, unsigned maxlen) | ||
891 | { | 892 | { |
892 | int r = -EINVAL; | 893 | int r = -EINVAL; |
893 | struct log_writes_c *lc = ti->private; | 894 | struct log_writes_c *lc = ti->private; |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index a6b7baf31cdd..1e60ec44942e 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -1811,7 +1811,8 @@ static void multipath_status(struct dm_target *ti, status_type_t type, | |||
1811 | spin_unlock_irqrestore(&m->lock, flags); | 1811 | spin_unlock_irqrestore(&m->lock, flags); |
1812 | } | 1812 | } |
1813 | 1813 | ||
1814 | static int multipath_message(struct dm_target *ti, unsigned argc, char **argv) | 1814 | static int multipath_message(struct dm_target *ti, unsigned argc, char **argv, |
1815 | char *result, unsigned maxlen) | ||
1815 | { | 1816 | { |
1816 | int r = -EINVAL; | 1817 | int r = -EINVAL; |
1817 | struct dm_dev *dev; | 1818 | struct dm_dev *dev; |
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index c1d1034ff7b7..b7a9c710ebec 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c | |||
@@ -3663,7 +3663,8 @@ static void raid_status(struct dm_target *ti, status_type_t type, | |||
3663 | } | 3663 | } |
3664 | } | 3664 | } |
3665 | 3665 | ||
3666 | static int raid_message(struct dm_target *ti, unsigned int argc, char **argv) | 3666 | static int raid_message(struct dm_target *ti, unsigned int argc, char **argv, |
3667 | char *result, unsigned maxlen) | ||
3667 | { | 3668 | { |
3668 | struct raid_set *rs = ti->private; | 3669 | struct raid_set *rs = ti->private; |
3669 | struct mddev *mddev = &rs->md; | 3670 | struct mddev *mddev = &rs->md; |
diff --git a/drivers/md/dm-switch.c b/drivers/md/dm-switch.c index 8d0ba879777e..8f9208c2d2e3 100644 --- a/drivers/md/dm-switch.c +++ b/drivers/md/dm-switch.c | |||
@@ -466,7 +466,8 @@ static int process_set_region_mappings(struct switch_ctx *sctx, | |||
466 | * | 466 | * |
467 | * Only set_region_mappings is supported. | 467 | * Only set_region_mappings is supported. |
468 | */ | 468 | */ |
469 | static int switch_message(struct dm_target *ti, unsigned argc, char **argv) | 469 | static int switch_message(struct dm_target *ti, unsigned argc, char **argv, |
470 | char *result, unsigned maxlen) | ||
470 | { | 471 | { |
471 | static DEFINE_MUTEX(message_mutex); | 472 | static DEFINE_MUTEX(message_mutex); |
472 | 473 | ||
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 629c555890c1..b11107497d2e 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -3705,7 +3705,8 @@ static int process_release_metadata_snap_mesg(unsigned argc, char **argv, struct | |||
3705 | * reserve_metadata_snap | 3705 | * reserve_metadata_snap |
3706 | * release_metadata_snap | 3706 | * release_metadata_snap |
3707 | */ | 3707 | */ |
3708 | static int pool_message(struct dm_target *ti, unsigned argc, char **argv) | 3708 | static int pool_message(struct dm_target *ti, unsigned argc, char **argv, |
3709 | char *result, unsigned maxlen) | ||
3709 | { | 3710 | { |
3710 | int r = -EINVAL; | 3711 | int r = -EINVAL; |
3711 | struct pool_c *pt = ti->private; | 3712 | struct pool_c *pt = ti->private; |
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index da83f64952e7..1e2426c18eb4 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
@@ -87,7 +87,8 @@ typedef void (*dm_resume_fn) (struct dm_target *ti); | |||
87 | typedef void (*dm_status_fn) (struct dm_target *ti, status_type_t status_type, | 87 | typedef void (*dm_status_fn) (struct dm_target *ti, status_type_t status_type, |
88 | unsigned status_flags, char *result, unsigned maxlen); | 88 | unsigned status_flags, char *result, unsigned maxlen); |
89 | 89 | ||
90 | typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv); | 90 | typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv, |
91 | char *result, unsigned maxlen); | ||
91 | 92 | ||
92 | typedef int (*dm_prepare_ioctl_fn) (struct dm_target *ti, | 93 | typedef int (*dm_prepare_ioctl_fn) (struct dm_target *ti, |
93 | struct block_device **bdev, fmode_t *mode); | 94 | struct block_device **bdev, fmode_t *mode); |
diff --git a/include/uapi/linux/dm-ioctl.h b/include/uapi/linux/dm-ioctl.h index 14c44ec8b622..5108da02cd32 100644 --- a/include/uapi/linux/dm-ioctl.h +++ b/include/uapi/linux/dm-ioctl.h | |||
@@ -270,9 +270,9 @@ enum { | |||
270 | #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) | 270 | #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) |
271 | 271 | ||
272 | #define DM_VERSION_MAJOR 4 | 272 | #define DM_VERSION_MAJOR 4 |
273 | #define DM_VERSION_MINOR 37 | 273 | #define DM_VERSION_MINOR 38 |
274 | #define DM_VERSION_PATCHLEVEL 0 | 274 | #define DM_VERSION_PATCHLEVEL 0 |
275 | #define DM_VERSION_EXTRA "-ioctl (2017-09-20)" | 275 | #define DM_VERSION_EXTRA "-ioctl (2018-02-28)" |
276 | 276 | ||
277 | /* Status bits */ | 277 | /* Status bits */ |
278 | #define DM_READONLY_FLAG (1 << 0) /* In/Out */ | 278 | #define DM_READONLY_FLAG (1 << 0) /* In/Out */ |