summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-cache-background-tracker.h
diff options
context:
space:
mode:
authorJoe Thornber <ejt@redhat.com>2016-12-15 04:57:31 -0500
committerMike Snitzer <snitzer@redhat.com>2017-03-07 13:28:31 -0500
commitb29d4986d0da1a27cd35917cdb433672f5c95d7f (patch)
treea5d94b86cf1eb759bfef5761015135d747e80561 /drivers/md/dm-cache-background-tracker.h
parent742c8fdc31e820503f9267070311d894978d1349 (diff)
dm cache: significant rework to leverage dm-bio-prison-v2
The cache policy interfaces have been updated to work well with the new bio-prison v2 interface's ability to queue work immediately (promotion, demotion, etc) -- overriding benefit being reduced latency on processing IO through the cache. Previously such work would be left for the DM cache core to queue on various lists and then process in batches later -- this caused a serious delay in latency for IO driven by the cache. The background tracker code was factored out so that all cache policies can make use of it. Also, the "cleaner" policy has been removed and is now a variant of the smq policy that simply disallows migrations. Signed-off-by: Joe Thornber <ejt@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-cache-background-tracker.h')
-rw-r--r--drivers/md/dm-cache-background-tracker.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/md/dm-cache-background-tracker.h b/drivers/md/dm-cache-background-tracker.h
new file mode 100644
index 000000000000..27ab90dbc275
--- /dev/null
+++ b/drivers/md/dm-cache-background-tracker.h
@@ -0,0 +1,46 @@
1/*
2 * Copyright (C) 2017 Red Hat. All rights reserved.
3 *
4 * This file is released under the GPL.
5 */
6
7#ifndef DM_CACHE_BACKGROUND_WORK_H
8#define DM_CACHE_BACKGROUND_WORK_H
9
10#include <linux/vmalloc.h>
11#include "dm-cache-policy.h"
12
13/*----------------------------------------------------------------*/
14
15struct background_work;
16struct background_tracker;
17
18/*
19 * FIXME: discuss lack of locking in all methods.
20 */
21struct background_tracker *btracker_create(unsigned max_work);
22void btracker_destroy(struct background_tracker *b);
23
24unsigned btracker_nr_writebacks_queued(struct background_tracker *b);
25unsigned btracker_nr_demotions_queued(struct background_tracker *b);
26
27/*
28 * returns -EINVAL iff the work is already queued. -ENOMEM if the work
29 * couldn't be queued for another reason.
30 */
31int btracker_queue(struct background_tracker *b,
32 struct policy_work *work,
33 struct policy_work **pwork);
34
35/*
36 * Returns -ENODATA if there's no work.
37 */
38int btracker_issue(struct background_tracker *b, struct policy_work **work);
39void btracker_complete(struct background_tracker *b,
40 struct policy_work *op);
41bool btracker_promotion_already_present(struct background_tracker *b,
42 dm_oblock_t oblock);
43
44/*----------------------------------------------------------------*/
45
46#endif