Skip to content

Commit d4a512e

Browse files
committed
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: Mike Snitzer <[email protected]>
1 parent 33bd6f0 commit d4a512e

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

drivers/md/dm-cache-target.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ static enum cache_metadata_mode get_cache_mode(struct cache *cache)
925925

926926
static const char *cache_device_name(struct cache *cache)
927927
{
928-
return dm_device_name(dm_table_get_md(cache->ti->table));
928+
return dm_table_device_name(cache->ti->table);
929929
}
930930

931931
static void notify_mode_switch(struct cache *cache, enum cache_metadata_mode mode)

drivers/md/dm-mpath.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,8 @@ static struct pgpath *choose_pgpath(struct multipath *m, size_t nr_bytes)
466466
*/
467467
#define dm_report_EIO(m) \
468468
do { \
469-
struct mapped_device *md = dm_table_get_md((m)->ti->table); \
470-
\
471469
DMDEBUG_LIMIT("%s: returning EIO; QIFNP = %d; SQIFNP = %d; DNFS = %d", \
472-
dm_device_name(md), \
470+
dm_table_device_name((m)->ti->table), \
473471
test_bit(MPATHF_QUEUE_IF_NO_PATH, &(m)->flags), \
474472
test_bit(MPATHF_SAVED_QUEUE_IF_NO_PATH, &(m)->flags), \
475473
dm_noflush_suspending((m)->ti)); \
@@ -736,7 +734,7 @@ static int queue_if_no_path(struct multipath *m, bool queue_if_no_path,
736734
{
737735
unsigned long flags;
738736
bool queue_if_no_path_bit, saved_queue_if_no_path_bit;
739-
const char *dm_dev_name = dm_device_name(dm_table_get_md(m->ti->table));
737+
const char *dm_dev_name = dm_table_device_name(m->ti->table);
740738

741739
DMDEBUG("%s: %s caller=%s queue_if_no_path=%d save_old_value=%d",
742740
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,
781779
static void queue_if_no_path_timeout_work(struct timer_list *t)
782780
{
783781
struct multipath *m = from_timer(m, t, nopath_timer);
784-
struct mapped_device *md = dm_table_get_md(m->ti->table);
785782

786-
DMWARN("queue_if_no_path timeout on %s, failing queued IO", dm_device_name(md));
783+
DMWARN("queue_if_no_path timeout on %s, failing queued IO",
784+
dm_table_device_name(m->ti->table));
787785
queue_if_no_path(m, false, false, __func__);
788786
}
789787

@@ -1334,7 +1332,7 @@ static int fail_path(struct pgpath *pgpath)
13341332
goto out;
13351333

13361334
DMWARN("%s: Failing path %s.",
1337-
dm_device_name(dm_table_get_md(m->ti->table)),
1335+
dm_table_device_name(m->ti->table),
13381336
pgpath->path.dev->name);
13391337

13401338
pgpath->pg->ps.type->fail_path(&pgpath->pg->ps, &pgpath->path);
@@ -1375,7 +1373,7 @@ static int reinstate_path(struct pgpath *pgpath)
13751373
goto out;
13761374

13771375
DMWARN("%s: Reinstating path %s.",
1378-
dm_device_name(dm_table_get_md(m->ti->table)),
1376+
dm_table_device_name(m->ti->table),
13791377
pgpath->path.dev->name);
13801378

13811379
r = pgpath->pg->ps.type->reinstate_path(&pgpath->pg->ps, &pgpath->path);
@@ -1766,7 +1764,7 @@ static void multipath_resume(struct dm_target *ti)
17661764
}
17671765

17681766
DMDEBUG("%s: %s finished; QIFNP = %d; SQIFNP = %d",
1769-
dm_device_name(dm_table_get_md(m->ti->table)), __func__,
1767+
dm_table_device_name(m->ti->table), __func__,
17701768
test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags),
17711769
test_bit(MPATHF_SAVED_QUEUE_IF_NO_PATH, &m->flags));
17721770

0 commit comments

Comments
 (0)