File: dm-cache-background-tracker.h

package info (click to toggle)
linux 6.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,488,076 kB
  • sloc: ansic: 23,401,844; asm: 266,744; sh: 108,976; makefile: 49,705; python: 36,927; perl: 36,810; cpp: 6,044; yacc: 4,904; lex: 2,722; awk: 1,440; ruby: 25; sed: 5
file content (46 lines) | stat: -rw-r--r-- 1,288 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * Copyright (C) 2017 Red Hat. All rights reserved.
 *
 * This file is released under the GPL.
 */

#ifndef DM_CACHE_BACKGROUND_WORK_H
#define DM_CACHE_BACKGROUND_WORK_H

#include <linux/vmalloc.h>
#include "dm-cache-policy.h"

/*----------------------------------------------------------------*/

struct background_work;
struct background_tracker;

/*
 * FIXME: discuss lack of locking in all methods.
 */
struct background_tracker *btracker_create(unsigned max_work);
void btracker_destroy(struct background_tracker *b);

unsigned btracker_nr_writebacks_queued(struct background_tracker *b);
unsigned btracker_nr_demotions_queued(struct background_tracker *b);

/*
 * returns -EINVAL iff the work is already queued.  -ENOMEM if the work
 * couldn't be queued for another reason.
 */
int btracker_queue(struct background_tracker *b,
		   struct policy_work *work,
		   struct policy_work **pwork);

/*
 * Returns -ENODATA if there's no work.
 */
int btracker_issue(struct background_tracker *b, struct policy_work **work);
void btracker_complete(struct background_tracker *b,
		       struct policy_work *op);
bool btracker_promotion_already_present(struct background_tracker *b,
					dm_oblock_t oblock);

/*----------------------------------------------------------------*/

#endif