summaryrefslogtreecommitdiffstats
path: root/include/linux/fscache.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2018-04-04 08:41:28 -0400
committerDavid Howells <dhowells@redhat.com>2018-04-06 09:05:14 -0400
commitec0328e46d6e5d0f17372eb90ab8e333c2ac7ca9 (patch)
tree0ff7cf689f4259baa44a5de789f72cdc015a1e30 /include/linux/fscache.h
parentee1235a9a06813429c201bf186397a6feeea07bf (diff)
fscache: Maintain a catalogue of allocated cookies
Maintain a catalogue of allocated cookies so that cookie collisions can be handled properly. For the moment, this just involves printing a warning and returning a NULL cookie to the caller of fscache_acquire_cookie(), but in future it might make sense to wait for the old cookie to finish being cleaned up. This requires the cookie key to be stored attached to the cookie so that we still have the key available if the netfs relinquishes the cookie. This is done by an earlier patch. The catalogue also renders redundant fscache_netfs_list (used for checking for duplicates), so that can be removed. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Anna Schumaker <anna.schumaker@netapp.com> Tested-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'include/linux/fscache.h')
-rw-r--r--include/linux/fscache.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/fscache.h b/include/linux/fscache.h
index eb38f39cf832..84b90a79d75a 100644
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -22,6 +22,7 @@
22#include <linux/list.h> 22#include <linux/list.h>
23#include <linux/pagemap.h> 23#include <linux/pagemap.h>
24#include <linux/pagevec.h> 24#include <linux/pagevec.h>
25#include <linux/list_bl.h>
25 26
26#if defined(CONFIG_FSCACHE) || defined(CONFIG_FSCACHE_MODULE) 27#if defined(CONFIG_FSCACHE) || defined(CONFIG_FSCACHE_MODULE)
27#define fscache_available() (1) 28#define fscache_available() (1)
@@ -124,7 +125,6 @@ struct fscache_netfs {
124 uint32_t version; /* indexing version */ 125 uint32_t version; /* indexing version */
125 const char *name; /* filesystem name */ 126 const char *name; /* filesystem name */
126 struct fscache_cookie *primary_index; 127 struct fscache_cookie *primary_index;
127 struct list_head link; /* internal link */
128}; 128};
129 129
130/* 130/*
@@ -143,6 +143,7 @@ struct fscache_cookie {
143 struct hlist_head backing_objects; /* object(s) backing this file/index */ 143 struct hlist_head backing_objects; /* object(s) backing this file/index */
144 const struct fscache_cookie_def *def; /* definition */ 144 const struct fscache_cookie_def *def; /* definition */
145 struct fscache_cookie *parent; /* parent of this entry */ 145 struct fscache_cookie *parent; /* parent of this entry */
146 struct hlist_bl_node hash_link; /* Link in hash table */
146 void *netfs_data; /* back pointer to netfs */ 147 void *netfs_data; /* back pointer to netfs */
147 struct radix_tree_root stores; /* pages to be stored on this cookie */ 148 struct radix_tree_root stores; /* pages to be stored on this cookie */
148#define FSCACHE_COOKIE_PENDING_TAG 0 /* pages tag: pending write to cache */ 149#define FSCACHE_COOKIE_PENDING_TAG 0 /* pages tag: pending write to cache */
@@ -156,11 +157,14 @@ struct fscache_cookie {
156#define FSCACHE_COOKIE_RELINQUISHED 4 /* T if cookie has been relinquished */ 157#define FSCACHE_COOKIE_RELINQUISHED 4 /* T if cookie has been relinquished */
157#define FSCACHE_COOKIE_ENABLED 5 /* T if cookie is enabled */ 158#define FSCACHE_COOKIE_ENABLED 5 /* T if cookie is enabled */
158#define FSCACHE_COOKIE_ENABLEMENT_LOCK 6 /* T if cookie is being en/disabled */ 159#define FSCACHE_COOKIE_ENABLEMENT_LOCK 6 /* T if cookie is being en/disabled */
159#define FSCACHE_COOKIE_AUX_UPDATED 7 /* T if the auxiliary data was updated */ 160#define FSCACHE_COOKIE_AUX_UPDATED 8 /* T if the auxiliary data was updated */
161#define FSCACHE_COOKIE_ACQUIRED 9 /* T if cookie is in use */
162#define FSCACHE_COOKIE_RELINQUISHING 10 /* T if cookie is being relinquished */
160 163
161 u8 type; /* Type of object */ 164 u8 type; /* Type of object */
162 u8 key_len; /* Length of index key */ 165 u8 key_len; /* Length of index key */
163 u8 aux_len; /* Length of auxiliary data */ 166 u8 aux_len; /* Length of auxiliary data */
167 u32 key_hash; /* Hash of parent, type, key, len */
164 union { 168 union {
165 void *key; /* Index key */ 169 void *key; /* Index key */
166 u8 inline_key[16]; /* - If the key is short enough */ 170 u8 inline_key[16]; /* - If the key is short enough */