Linux 4.19.133
[linux/fpc-iii.git] / drivers / md / dm-cache-background-tracker.h
blob27ab90dbc275236cf60e7bd7b4a6e925832483d7
1 /*
2 * Copyright (C) 2017 Red Hat. All rights reserved.
4 * This file is released under the GPL.
5 */
7 #ifndef DM_CACHE_BACKGROUND_WORK_H
8 #define DM_CACHE_BACKGROUND_WORK_H
10 #include <linux/vmalloc.h>
11 #include "dm-cache-policy.h"
13 /*----------------------------------------------------------------*/
15 struct background_work;
16 struct background_tracker;
19 * FIXME: discuss lack of locking in all methods.
21 struct background_tracker *btracker_create(unsigned max_work);
22 void btracker_destroy(struct background_tracker *b);
24 unsigned btracker_nr_writebacks_queued(struct background_tracker *b);
25 unsigned btracker_nr_demotions_queued(struct background_tracker *b);
28 * returns -EINVAL iff the work is already queued. -ENOMEM if the work
29 * couldn't be queued for another reason.
31 int btracker_queue(struct background_tracker *b,
32 struct policy_work *work,
33 struct policy_work **pwork);
36 * Returns -ENODATA if there's no work.
38 int btracker_issue(struct background_tracker *b, struct policy_work **work);
39 void btracker_complete(struct background_tracker *b,
40 struct policy_work *op);
41 bool btracker_promotion_already_present(struct background_tracker *b,
42 dm_oblock_t oblock);
44 /*----------------------------------------------------------------*/
46 #endif