Blame view
fs/nfs/fscache.c
14.1 KB
b4d0d230c treewide: Replace... |
1 |
// SPDX-License-Identifier: GPL-2.0-or-later |
147272813 NFS: Define and c... |
2 3 4 5 |
/* NFS filesystem cache interface * * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) |
147272813 NFS: Define and c... |
6 7 8 9 10 11 12 13 14 15 |
*/ #include <linux/init.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/mm.h> #include <linux/nfs_fs.h> #include <linux/nfs_fs_sb.h> #include <linux/in6.h> #include <linux/seq_file.h> |
5a0e3ad6a include cleanup: ... |
16 |
#include <linux/slab.h> |
402cb8dda fscache: Attach t... |
17 |
#include <linux/iversion.h> |
147272813 NFS: Define and c... |
18 19 |
#include "internal.h" |
545db45f0 NFS: FS-Cache pag... |
20 |
#include "iostat.h" |
147272813 NFS: Define and c... |
21 22 23 |
#include "fscache.h" #define NFSDBG_FACILITY NFSDBG_FSCACHE |
08734048b NFS: Define and c... |
24 25 |
static struct rb_root nfs_fscache_keys = RB_ROOT; static DEFINE_SPINLOCK(nfs_fscache_keys_lock); |
147272813 NFS: Define and c... |
26 |
/* |
402cb8dda fscache: Attach t... |
27 28 29 30 31 |
* Layout of the key for an NFS server cache object. */ struct nfs_server_key { struct { uint16_t nfsversion; /* NFS protocol version */ |
55dee1bc0 nfs: add minor ve... |
32 |
uint32_t minorversion; /* NFSv4 minor version */ |
402cb8dda fscache: Attach t... |
33 34 35 36 37 38 39 40 41 42 |
uint16_t family; /* address family */ __be16 port; /* IP port */ } hdr; union { struct in_addr ipv4_addr; /* IPv4 address */ struct in6_addr ipv6_addr; /* IPv6 address */ }; } __packed; /* |
147272813 NFS: Define and c... |
43 44 45 46 47 48 49 |
* Get the per-client index cookie for an NFS client if the appropriate mount * flag was set * - We always try and get an index cookie for the client, but get filehandle * cookies on a per-superblock basis, depending on the mount flags */ void nfs_fscache_get_client_cookie(struct nfs_client *clp) { |
402cb8dda fscache: Attach t... |
50 51 52 53 54 55 56 |
const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) &clp->cl_addr; const struct sockaddr_in *sin = (struct sockaddr_in *) &clp->cl_addr; struct nfs_server_key key; uint16_t len = sizeof(key.hdr); memset(&key, 0, sizeof(key)); key.hdr.nfsversion = clp->rpc_ops->version; |
55dee1bc0 nfs: add minor ve... |
57 |
key.hdr.minorversion = clp->cl_minorversion; |
402cb8dda fscache: Attach t... |
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
key.hdr.family = clp->cl_addr.ss_family; switch (clp->cl_addr.ss_family) { case AF_INET: key.hdr.port = sin->sin_port; key.ipv4_addr = sin->sin_addr; len += sizeof(key.ipv4_addr); break; case AF_INET6: key.hdr.port = sin6->sin6_port; key.ipv6_addr = sin6->sin6_addr; len += sizeof(key.ipv6_addr); break; default: printk(KERN_WARNING "NFS: Unknown network family '%d' ", clp->cl_addr.ss_family); clp->fscache = NULL; return; } |
147272813 NFS: Define and c... |
80 81 82 |
/* create a cache index for looking up filehandles */ clp->fscache = fscache_acquire_cookie(nfs_fscache_netfs.primary_index, &nfs_fscache_server_index_def, |
402cb8dda fscache: Attach t... |
83 84 |
&key, len, NULL, 0, |
ee1235a9a fscache: Pass obj... |
85 |
clp, 0, true); |
147272813 NFS: Define and c... |
86 87 88 89 90 91 92 93 94 95 96 97 98 |
dfprintk(FSCACHE, "NFS: get client cookie (0x%p/0x%p) ", clp, clp->fscache); } /* * Dispose of a per-client cookie */ void nfs_fscache_release_client_cookie(struct nfs_client *clp) { dfprintk(FSCACHE, "NFS: releasing client cookie (0x%p/0x%p) ", clp, clp->fscache); |
402cb8dda fscache: Attach t... |
99 |
fscache_relinquish_cookie(clp->fscache, NULL, false); |
147272813 NFS: Define and c... |
100 101 |
clp->fscache = NULL; } |
08734048b NFS: Define and c... |
102 103 104 105 |
/* * Get the cache cookie for an NFS superblock. We have to handle * uniquification here because the cache doesn't do it for us. |
2df548063 NFS: Propagate 'f... |
106 107 108 109 |
* * The default uniquifier is just an empty string, but it may be overridden * either by the 'fsc=xxx' option to mount, or by inheriting it from the parent * superblock across an automount point of some nature. |
08734048b NFS: Define and c... |
110 |
*/ |
2311b9439 NFS: Don't pass m... |
111 |
void nfs_fscache_get_super_cookie(struct super_block *sb, const char *uniq, int ulen) |
08734048b NFS: Define and c... |
112 113 114 115 |
{ struct nfs_fscache_key *key, *xkey; struct nfs_server *nfss = NFS_SB(sb); struct rb_node **p, *parent; |
2311b9439 NFS: Don't pass m... |
116 |
int diff; |
2df548063 NFS: Propagate 'f... |
117 |
|
dea1bb35c NFS: Fix regressi... |
118 119 |
nfss->fscache_key = NULL; nfss->fscache = NULL; |
2df548063 NFS: Propagate 'f... |
120 121 122 123 |
if (!uniq) { uniq = ""; ulen = 1; } |
08734048b NFS: Define and c... |
124 125 126 127 128 |
key = kzalloc(sizeof(*key) + ulen, GFP_KERNEL); if (!key) return; key->nfs_client = nfss->nfs_client; |
62a55d088 NFS: Additional r... |
129 |
key->key.super.s_flags = sb->s_flags & NFS_SB_MASK; |
08734048b NFS: Define and c... |
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
key->key.nfs_server.flags = nfss->flags; key->key.nfs_server.rsize = nfss->rsize; key->key.nfs_server.wsize = nfss->wsize; key->key.nfs_server.acregmin = nfss->acregmin; key->key.nfs_server.acregmax = nfss->acregmax; key->key.nfs_server.acdirmin = nfss->acdirmin; key->key.nfs_server.acdirmax = nfss->acdirmax; key->key.nfs_server.fsid = nfss->fsid; key->key.rpc_auth.au_flavor = nfss->client->cl_auth->au_flavor; key->key.uniq_len = ulen; memcpy(key->key.uniquifier, uniq, ulen); spin_lock(&nfs_fscache_keys_lock); p = &nfs_fscache_keys.rb_node; parent = NULL; while (*p) { parent = *p; xkey = rb_entry(parent, struct nfs_fscache_key, node); if (key->nfs_client < xkey->nfs_client) goto go_left; if (key->nfs_client > xkey->nfs_client) goto go_right; diff = memcmp(&key->key, &xkey->key, sizeof(key->key)); if (diff < 0) goto go_left; if (diff > 0) goto go_right; if (key->key.uniq_len == 0) goto non_unique; diff = memcmp(key->key.uniquifier, xkey->key.uniquifier, key->key.uniq_len); if (diff < 0) goto go_left; if (diff > 0) goto go_right; goto non_unique; go_left: p = &(*p)->rb_left; continue; go_right: p = &(*p)->rb_right; } rb_link_node(&key->node, parent, p); rb_insert_color(&key->node, &nfs_fscache_keys); spin_unlock(&nfs_fscache_keys_lock); nfss->fscache_key = key; /* create a cache index for looking up filehandles */ nfss->fscache = fscache_acquire_cookie(nfss->nfs_client->fscache, &nfs_fscache_super_index_def, |
d9bfced1f NFS: Fix fscache ... |
187 188 |
&key->key, sizeof(key->key) + ulen, |
402cb8dda fscache: Attach t... |
189 |
NULL, 0, |
ee1235a9a fscache: Pass obj... |
190 |
nfss, 0, true); |
08734048b NFS: Define and c... |
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
dfprintk(FSCACHE, "NFS: get superblock cookie (0x%p/0x%p) ", nfss, nfss->fscache); return; non_unique: spin_unlock(&nfs_fscache_keys_lock); kfree(key); nfss->fscache_key = NULL; nfss->fscache = NULL; printk(KERN_WARNING "NFS:" " Cache request denied due to non-unique superblock keys "); } /* * release a per-superblock cookie */ void nfs_fscache_release_super_cookie(struct super_block *sb) { struct nfs_server *nfss = NFS_SB(sb); dfprintk(FSCACHE, "NFS: releasing superblock cookie (0x%p/0x%p) ", nfss, nfss->fscache); |
402cb8dda fscache: Attach t... |
216 |
fscache_relinquish_cookie(nfss->fscache, NULL, false); |
08734048b NFS: Define and c... |
217 218 219 220 221 222 223 224 225 226 |
nfss->fscache = NULL; if (nfss->fscache_key) { spin_lock(&nfs_fscache_keys_lock); rb_erase(&nfss->fscache_key->node, &nfs_fscache_keys); spin_unlock(&nfs_fscache_keys_lock); kfree(nfss->fscache_key); nfss->fscache_key = NULL; } } |
ef79c097b NFS: Use local di... |
227 |
|
50eaa652b NFSv4: Fix fscach... |
228 229 230 231 232 233 234 235 236 237 238 239 |
static void nfs_fscache_update_auxdata(struct nfs_fscache_inode_auxdata *auxdata, struct nfs_inode *nfsi) { memset(auxdata, 0, sizeof(*auxdata)); auxdata->mtime_sec = nfsi->vfs_inode.i_mtime.tv_sec; auxdata->mtime_nsec = nfsi->vfs_inode.i_mtime.tv_nsec; auxdata->ctime_sec = nfsi->vfs_inode.i_ctime.tv_sec; auxdata->ctime_nsec = nfsi->vfs_inode.i_ctime.tv_nsec; if (NFS_SERVER(&nfsi->vfs_inode)->nfs_client->rpc_ops->version == 4) auxdata->change_attr = inode_peek_iversion_raw(&nfsi->vfs_inode); } |
ef79c097b NFS: Use local di... |
240 241 242 |
/* * Initialise the per-inode cache cookie pointer for an NFS inode. */ |
f1fe29b4a NFS: Use i_writec... |
243 |
void nfs_fscache_init_inode(struct inode *inode) |
ef79c097b NFS: Use local di... |
244 |
{ |
402cb8dda fscache: Attach t... |
245 |
struct nfs_fscache_inode_auxdata auxdata; |
dea1bb35c NFS: Fix regressi... |
246 |
struct nfs_server *nfss = NFS_SERVER(inode); |
ef79c097b NFS: Use local di... |
247 |
struct nfs_inode *nfsi = NFS_I(inode); |
f1fe29b4a NFS: Use i_writec... |
248 |
nfsi->fscache = NULL; |
dea1bb35c NFS: Fix regressi... |
249 |
if (!(nfss->fscache && S_ISREG(inode->i_mode))) |
ef79c097b NFS: Use local di... |
250 |
return; |
402cb8dda fscache: Attach t... |
251 |
|
50eaa652b NFSv4: Fix fscach... |
252 |
nfs_fscache_update_auxdata(&auxdata, nfsi); |
402cb8dda fscache: Attach t... |
253 |
|
f1fe29b4a NFS: Use i_writec... |
254 255 |
nfsi->fscache = fscache_acquire_cookie(NFS_SB(inode->i_sb)->fscache, &nfs_fscache_inode_object_def, |
402cb8dda fscache: Attach t... |
256 257 |
nfsi->fh.data, nfsi->fh.size, &auxdata, sizeof(auxdata), |
ee1235a9a fscache: Pass obj... |
258 |
nfsi, nfsi->vfs_inode.i_size, false); |
ef79c097b NFS: Use local di... |
259 260 261 262 263 |
} /* * Release a per-inode cookie. */ |
f1fe29b4a NFS: Use i_writec... |
264 |
void nfs_fscache_clear_inode(struct inode *inode) |
ef79c097b NFS: Use local di... |
265 |
{ |
402cb8dda fscache: Attach t... |
266 |
struct nfs_fscache_inode_auxdata auxdata; |
ef79c097b NFS: Use local di... |
267 |
struct nfs_inode *nfsi = NFS_I(inode); |
f1fe29b4a NFS: Use i_writec... |
268 |
struct fscache_cookie *cookie = nfs_i_fscache(inode); |
ef79c097b NFS: Use local di... |
269 |
|
f1fe29b4a NFS: Use i_writec... |
270 271 |
dfprintk(FSCACHE, "NFS: clear cookie (0x%p/0x%p) ", nfsi, cookie); |
ef79c097b NFS: Use local di... |
272 |
|
50eaa652b NFSv4: Fix fscach... |
273 |
nfs_fscache_update_auxdata(&auxdata, nfsi); |
402cb8dda fscache: Attach t... |
274 |
fscache_relinquish_cookie(cookie, &auxdata, false); |
ef79c097b NFS: Use local di... |
275 276 |
nfsi->fscache = NULL; } |
f1fe29b4a NFS: Use i_writec... |
277 |
static bool nfs_fscache_can_enable(void *data) |
ef79c097b NFS: Use local di... |
278 |
{ |
f1fe29b4a NFS: Use i_writec... |
279 |
struct inode *inode = data; |
ef79c097b NFS: Use local di... |
280 |
|
f1fe29b4a NFS: Use i_writec... |
281 |
return !inode_is_open_for_write(inode); |
ef79c097b NFS: Use local di... |
282 283 284 |
} /* |
f1fe29b4a NFS: Use i_writec... |
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
* Enable or disable caching for a file that is being opened as appropriate. * The cookie is allocated when the inode is initialised, but is not enabled at * that time. Enablement is deferred to file-open time to avoid stat() and * access() thrashing the cache. * * For now, with NFS, only regular files that are open read-only will be able * to use the cache. * * We enable the cache for an inode if we open it read-only and it isn't * currently open for writing. We disable the cache if the inode is open * write-only. * * The caller uses the file struct to pin i_writecount on the inode before * calling us when a file is opened for writing, so we can make use of that. * * Note that this may be invoked multiple times in parallel by parallel * nfs_open() functions. |
ef79c097b NFS: Use local di... |
302 |
*/ |
f1fe29b4a NFS: Use i_writec... |
303 |
void nfs_fscache_open_file(struct inode *inode, struct file *filp) |
ef79c097b NFS: Use local di... |
304 |
{ |
402cb8dda fscache: Attach t... |
305 |
struct nfs_fscache_inode_auxdata auxdata; |
ef79c097b NFS: Use local di... |
306 |
struct nfs_inode *nfsi = NFS_I(inode); |
f1fe29b4a NFS: Use i_writec... |
307 |
struct fscache_cookie *cookie = nfs_i_fscache(inode); |
ef79c097b NFS: Use local di... |
308 |
|
f1fe29b4a NFS: Use i_writec... |
309 310 |
if (!fscache_cookie_valid(cookie)) return; |
ef79c097b NFS: Use local di... |
311 |
|
50eaa652b NFSv4: Fix fscach... |
312 |
nfs_fscache_update_auxdata(&auxdata, nfsi); |
402cb8dda fscache: Attach t... |
313 |
|
f1fe29b4a NFS: Use i_writec... |
314 315 316 317 |
if (inode_is_open_for_write(inode)) { dfprintk(FSCACHE, "NFS: nfsi 0x%p disabling cache ", nfsi); clear_bit(NFS_INO_FSCACHE, &nfsi->flags); |
402cb8dda fscache: Attach t... |
318 |
fscache_disable_cookie(cookie, &auxdata, true); |
f1fe29b4a NFS: Use i_writec... |
319 320 321 322 |
fscache_uncache_all_inode_pages(cookie, inode); } else { dfprintk(FSCACHE, "NFS: nfsi 0x%p enabling cache ", nfsi); |
ee1235a9a fscache: Pass obj... |
323 |
fscache_enable_cookie(cookie, &auxdata, nfsi->vfs_inode.i_size, |
402cb8dda fscache: Attach t... |
324 |
nfs_fscache_can_enable, inode); |
f1fe29b4a NFS: Use i_writec... |
325 326 |
if (fscache_cookie_enabled(cookie)) set_bit(NFS_INO_FSCACHE, &NFS_I(inode)->flags); |
ef79c097b NFS: Use local di... |
327 |
} |
ef79c097b NFS: Use local di... |
328 |
} |
f1fe29b4a NFS: Use i_writec... |
329 |
EXPORT_SYMBOL_GPL(nfs_fscache_open_file); |
545db45f0 NFS: FS-Cache pag... |
330 331 332 333 334 335 336 337 |
/* * Release the caching state associated with a page, if the page isn't busy * interacting with the cache. * - Returns true (can release page) or false (page busy). */ int nfs_fscache_release_page(struct page *page, gfp_t gfp) { |
545db45f0 NFS: FS-Cache pag... |
338 |
if (PageFsCache(page)) { |
f1fe29b4a NFS: Use i_writec... |
339 |
struct fscache_cookie *cookie = nfs_i_fscache(page->mapping->host); |
2c1740098 NFS: Fix a bug in... |
340 341 |
BUG_ON(!cookie); |
545db45f0 NFS: FS-Cache pag... |
342 343 |
dfprintk(FSCACHE, "NFS: fscache releasepage (0x%p/0x%p/0x%p) ", |
f1fe29b4a NFS: Use i_writec... |
344 |
cookie, page, NFS_I(page->mapping->host)); |
545db45f0 NFS: FS-Cache pag... |
345 |
|
201a15428 FS-Cache: Handle ... |
346 347 |
if (!fscache_maybe_release_page(cookie, page, gfp)) return 0; |
e9f456ca5 nfs: define nfs_i... |
348 349 |
nfs_inc_fscache_stats(page->mapping->host, NFSIOS_FSCACHE_PAGES_UNCACHED); |
545db45f0 NFS: FS-Cache pag... |
350 351 352 353 354 355 356 357 358 359 360 |
} return 1; } /* * Release the caching state associated with a page if undergoing complete page * invalidation. */ void __nfs_fscache_invalidate_page(struct page *page, struct inode *inode) { |
f1fe29b4a NFS: Use i_writec... |
361 |
struct fscache_cookie *cookie = nfs_i_fscache(inode); |
545db45f0 NFS: FS-Cache pag... |
362 363 364 365 366 |
BUG_ON(!cookie); dfprintk(FSCACHE, "NFS: fscache invalidatepage (0x%p/0x%p/0x%p) ", |
f1fe29b4a NFS: Use i_writec... |
367 |
cookie, page, NFS_I(inode)); |
545db45f0 NFS: FS-Cache pag... |
368 369 370 371 372 |
fscache_wait_on_page_write(cookie, page); BUG_ON(!PageLocked(page)); fscache_uncache_page(cookie, page); |
e9f456ca5 nfs: define nfs_i... |
373 374 |
nfs_inc_fscache_stats(page->mapping->host, NFSIOS_FSCACHE_PAGES_UNCACHED); |
545db45f0 NFS: FS-Cache pag... |
375 |
} |
9a9fc1c03 NFS: Read pages f... |
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
/* * Handle completion of a page being read from the cache. * - Called in process (keventd) context. */ static void nfs_readpage_from_fscache_complete(struct page *page, void *context, int error) { dfprintk(FSCACHE, "NFS: readpage_from_fscache_complete (0x%p/0x%p/%d) ", page, context, error); /* if the read completes with an error, we just unlock the page and let * the VM reissue the readpage */ if (!error) { SetPageUptodate(page); unlock_page(page); } else { error = nfs_readpage_async(context, page->mapping->host, page); if (error) unlock_page(page); } } /* * Retrieve a page from fscache */ int __nfs_readpage_from_fscache(struct nfs_open_context *ctx, struct inode *inode, struct page *page) { int ret; dfprintk(FSCACHE, "NFS: readpage_from_fscache(fsc:%p/p:%p(i:%lx f:%lx)/0x%p) ", |
f1fe29b4a NFS: Use i_writec... |
413 |
nfs_i_fscache(inode), page, page->index, page->flags, inode); |
9a9fc1c03 NFS: Read pages f... |
414 |
|
f1fe29b4a NFS: Use i_writec... |
415 |
ret = fscache_read_or_alloc_page(nfs_i_fscache(inode), |
9a9fc1c03 NFS: Read pages f... |
416 417 418 419 420 421 422 423 424 425 |
page, nfs_readpage_from_fscache_complete, ctx, GFP_KERNEL); switch (ret) { case 0: /* read BIO submitted (page in fscache) */ dfprintk(FSCACHE, "NFS: readpage_from_fscache: BIO submitted "); |
e9f456ca5 nfs: define nfs_i... |
426 |
nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_OK); |
9a9fc1c03 NFS: Read pages f... |
427 428 429 430 |
return ret; case -ENOBUFS: /* inode not in cache */ case -ENODATA: /* page not in cache */ |
e9f456ca5 nfs: define nfs_i... |
431 |
nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_FAIL); |
9a9fc1c03 NFS: Read pages f... |
432 433 434 435 436 437 438 439 |
dfprintk(FSCACHE, "NFS: readpage_from_fscache %d ", ret); return 1; default: dfprintk(FSCACHE, "NFS: readpage_from_fscache %d ", ret); |
e9f456ca5 nfs: define nfs_i... |
440 |
nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_FAIL); |
9a9fc1c03 NFS: Read pages f... |
441 442 443 444 445 446 447 448 449 450 451 452 453 |
} return ret; } /* * Retrieve a set of pages from fscache */ int __nfs_readpages_from_fscache(struct nfs_open_context *ctx, struct inode *inode, struct address_space *mapping, struct list_head *pages, unsigned *nr_pages) { |
0f15c53d5 NFS: Squelch comp... |
454 455 |
unsigned npages = *nr_pages; int ret; |
9a9fc1c03 NFS: Read pages f... |
456 457 458 |
dfprintk(FSCACHE, "NFS: nfs_getpages_from_fscache (0x%p/%u/0x%p) ", |
f1fe29b4a NFS: Use i_writec... |
459 |
nfs_i_fscache(inode), npages, inode); |
9a9fc1c03 NFS: Read pages f... |
460 |
|
f1fe29b4a NFS: Use i_writec... |
461 |
ret = fscache_read_or_alloc_pages(nfs_i_fscache(inode), |
9a9fc1c03 NFS: Read pages f... |
462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 |
mapping, pages, nr_pages, nfs_readpage_from_fscache_complete, ctx, mapping_gfp_mask(mapping)); if (*nr_pages < npages) nfs_add_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_OK, npages); if (*nr_pages > 0) nfs_add_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_FAIL, *nr_pages); switch (ret) { case 0: /* read submitted to the cache for all pages */ BUG_ON(!list_empty(pages)); BUG_ON(*nr_pages != 0); dfprintk(FSCACHE, "NFS: nfs_getpages_from_fscache: submitted "); return ret; case -ENOBUFS: /* some pages aren't cached and can't be */ case -ENODATA: /* some pages aren't cached */ dfprintk(FSCACHE, "NFS: nfs_getpages_from_fscache: no page: %d ", ret); return 1; default: dfprintk(FSCACHE, "NFS: nfs_getpages_from_fscache: ret %d ", ret); } return ret; } |
7f8e05f60 NFS: Store pages ... |
498 499 500 501 502 503 504 505 506 507 508 509 |
/* * Store a newly fetched page in fscache * - PG_fscache must be set on the page */ void __nfs_readpage_to_fscache(struct inode *inode, struct page *page, int sync) { int ret; dfprintk(FSCACHE, "NFS: readpage_to_fscache(fsc:%p/p:%p(i:%lx f:%lx)/%d) ", |
f1fe29b4a NFS: Use i_writec... |
510 |
nfs_i_fscache(inode), page, page->index, page->flags, sync); |
7f8e05f60 NFS: Store pages ... |
511 |
|
ee1235a9a fscache: Pass obj... |
512 513 |
ret = fscache_write_page(nfs_i_fscache(inode), page, inode->i_size, GFP_KERNEL); |
7f8e05f60 NFS: Store pages ... |
514 515 516 517 518 519 |
dfprintk(FSCACHE, "NFS: readpage_to_fscache: p:%p(i:%lu f:%lx) ret %d ", page, page->index, page->flags, ret); if (ret != 0) { |
f1fe29b4a NFS: Use i_writec... |
520 |
fscache_uncache_page(nfs_i_fscache(inode), page); |
e9f456ca5 nfs: define nfs_i... |
521 522 523 |
nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_WRITTEN_FAIL); nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_UNCACHED); |
7f8e05f60 NFS: Store pages ... |
524 |
} else { |
e9f456ca5 nfs: define nfs_i... |
525 526 |
nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_WRITTEN_OK); |
7f8e05f60 NFS: Store pages ... |
527 528 |
} } |