diff options
| -rw-r--r-- | Documentation/device-mapper/cache.txt | 3 | ||||
| -rw-r--r-- | drivers/md/dm-cache-policy-mq.c | 3 | ||||
| -rw-r--r-- | drivers/md/dm-cache-policy.c | 4 | ||||
| -rw-r--r-- | drivers/md/dm-cache-policy.h | 6 | ||||
| -rw-r--r-- | drivers/md/dm-cache-target.c | 4 |
5 files changed, 17 insertions, 3 deletions
diff --git a/Documentation/device-mapper/cache.txt b/Documentation/device-mapper/cache.txt index 63fd7cfa4cf1..e6b72d355151 100644 --- a/Documentation/device-mapper/cache.txt +++ b/Documentation/device-mapper/cache.txt | |||
| @@ -221,7 +221,7 @@ Status | |||
| 221 | <cache block size> <#used cache blocks>/<#total cache blocks> | 221 | <cache block size> <#used cache blocks>/<#total cache blocks> |
| 222 | <#read hits> <#read misses> <#write hits> <#write misses> | 222 | <#read hits> <#read misses> <#write hits> <#write misses> |
| 223 | <#demotions> <#promotions> <#dirty> <#features> <features>* | 223 | <#demotions> <#promotions> <#dirty> <#features> <features>* |
| 224 | <#core args> <core args>* <#policy args> <policy args>* | 224 | <#core args> <core args>* <policy name> <#policy args> <policy args>* |
| 225 | 225 | ||
| 226 | metadata block size : Fixed block size for each metadata block in | 226 | metadata block size : Fixed block size for each metadata block in |
| 227 | sectors | 227 | sectors |
| @@ -250,6 +250,7 @@ feature args : 'writethrough' (optional) | |||
| 250 | #core args : Number of core arguments (must be even) | 250 | #core args : Number of core arguments (must be even) |
| 251 | core args : Key/value pairs for tuning the core | 251 | core args : Key/value pairs for tuning the core |
| 252 | e.g. migration_threshold | 252 | e.g. migration_threshold |
| 253 | policy name : Name of the policy | ||
| 253 | #policy args : Number of policy arguments to follow (must be even) | 254 | #policy args : Number of policy arguments to follow (must be even) |
| 254 | policy args : Key/value pairs | 255 | policy args : Key/value pairs |
| 255 | e.g. sequential_threshold | 256 | e.g. sequential_threshold |
diff --git a/drivers/md/dm-cache-policy-mq.c b/drivers/md/dm-cache-policy-mq.c index e63e36cefc89..930e8c3d73e9 100644 --- a/drivers/md/dm-cache-policy-mq.c +++ b/drivers/md/dm-cache-policy-mq.c | |||
| @@ -1276,7 +1276,8 @@ static struct dm_cache_policy_type default_policy_type = { | |||
| 1276 | .version = {1, 2, 0}, | 1276 | .version = {1, 2, 0}, |
| 1277 | .hint_size = 4, | 1277 | .hint_size = 4, |
| 1278 | .owner = THIS_MODULE, | 1278 | .owner = THIS_MODULE, |
| 1279 | .create = mq_create | 1279 | .create = mq_create, |
| 1280 | .real = &mq_policy_type | ||
| 1280 | }; | 1281 | }; |
| 1281 | 1282 | ||
| 1282 | static int __init mq_init(void) | 1283 | static int __init mq_init(void) |
diff --git a/drivers/md/dm-cache-policy.c b/drivers/md/dm-cache-policy.c index d80057968407..c1a3cee99b44 100644 --- a/drivers/md/dm-cache-policy.c +++ b/drivers/md/dm-cache-policy.c | |||
| @@ -146,6 +146,10 @@ const char *dm_cache_policy_get_name(struct dm_cache_policy *p) | |||
| 146 | { | 146 | { |
| 147 | struct dm_cache_policy_type *t = p->private; | 147 | struct dm_cache_policy_type *t = p->private; |
| 148 | 148 | ||
| 149 | /* if t->real is set then an alias was used (e.g. "default") */ | ||
| 150 | if (t->real) | ||
| 151 | return t->real->name; | ||
| 152 | |||
| 149 | return t->name; | 153 | return t->name; |
| 150 | } | 154 | } |
| 151 | EXPORT_SYMBOL_GPL(dm_cache_policy_get_name); | 155 | EXPORT_SYMBOL_GPL(dm_cache_policy_get_name); |
diff --git a/drivers/md/dm-cache-policy.h b/drivers/md/dm-cache-policy.h index 052c00a84a5c..f50fe360c546 100644 --- a/drivers/md/dm-cache-policy.h +++ b/drivers/md/dm-cache-policy.h | |||
| @@ -223,6 +223,12 @@ struct dm_cache_policy_type { | |||
| 223 | unsigned version[CACHE_POLICY_VERSION_SIZE]; | 223 | unsigned version[CACHE_POLICY_VERSION_SIZE]; |
| 224 | 224 | ||
| 225 | /* | 225 | /* |
| 226 | * For use by an alias dm_cache_policy_type to point to the | ||
| 227 | * real dm_cache_policy_type. | ||
| 228 | */ | ||
| 229 | struct dm_cache_policy_type *real; | ||
| 230 | |||
| 231 | /* | ||
| 226 | * Policies may store a hint for each each cache block. | 232 | * Policies may store a hint for each each cache block. |
| 227 | * Currently the size of this hint must be 0 or 4 bytes but we | 233 | * Currently the size of this hint must be 0 or 4 bytes but we |
| 228 | * expect to relax this in future. | 234 | * expect to relax this in future. |
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 11ad70540d40..09334c275c79 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
| @@ -2832,7 +2832,7 @@ static void cache_resume(struct dm_target *ti) | |||
| 2832 | * <#demotions> <#promotions> <#dirty> | 2832 | * <#demotions> <#promotions> <#dirty> |
| 2833 | * <#features> <features>* | 2833 | * <#features> <features>* |
| 2834 | * <#core args> <core args> | 2834 | * <#core args> <core args> |
| 2835 | * <#policy args> <policy args>* | 2835 | * <policy name> <#policy args> <policy args>* |
| 2836 | */ | 2836 | */ |
| 2837 | static void cache_status(struct dm_target *ti, status_type_t type, | 2837 | static void cache_status(struct dm_target *ti, status_type_t type, |
| 2838 | unsigned status_flags, char *result, unsigned maxlen) | 2838 | unsigned status_flags, char *result, unsigned maxlen) |
| @@ -2900,6 +2900,8 @@ static void cache_status(struct dm_target *ti, status_type_t type, | |||
| 2900 | } | 2900 | } |
| 2901 | 2901 | ||
| 2902 | DMEMIT("2 migration_threshold %llu ", (unsigned long long) cache->migration_threshold); | 2902 | DMEMIT("2 migration_threshold %llu ", (unsigned long long) cache->migration_threshold); |
| 2903 | |||
| 2904 | DMEMIT("%s ", dm_cache_policy_get_name(cache->policy)); | ||
| 2903 | if (sz < maxlen) { | 2905 | if (sz < maxlen) { |
| 2904 | r = policy_emit_config_values(cache->policy, result + sz, maxlen - sz); | 2906 | r = policy_emit_config_values(cache->policy, result + sz, maxlen - sz); |
| 2905 | if (r) | 2907 | if (r) |
