12 #include <linux/sched.h>
15 static uint16_t afs_cell_cache_get_key(
const void *cookie_netfs_data,
17 static uint16_t afs_cell_cache_get_aux(
const void *cookie_netfs_data,
19 static enum fscache_checkaux afs_cell_cache_check_aux(
void *cookie_netfs_data,
23 static uint16_t afs_vlocation_cache_get_key(
const void *cookie_netfs_data,
25 static uint16_t afs_vlocation_cache_get_aux(
const void *cookie_netfs_data,
30 static uint16_t afs_volume_cache_get_key(
const void *cookie_netfs_data,
33 static uint16_t afs_vnode_cache_get_key(
const void *cookie_netfs_data,
35 static void afs_vnode_cache_get_attr(
const void *cookie_netfs_data,
37 static uint16_t afs_vnode_cache_get_aux(
const void *cookie_netfs_data,
39 static enum fscache_checkaux afs_vnode_cache_check_aux(
void *cookie_netfs_data,
42 static void afs_vnode_cache_now_uncached(
void *cookie_netfs_data);
52 .get_key = afs_cell_cache_get_key,
53 .get_aux = afs_cell_cache_get_aux,
54 .check_aux = afs_cell_cache_check_aux,
60 .get_key = afs_vlocation_cache_get_key,
61 .get_aux = afs_vlocation_cache_get_aux,
62 .check_aux = afs_vlocation_cache_check_aux,
68 .get_key = afs_volume_cache_get_key,
74 .get_key = afs_vnode_cache_get_key,
75 .get_attr = afs_vnode_cache_get_attr,
76 .get_aux = afs_vnode_cache_get_aux,
77 .check_aux = afs_vnode_cache_check_aux,
78 .now_uncached = afs_vnode_cache_now_uncached,
84 static uint16_t afs_cell_cache_get_key(
const void *cookie_netfs_data,
87 const struct afs_cell *cell = cookie_netfs_data;
90 _enter(
"%p,%p,%u", cell, buffer, bufmax);
103 static uint16_t afs_cell_cache_get_aux(
const void *cookie_netfs_data,
106 const struct afs_cell *cell = cookie_netfs_data;
109 _enter(
"%p,%p,%u", cell, buffer, bufmax);
112 dlen =
min(dlen, bufmax);
113 dlen &= ~(
sizeof(cell->
vl_addrs[0]) - 1);
122 static enum fscache_checkaux afs_cell_cache_check_aux(
void *cookie_netfs_data,
134 static uint16_t afs_vlocation_cache_get_key(
const void *cookie_netfs_data,
140 _enter(
"{%s},%p,%u", vlocation->
vldb.name, buffer, bufmax);
155 static uint16_t afs_vlocation_cache_get_aux(
const void *cookie_netfs_data,
161 _enter(
"{%s},%p,%u", vlocation->
vldb.name, buffer, bufmax);
178 enum fscache_checkaux afs_vlocation_cache_check_aux(
void *cookie_netfs_data,
186 _enter(
"{%s},%p,%u", vlocation->
vldb.name, buffer, buflen);
200 vlocation->
valid = 1;
201 _leave(
" = SUCCESS [c->m]");
206 if (
memcmp(&vlocation->
vldb, buffer, dlen) != 0) {
209 sizeof(cvldb->
vid)) != 0
227 static uint16_t afs_volume_cache_get_key(
const void *cookie_netfs_data,
233 _enter(
"{%u},%p,%u", volume->
type, buffer, bufmax);
235 klen =
sizeof(volume->
type);
250 static uint16_t afs_vnode_cache_get_key(
const void *cookie_netfs_data,
253 const struct afs_vnode *vnode = cookie_netfs_data;
256 _enter(
"{%x,%x,%llx},%p,%u",
257 vnode->
fid.vnode, vnode->
fid.unique, vnode->
status.data_version,
260 klen =
sizeof(vnode->
fid.vnode);
264 memcpy(buffer, &vnode->
fid.vnode,
sizeof(vnode->
fid.vnode));
273 static void afs_vnode_cache_get_attr(
const void *cookie_netfs_data,
276 const struct afs_vnode *vnode = cookie_netfs_data;
279 vnode->
fid.vnode, vnode->
fid.unique,
280 vnode->
status.data_version);
282 *size = vnode->
status.size;
288 static uint16_t afs_vnode_cache_get_aux(
const void *cookie_netfs_data,
291 const struct afs_vnode *vnode = cookie_netfs_data;
294 _enter(
"{%x,%x,%Lx},%p,%u",
295 vnode->
fid.vnode, vnode->
fid.unique, vnode->
status.data_version,
298 dlen =
sizeof(vnode->
fid.unique) +
sizeof(vnode->
status.data_version);
302 memcpy(buffer, &vnode->
fid.unique,
sizeof(vnode->
fid.unique));
303 buffer +=
sizeof(vnode->
fid.unique);
305 sizeof(vnode->
status.data_version));
314 static enum fscache_checkaux afs_vnode_cache_check_aux(
void *cookie_netfs_data,
318 struct afs_vnode *vnode = cookie_netfs_data;
321 _enter(
"{%x,%x,%llx},%p,%u",
322 vnode->
fid.vnode, vnode->
fid.unique, vnode->
status.data_version,
326 dlen =
sizeof(vnode->
fid.unique) +
sizeof(vnode->
status.data_version);
327 if (dlen != buflen) {
328 _leave(
" = OBSOLETE [len %hx != %hx]", dlen, buflen);
334 sizeof(vnode->
fid.unique)
338 memcpy(&unique, buffer,
sizeof(unique));
340 _leave(
" = OBSOLETE [uniq %x != %x]",
341 unique, vnode->
fid.unique);
345 if (
memcmp(buffer +
sizeof(vnode->
fid.unique),
346 &vnode->
status.data_version,
347 sizeof(vnode->
status.data_version)
351 memcpy(&version, buffer +
sizeof(vnode->
fid.unique),
354 _leave(
" = OBSOLETE [vers %llx != %llx]",
355 version, vnode->
status.data_version);
370 static void afs_vnode_cache_now_uncached(
void *cookie_netfs_data)
372 struct afs_vnode *vnode = cookie_netfs_data;
378 vnode->
fid.vnode, vnode->
fid.unique, vnode->
status.data_version);
380 pagevec_init(&pvec, 0);
391 for (loop = 0; loop < nr_pages; loop++)
394 first = pvec.pages[nr_pages - 1]->index + 1;
397 pagevec_release(&pvec);