File Index
Files and directories
Sign in
FILE

index-session.h

File preview with syntax highlighting.

linux-6.19.14/drivers/md/dm-vdo/indexer/index-session.h C
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * Copyright 2023 Red Hat
 4 */
 5
 6#ifndef UDS_INDEX_SESSION_H
 7#define UDS_INDEX_SESSION_H
 8
 9#include <linux/atomic.h>
10#include <linux/cache.h>
11
12#include "thread-utils.h"
13
14#include "config.h"
15#include "indexer.h"
16
17/*
18 * The index session mediates all interactions with a UDS index. Once the index session is created,
19 * it can be used to open, close, suspend, or recreate an index. It implements the majority of the
20 * functions in the top-level UDS API.
21 *
22 * If any deduplication request fails due to an internal error, the index is marked disabled. It
23 * will not accept any further requests and can only be closed. Closing the index will clear the
24 * disabled flag, and the index can then be reopened and recovered using the same index session.
25 */
26
27struct __aligned(L1_CACHE_BYTES) session_stats {
28	/* Post requests that found an entry */
29	u64 posts_found;
30	/* Post requests found in the open chapter */
31	u64 posts_found_open_chapter;
32	/* Post requests found in the dense index */
33	u64 posts_found_dense;
34	/* Post requests found in the sparse index */
35	u64 posts_found_sparse;
36	/* Post requests that did not find an entry */
37	u64 posts_not_found;
38	/* Update requests that found an entry */
39	u64 updates_found;
40	/* Update requests that did not find an entry */
41	u64 updates_not_found;
42	/* Delete requests that found an entry */
43	u64 deletions_found;
44	/* Delete requests that did not find an entry */
45	u64 deletions_not_found;
46	/* Query requests that found an entry */
47	u64 queries_found;
48	/* Query requests that did not find an entry */
49	u64 queries_not_found;
50	/* Total number of requests */
51	u64 requests;
52};
53
54enum index_suspend_status {
55	/* An index load has started but the index is not ready for use. */
56	INDEX_OPENING = 0,
57	/* The index is able to handle requests. */
58	INDEX_READY,
59	/* The index is attempting to suspend a rebuild. */
60	INDEX_SUSPENDING,
61	/* An index rebuild has been suspended. */
62	INDEX_SUSPENDED,
63	/* An index rebuild is being stopped in order to shut down. */
64	INDEX_FREEING,
65};
66
67struct index_load_context {
68	struct mutex mutex;
69	struct cond_var cond;
70	enum index_suspend_status status;
71};
72
73struct uds_index_session {
74	unsigned int state;
75	struct uds_index *index;
76	struct uds_request_queue *callback_queue;
77	struct uds_parameters parameters;
78	struct index_load_context load_context;
79	struct mutex request_mutex;
80	struct cond_var request_cond;
81	int request_count;
82	struct session_stats stats;
83};
84
85#endif /* UDS_INDEX_SESSION_H */
~/ Read-only file preview.