--- drivers/md/dm-cache-policy-cleaner.c | 19 +++++++++++++------ drivers/md/dm-cache-policy-mq.c | 12 ++++++++++-- 2 files changed, 23 insertions(+), 8 deletions(-) Index: linux/drivers/md/dm-cache-policy-cleaner.c =================================================================== --- linux.orig/drivers/md/dm-cache-policy-cleaner.c +++ linux/drivers/md/dm-cache-policy-cleaner.c @@ -15,6 +15,9 @@ /*----------------------------------------------------------------*/ +#define DM_MSG_PREFIX "cache cleaner" +#define CLEANER_VERSION "1.0.0" + /* Cache entry struct. */ struct wb_cache_entry { struct list_head list; @@ -91,7 +94,7 @@ static void free_hash(struct hash *hash) static int alloc_cache_blocks_with_hash(struct policy *p, dm_cblock_t cache_size) { - int r; + int r = -ENOMEM; p->cblocks = vzalloc(sizeof(*p->cblocks) * from_cblock(cache_size)); if (p->cblocks) { @@ -106,9 +109,7 @@ static int alloc_cache_blocks_with_hash( r = alloc_hash(&p->chash, from_cblock(cache_size)); if (r) vfree(p->cblocks); - - } else - r = -ENOMEM; + } return r; } @@ -218,7 +219,6 @@ static int wb_lookup(struct dm_cache_pol return r; } - static void __set_clear_dirty(struct dm_cache_policy *pe, dm_oblock_t oblock, bool set) { struct policy *p = to_policy(pe); @@ -439,7 +439,14 @@ static struct dm_cache_policy_type wb_po static int __init wb_init(void) { - return dm_cache_policy_register(&wb_policy_type); + int r = dm_cache_policy_register(&wb_policy_type); + + if (r < 0) + DMERR("register failed %d", r); + else + DMINFO("version " CLEANER_VERSION " loaded"); + + return r; } static void __exit wb_exit(void) 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 @@ -13,6 +13,7 @@ #include #define DM_MSG_PREFIX "cache-policy-mq" +#define MQ_VERSION "1.0.0" static struct kmem_cache *mq_entry_cache; @@ -1224,12 +1225,18 @@ static int __init mq_init(void) goto bad; r = dm_cache_policy_register(&mq_policy_type); - if (r) + if (r) { + DMERR("register failed %d", r); goto bad_register_mq; + } r = dm_cache_policy_register(&default_policy_type); - if (!r) + if (!r) { + DMINFO("version " MQ_VERSION " loaded"); return 0; + } + + DMERR("register failed (as default) %d", r); dm_cache_policy_unregister(&mq_policy_type); bad_register_mq: @@ -1242,6 +1249,7 @@ static void __exit mq_exit(void) { dm_cache_policy_unregister(&mq_policy_type); dm_cache_policy_unregister(&default_policy_type); + kmem_cache_destroy(mq_entry_cache); }