Commit d4a512ed authored by Mike Snitzer's avatar Mike Snitzer

dm: use dm_table_get_device_name() where appropriate in targets

dm_table_get_device_name() avoids calling dm_table_get_md() followed by
dm_device_name() -- saves intermediate dm_table_get_md() call.
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 33bd6f06
...@@ -925,7 +925,7 @@ static enum cache_metadata_mode get_cache_mode(struct cache *cache) ...@@ -925,7 +925,7 @@ static enum cache_metadata_mode get_cache_mode(struct cache *cache)
static const char *cache_device_name(struct cache *cache) static const char *cache_device_name(struct cache *cache)
{ {
return dm_device_name(dm_table_get_md(cache->ti->table)); return dm_table_device_name(cache->ti->table);
} }
static void notify_mode_switch(struct cache *cache, enum cache_metadata_mode mode) static void notify_mode_switch(struct cache *cache, enum cache_metadata_mode mode)
......
...@@ -466,10 +466,8 @@ static struct pgpath *choose_pgpath(struct multipath *m, size_t nr_bytes) ...@@ -466,10 +466,8 @@ static struct pgpath *choose_pgpath(struct multipath *m, size_t nr_bytes)
*/ */
#define dm_report_EIO(m) \ #define dm_report_EIO(m) \
do { \ do { \
struct mapped_device *md = dm_table_get_md((m)->ti->table); \
\
DMDEBUG_LIMIT("%s: returning EIO; QIFNP = %d; SQIFNP = %d; DNFS = %d", \ DMDEBUG_LIMIT("%s: returning EIO; QIFNP = %d; SQIFNP = %d; DNFS = %d", \
dm_device_name(md), \ dm_table_device_name((m)->ti->table), \
test_bit(MPATHF_QUEUE_IF_NO_PATH, &(m)->flags), \ test_bit(MPATHF_QUEUE_IF_NO_PATH, &(m)->flags), \
test_bit(MPATHF_SAVED_QUEUE_IF_NO_PATH, &(m)->flags), \ test_bit(MPATHF_SAVED_QUEUE_IF_NO_PATH, &(m)->flags), \
dm_noflush_suspending((m)->ti)); \ dm_noflush_suspending((m)->ti)); \
...@@ -736,7 +734,7 @@ static int queue_if_no_path(struct multipath *m, bool queue_if_no_path, ...@@ -736,7 +734,7 @@ static int queue_if_no_path(struct multipath *m, bool queue_if_no_path,
{ {
unsigned long flags; unsigned long flags;
bool queue_if_no_path_bit, saved_queue_if_no_path_bit; bool queue_if_no_path_bit, saved_queue_if_no_path_bit;
const char *dm_dev_name = dm_device_name(dm_table_get_md(m->ti->table)); const char *dm_dev_name = dm_table_device_name(m->ti->table);
DMDEBUG("%s: %s caller=%s queue_if_no_path=%d save_old_value=%d", DMDEBUG("%s: %s caller=%s queue_if_no_path=%d save_old_value=%d",
dm_dev_name, __func__, caller, queue_if_no_path, save_old_value); dm_dev_name, __func__, caller, queue_if_no_path, save_old_value);
...@@ -781,9 +779,9 @@ static int queue_if_no_path(struct multipath *m, bool queue_if_no_path, ...@@ -781,9 +779,9 @@ static int queue_if_no_path(struct multipath *m, bool queue_if_no_path,
static void queue_if_no_path_timeout_work(struct timer_list *t) static void queue_if_no_path_timeout_work(struct timer_list *t)
{ {
struct multipath *m = from_timer(m, t, nopath_timer); struct multipath *m = from_timer(m, t, nopath_timer);
struct mapped_device *md = dm_table_get_md(m->ti->table);
DMWARN("queue_if_no_path timeout on %s, failing queued IO", dm_device_name(md)); DMWARN("queue_if_no_path timeout on %s, failing queued IO",
dm_table_device_name(m->ti->table));
queue_if_no_path(m, false, false, __func__); queue_if_no_path(m, false, false, __func__);
} }
...@@ -1334,7 +1332,7 @@ static int fail_path(struct pgpath *pgpath) ...@@ -1334,7 +1332,7 @@ static int fail_path(struct pgpath *pgpath)
goto out; goto out;
DMWARN("%s: Failing path %s.", DMWARN("%s: Failing path %s.",
dm_device_name(dm_table_get_md(m->ti->table)), dm_table_device_name(m->ti->table),
pgpath->path.dev->name); pgpath->path.dev->name);
pgpath->pg->ps.type->fail_path(&pgpath->pg->ps, &pgpath->path); pgpath->pg->ps.type->fail_path(&pgpath->pg->ps, &pgpath->path);
...@@ -1375,7 +1373,7 @@ static int reinstate_path(struct pgpath *pgpath) ...@@ -1375,7 +1373,7 @@ static int reinstate_path(struct pgpath *pgpath)
goto out; goto out;
DMWARN("%s: Reinstating path %s.", DMWARN("%s: Reinstating path %s.",
dm_device_name(dm_table_get_md(m->ti->table)), dm_table_device_name(m->ti->table),
pgpath->path.dev->name); pgpath->path.dev->name);
r = pgpath->pg->ps.type->reinstate_path(&pgpath->pg->ps, &pgpath->path); r = pgpath->pg->ps.type->reinstate_path(&pgpath->pg->ps, &pgpath->path);
...@@ -1766,7 +1764,7 @@ static void multipath_resume(struct dm_target *ti) ...@@ -1766,7 +1764,7 @@ static void multipath_resume(struct dm_target *ti)
} }
DMDEBUG("%s: %s finished; QIFNP = %d; SQIFNP = %d", DMDEBUG("%s: %s finished; QIFNP = %d; SQIFNP = %d",
dm_device_name(dm_table_get_md(m->ti->table)), __func__, dm_table_device_name(m->ti->table), __func__,
test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags), test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags),
test_bit(MPATHF_SAVED_QUEUE_IF_NO_PATH, &m->flags)); test_bit(MPATHF_SAVED_QUEUE_IF_NO_PATH, &m->flags));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment