Subject: [PATCH] Exported dm_put() to be used by parse_hw_handler() of dm-mpath. Changed parse_hw_handler() and hw_handler interface to pass ptr to the hardware handler's mapped device to enhance event logging. Signed-off-by: Edward Goggin --- drivers/md/dm-hw-handler.h | 2 +- drivers/md/dm-mpath.c | 10 +++++++++- drivers/md/dm.c | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) applies-to: 8bb04a9fe67f844e84691e53829813ca65b981b4 7e5d4b23929dd889b34c0d9c9ccbc62e970c5863 diff --git a/drivers/md/dm-hw-handler.h b/drivers/md/dm-hw-handler.h index 15f5629..53be8aa 100644 --- a/drivers/md/dm-hw-handler.h +++ b/drivers/md/dm-hw-handler.h @@ -28,7 +28,7 @@ struct hw_handler_type { struct module *module; int (*create) (struct hw_handler *handler, unsigned int argc, - char **argv); + char **argv, struct mapped_device *md); void (*destroy) (struct hw_handler *hwh); void (*pg_init) (struct hw_handler *hwh, unsigned bypassed, diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index d754e0b..be87a4f 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -627,6 +627,7 @@ static int parse_hw_handler(struct arg_s struct hw_handler_type *hwht; unsigned hw_argc; struct dm_target *ti = m->ti; + struct mapped_device *md; static struct param _params[] = { {0, 1024, "invalid number of hardware handler args"}, @@ -645,7 +646,14 @@ static int parse_hw_handler(struct arg_s return -EINVAL; } - r = hwht->create(&m->hw_handler, hw_argc - 1, as->argv); + /* + * No need to hold a reference on the mapped device here + * since one is already held for the duration of the + * mapped device open. + */ + md = dm_table_get_md(ti->table); + r = hwht->create(&m->hw_handler, hw_argc - 1, as->argv, md); + dm_put(md); if (r) { dm_put_hw_handler(hwht); ti->error = "hardware handler constructor failed"; diff --git a/drivers/md/dm.c b/drivers/md/dm.c index fc4f743..163a7a3 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1196,6 +1196,7 @@ void dm_put(struct mapped_device *md) free_dev(md); } } +EXPORT_SYMBOL_GPL(dm_put); /* * Process the deferred bios --- 0.99.9i