summaryrefslogtreecommitdiff
path: root/drivers/md/dm-zoned-target.c
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2020-05-11 10:24:17 +0200
committerMike Snitzer <snitzer@redhat.com>2020-05-15 10:29:36 -0400
commit90b39d58f39e1f3f3147caee6fb2a71528db74a2 (patch)
tree978ac4ee5a6358d1a6b892a8106b3de6f88873b8 /drivers/md/dm-zoned-target.c
parentbc3d5717d242a37d2e9ea85d7e7b2e3569324d24 (diff)
dm zoned: add 'message' callback
Add callback for 'dmsetup message' to allow the reclaim process to be triggered manually. Eg. dmsetup message /dev/dm-X 0 message will start the reclaim process even if the default threshold of 50 percent of free random zones is not reached. Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Bob Liu <bob.liu@oracle.com> Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-zoned-target.c')
-rw-r--r--drivers/md/dm-zoned-target.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c
index 0b4b27d280fb..0bfe34162dbb 100644
--- a/drivers/md/dm-zoned-target.c
+++ b/drivers/md/dm-zoned-target.c
@@ -990,6 +990,20 @@ static void dmz_status(struct dm_target *ti, status_type_t type,
return;
}
+static int dmz_message(struct dm_target *ti, unsigned int argc, char **argv,
+ char *result, unsigned int maxlen)
+{
+ struct dmz_target *dmz = ti->private;
+ int r = -EINVAL;
+
+ if (!strcasecmp(argv[0], "reclaim")) {
+ dmz_schedule_reclaim(dmz->reclaim);
+ r = 0;
+ } else
+ DMERR("unrecognized message %s", argv[0]);
+ return r;
+}
+
static struct target_type dmz_type = {
.name = "zoned",
.version = {1, 1, 0},
@@ -1004,6 +1018,7 @@ static struct target_type dmz_type = {
.resume = dmz_resume,
.iterate_devices = dmz_iterate_devices,
.status = dmz_status,
+ .message = dmz_message,
};
static int __init dmz_init(void)