summaryrefslogtreecommitdiff
path: root/drivers/md/dm-cache-policy.h
diff options
context:
space:
mode:
authorJoe Thornber <ejt@redhat.com>2016-09-15 16:23:46 +0300
committerMike Snitzer <snitzer@redhat.com>2016-09-22 18:15:02 +0300
commit4e781b498ee5008ede91362d91404a362e7a46b3 (patch)
tree039f3914f839b455759253fb0395a639a1912dae /drivers/md/dm-cache-policy.h
parentdd6a77d99859ab963503e67372ed278fe8ceab26 (diff)
downloadlinux-4e781b498ee5008ede91362d91404a362e7a46b3.tar.xz
dm cache: speed up writing of the hint array
It's far quicker to always delete the hint array and recreate with dm_array_new() because we avoid the copying caused by mutation. Also simplifies the policy interface, replacing the walk_hints() with the simpler get_hint(). Signed-off-by: Joe Thornber <ejt@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-cache-policy.h')
-rw-r--r--drivers/md/dm-cache-policy.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/md/dm-cache-policy.h b/drivers/md/dm-cache-policy.h
index 05db56eedb6a..aa10b1493f34 100644
--- a/drivers/md/dm-cache-policy.h
+++ b/drivers/md/dm-cache-policy.h
@@ -90,9 +90,6 @@ struct policy_result {
dm_cblock_t cblock; /* POLICY_HIT, POLICY_NEW, POLICY_REPLACE */
};
-typedef int (*policy_walk_fn)(void *context, dm_cblock_t cblock,
- dm_oblock_t oblock, uint32_t hint);
-
/*
* The cache policy object. Just a bunch of methods. It is envisaged that
* this structure will be embedded in a bigger, policy specific structure
@@ -158,8 +155,11 @@ struct dm_cache_policy {
int (*load_mapping)(struct dm_cache_policy *p, dm_oblock_t oblock,
dm_cblock_t cblock, uint32_t hint, bool hint_valid);
- int (*walk_mappings)(struct dm_cache_policy *p, policy_walk_fn fn,
- void *context);
+ /*
+ * Gets the hint for a given cblock. Called in a single threaded
+ * context. So no locking required.
+ */
+ uint32_t (*get_hint)(struct dm_cache_policy *p, dm_cblock_t cblock);
/*
* Override functions used on the error paths of the core target.