dm cache: misc fixes and nits Warning: trailing whitespace in lines 84,477,481 of drivers/md/dm-cache-policy-hints.c Warning: trailing whitespace in lines 293,294,296 of drivers/md/Kconfig --- drivers/md/Kconfig | 6 +++--- drivers/md/dm-cache-metadata.c | 8 ++++---- drivers/md/dm-cache-policy-hints.c | 6 +++--- drivers/md/dm-cache-policy-mq.c | 4 ++-- drivers/md/dm-cache-policy.h | 2 +- drivers/md/dm-cache-target.c | 23 +++++++++++------------ drivers/md/dm-table.c | 5 ++++- 7 files changed, 28 insertions(+), 26 deletions(-) Index: linux/drivers/md/dm-cache-policy-hints.c =================================================================== --- linux.orig/drivers/md/dm-cache-policy-hints.c +++ linux/drivers/md/dm-cache-policy-hints.c @@ -81,7 +81,7 @@ static struct entry *queue_pop(struct li list_del(elt); return list_entry(elt, struct entry, list); } - + return NULL; } /*----------------------------------------------------------------------------*/ @@ -474,11 +474,11 @@ static void __hints_xfer_disk(struct pol }; struct hints_ptrs hints_ptrs; - + if (!p->hint_size_set) { calc_hint_value_counters(p); p->hint_size_set = true; - } + } /* Must happen after calc_hint_value_counters()! */ set_hints_ptrs(p, &hints_ptrs); Index: linux/drivers/md/Kconfig =================================================================== --- linux.orig/drivers/md/Kconfig +++ linux/drivers/md/Kconfig @@ -290,10 +290,10 @@ config DM_CACHE_MQ_ERA A wrapper for the MQ policy that adds an "era" property to the per-cache-block metadata, to facilitate the implementation of cache coherency validation and recovery tools. This mechanism - works as follows. There is a monotonically increasing 32-bit era - counter associated with each cache instance. Each cache block is + works as follows. There is a monotonically increasing 32-bit era + counter associated with each cache instance. Each cache block is tagged with the era during which it was last written. A device - mapper message interface is provided to obtain the current era, + mapper message interface is provided to obtain the current era, advance to the next era, and invalidate blocks from before or after a given era. NOTE: this policy will provide the same performance benefits as MQ but requires significantly more memory Index: linux/drivers/md/dm-cache-metadata.c =================================================================== --- linux.orig/drivers/md/dm-cache-metadata.c +++ linux/drivers/md/dm-cache-metadata.c @@ -259,7 +259,7 @@ static int __setup_mapping_info(struct d return 0; } -static void __teardown_mapping_info(struct dm_cache_metadata *cmd) +static void __destroy_mapping_info(struct dm_cache_metadata *cmd) { if (cmd->policy_hint_value_buffer) kfree(cmd->policy_hint_value_buffer); @@ -361,7 +361,7 @@ static int __format_metadata(struct dm_c return 0; bad: - __teardown_mapping_info(cmd); + __destroy_mapping_info(cmd); bad_mapping_info: dm_tm_destroy(cmd->tm); dm_sm_destroy(cmd->metadata_sm); @@ -680,7 +680,7 @@ struct dm_cache_metadata *dm_cache_metad r = __create_persistent_data_objects(cmd, may_format_device); if (r) { - __teardown_mapping_info(cmd); + __destroy_mapping_info(cmd); kfree(cmd); return ERR_PTR(r); } @@ -697,7 +697,7 @@ struct dm_cache_metadata *dm_cache_metad void dm_cache_metadata_close(struct dm_cache_metadata *cmd) { __destroy_persistent_data_objects(cmd); - __teardown_mapping_info(cmd); + __destroy_mapping_info(cmd); kfree(cmd); } Index: linux/drivers/md/dm-cache-policy-mq.c =================================================================== --- linux.orig/drivers/md/dm-cache-policy-mq.c +++ linux/drivers/md/dm-cache-policy-mq.c @@ -1107,7 +1107,7 @@ static void mq_remove_mapping(struct dm_ mutex_unlock(&mq->lock); } -static int mq_writeback_work_(struct mq_policy *mq, dm_oblock_t *oblock, +static int __mq_writeback_work(struct mq_policy *mq, dm_oblock_t *oblock, dm_cblock_t *cblock) { struct entry *e = pop(mq, &mq->cache_dirty); @@ -1144,7 +1144,7 @@ static int mq_writeback_work(struct dm_c struct mq_policy *mq = to_mq_policy(p); mutex_lock(&mq->lock); - r = mq_writeback_work_(mq, oblock, cblock); + r = __mq_writeback_work(mq, oblock, cblock); mutex_unlock(&mq->lock); return r; Index: linux/drivers/md/dm-cache-target.c =================================================================== --- linux.orig/drivers/md/dm-cache-target.c +++ linux/drivers/md/dm-cache-target.c @@ -2668,7 +2674,7 @@ static int resize_cache_dev(struct cache return 0; } -static int cache_preresume_(struct dm_target *ti) +static int cache_preresume(struct dm_target *ti) { int r = 0; struct cache *cache = ti->private; @@ -2717,14 +2723,6 @@ static int cache_preresume_(struct dm_ta return r; } -static int cache_preresume(struct dm_target *ti) -{ - int r = cache_preresume_(ti); - if (r) - DMERR("cache_preresume failed"); - return r; -} - static void cache_resume(struct dm_target *ti) { struct cache *cache = ti->private; @@ -2800,9 +2798,10 @@ static void cache_status(struct dm_targe else if (writeback_mode(&cache->features)) DMEMIT("1 writeback "); - else - DMERR("internal error: unknown io mode: %d", - (int) cache->features.io_mode); + else { + DMERR("internal error: unknown io mode: %d", (int) cache->features.io_mode); + goto err; + } DMEMIT("2 migration_threshold %llu ", (unsigned long long) cache->migration_threshold); if (sz < maxlen) { Index: linux/drivers/md/dm-table.c =================================================================== --- linux.orig/drivers/md/dm-table.c +++ linux/drivers/md/dm-table.c @@ -1548,8 +1548,11 @@ int dm_table_resume_targets(struct dm_ta continue; r = ti->type->preresume(ti); - if (r) + if (r) { + DMERR("%s: %s: preresume failed, error = %d", + dm_device_name(t->md), ti->type->name, r); return r; + } } for (i = 0; i < t->num_targets; i++) { Index: linux/drivers/md/dm-cache-policy.h =================================================================== --- linux.orig/drivers/md/dm-cache-policy.h +++ linux/drivers/md/dm-cache-policy.h @@ -8,7 +8,7 @@ #define DM_CACHE_POLICY_H #include "dm-cache-block-types.h" -#include "persistent-data/dm-btree.h" +#include "persistent-data/dm-btree.h" /* for __dm_written_to_disk */ #include