diff options
| author | David Howells <dhowells@redhat.com> | 2018-04-04 08:41:28 -0400 |
|---|---|---|
| committer | David Howells <dhowells@redhat.com> | 2018-04-06 09:05:14 -0400 |
| commit | ee1235a9a06813429c201bf186397a6feeea07bf (patch) | |
| tree | 444566605bfafce0b155a76e061a73c264329424 /fs | |
| parent | 402cb8dda949d9b8c0df20ad2527d139faad7ca1 (diff) | |
fscache: Pass object size in rather than calling back for it
Pass the object size in to fscache_acquire_cookie() and
fscache_write_page() rather than the netfs providing a callback by which it
can be received. This makes it easier to update the size of the object
when a new page is written that extends the object.
The current object size is also passed by fscache to the check_aux
function, obviating the need to store it in the aux data.
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 'fs')
| -rw-r--r-- | fs/9p/cache.c | 27 | ||||
| -rw-r--r-- | fs/afs/cache.c | 24 | ||||
| -rw-r--r-- | fs/afs/cell.c | 2 | ||||
| -rw-r--r-- | fs/afs/file.c | 6 | ||||
| -rw-r--r-- | fs/afs/inode.c | 2 | ||||
| -rw-r--r-- | fs/afs/volume.c | 2 | ||||
| -rw-r--r-- | fs/cachefiles/interface.c | 5 | ||||
| -rw-r--r-- | fs/cachefiles/xattr.c | 6 | ||||
| -rw-r--r-- | fs/ceph/cache.c | 26 | ||||
| -rw-r--r-- | fs/cifs/cache.c | 15 | ||||
| -rw-r--r-- | fs/cifs/fscache.c | 14 | ||||
| -rw-r--r-- | fs/fscache/cookie.c | 18 | ||||
| -rw-r--r-- | fs/fscache/fsdef.c | 6 | ||||
| -rw-r--r-- | fs/fscache/object.c | 5 | ||||
| -rw-r--r-- | fs/fscache/page.c | 5 | ||||
| -rw-r--r-- | fs/nfs/fscache-index.c | 19 | ||||
| -rw-r--r-- | fs/nfs/fscache.c | 14 | ||||
| -rw-r--r-- | fs/nfs/fscache.h | 1 |
18 files changed, 78 insertions, 119 deletions
diff --git a/fs/9p/cache.c b/fs/9p/cache.c index 9d0030af5672..9eb34701a566 100644 --- a/fs/9p/cache.c +++ b/fs/9p/cache.c | |||
| @@ -75,7 +75,7 @@ void v9fs_cache_session_get_cookie(struct v9fs_session_info *v9ses) | |||
| 75 | v9ses->cachetag, | 75 | v9ses->cachetag, |
| 76 | strlen(v9ses->cachetag), | 76 | strlen(v9ses->cachetag), |
| 77 | NULL, 0, | 77 | NULL, 0, |
| 78 | v9ses, true); | 78 | v9ses, 0, true); |
| 79 | p9_debug(P9_DEBUG_FSC, "session %p get cookie %p\n", | 79 | p9_debug(P9_DEBUG_FSC, "session %p get cookie %p\n", |
| 80 | v9ses, v9ses->fscache); | 80 | v9ses, v9ses->fscache); |
| 81 | } | 81 | } |
| @@ -88,20 +88,11 @@ void v9fs_cache_session_put_cookie(struct v9fs_session_info *v9ses) | |||
| 88 | v9ses->fscache = NULL; | 88 | v9ses->fscache = NULL; |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | static void v9fs_cache_inode_get_attr(const void *cookie_netfs_data, | ||
| 92 | uint64_t *size) | ||
| 93 | { | ||
| 94 | const struct v9fs_inode *v9inode = cookie_netfs_data; | ||
| 95 | *size = i_size_read(&v9inode->vfs_inode); | ||
| 96 | |||
| 97 | p9_debug(P9_DEBUG_FSC, "inode %p get attr %llu\n", | ||
| 98 | &v9inode->vfs_inode, *size); | ||
| 99 | } | ||
| 100 | |||
| 101 | static enum | 91 | static enum |
| 102 | fscache_checkaux v9fs_cache_inode_check_aux(void *cookie_netfs_data, | 92 | fscache_checkaux v9fs_cache_inode_check_aux(void *cookie_netfs_data, |
| 103 | const void *buffer, | 93 | const void *buffer, |
| 104 | uint16_t buflen) | 94 | uint16_t buflen, |
| 95 | loff_t object_size) | ||
| 105 | { | 96 | { |
| 106 | const struct v9fs_inode *v9inode = cookie_netfs_data; | 97 | const struct v9fs_inode *v9inode = cookie_netfs_data; |
| 107 | 98 | ||
| @@ -118,7 +109,6 @@ fscache_checkaux v9fs_cache_inode_check_aux(void *cookie_netfs_data, | |||
| 118 | const struct fscache_cookie_def v9fs_cache_inode_index_def = { | 109 | const struct fscache_cookie_def v9fs_cache_inode_index_def = { |
| 119 | .name = "9p.inode", | 110 | .name = "9p.inode", |
| 120 | .type = FSCACHE_COOKIE_TYPE_DATAFILE, | 111 | .type = FSCACHE_COOKIE_TYPE_DATAFILE, |
| 121 | .get_attr = v9fs_cache_inode_get_attr, | ||
| 122 | .check_aux = v9fs_cache_inode_check_aux, | 112 | .check_aux = v9fs_cache_inode_check_aux, |
| 123 | }; | 113 | }; |
| 124 | 114 | ||
| @@ -141,7 +131,9 @@ void v9fs_cache_inode_get_cookie(struct inode *inode) | |||
| 141 | sizeof(v9inode->qid.path), | 131 | sizeof(v9inode->qid.path), |
| 142 | &v9inode->qid.version, | 132 | &v9inode->qid.version, |
| 143 | sizeof(v9inode->qid.version), | 133 | sizeof(v9inode->qid.version), |
| 144 | v9inode, true); | 134 | v9inode, |
| 135 | i_size_read(&v9inode->vfs_inode), | ||
| 136 | true); | ||
| 145 | 137 | ||
| 146 | p9_debug(P9_DEBUG_FSC, "inode %p get cookie %p\n", | 138 | p9_debug(P9_DEBUG_FSC, "inode %p get cookie %p\n", |
| 147 | inode, v9inode->fscache); | 139 | inode, v9inode->fscache); |
| @@ -212,7 +204,9 @@ void v9fs_cache_inode_reset_cookie(struct inode *inode) | |||
| 212 | sizeof(v9inode->qid.path), | 204 | sizeof(v9inode->qid.path), |
| 213 | &v9inode->qid.version, | 205 | &v9inode->qid.version, |
| 214 | sizeof(v9inode->qid.version), | 206 | sizeof(v9inode->qid.version), |
| 215 | v9inode, true); | 207 | v9inode, |
| 208 | i_size_read(&v9inode->vfs_inode), | ||
| 209 | true); | ||
| 216 | p9_debug(P9_DEBUG_FSC, "inode %p revalidating cookie old %p new %p\n", | 210 | p9_debug(P9_DEBUG_FSC, "inode %p revalidating cookie old %p new %p\n", |
| 217 | inode, old, v9inode->fscache); | 211 | inode, old, v9inode->fscache); |
| 218 | 212 | ||
| @@ -338,7 +332,8 @@ void __v9fs_readpage_to_fscache(struct inode *inode, struct page *page) | |||
| 338 | const struct v9fs_inode *v9inode = V9FS_I(inode); | 332 | const struct v9fs_inode *v9inode = V9FS_I(inode); |
| 339 | 333 | ||
| 340 | p9_debug(P9_DEBUG_FSC, "inode %p page %p\n", inode, page); | 334 | p9_debug(P9_DEBUG_FSC, "inode %p page %p\n", inode, page); |
| 341 | ret = fscache_write_page(v9inode->fscache, page, GFP_KERNEL); | 335 | ret = fscache_write_page(v9inode->fscache, page, |
| 336 | i_size_read(&v9inode->vfs_inode), GFP_KERNEL); | ||
| 342 | p9_debug(P9_DEBUG_FSC, "ret = %d\n", ret); | 337 | p9_debug(P9_DEBUG_FSC, "ret = %d\n", ret); |
| 343 | if (ret != 0) | 338 | if (ret != 0) |
| 344 | v9fs_uncache_page(inode, page); | 339 | v9fs_uncache_page(inode, page); |
diff --git a/fs/afs/cache.c b/fs/afs/cache.c index a16f1e024cf3..b1c31ec4523a 100644 --- a/fs/afs/cache.c +++ b/fs/afs/cache.c | |||
| @@ -12,11 +12,10 @@ | |||
| 12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
| 13 | #include "internal.h" | 13 | #include "internal.h" |
| 14 | 14 | ||
| 15 | static void afs_vnode_cache_get_attr(const void *cookie_netfs_data, | ||
| 16 | uint64_t *size); | ||
| 17 | static enum fscache_checkaux afs_vnode_cache_check_aux(void *cookie_netfs_data, | 15 | static enum fscache_checkaux afs_vnode_cache_check_aux(void *cookie_netfs_data, |
| 18 | const void *buffer, | 16 | const void *buffer, |
| 19 | uint16_t buflen); | 17 | uint16_t buflen, |
| 18 | loff_t object_size); | ||
| 20 | 19 | ||
| 21 | struct fscache_netfs afs_cache_netfs = { | 20 | struct fscache_netfs afs_cache_netfs = { |
| 22 | .name = "afs", | 21 | .name = "afs", |
| @@ -36,31 +35,16 @@ struct fscache_cookie_def afs_volume_cache_index_def = { | |||
| 36 | struct fscache_cookie_def afs_vnode_cache_index_def = { | 35 | struct fscache_cookie_def afs_vnode_cache_index_def = { |
| 37 | .name = "AFS.vnode", | 36 | .name = "AFS.vnode", |
| 38 | .type = FSCACHE_COOKIE_TYPE_DATAFILE, | 37 | .type = FSCACHE_COOKIE_TYPE_DATAFILE, |
| 39 | .get_attr = afs_vnode_cache_get_attr, | ||
| 40 | .check_aux = afs_vnode_cache_check_aux, | 38 | .check_aux = afs_vnode_cache_check_aux, |
| 41 | }; | 39 | }; |
| 42 | 40 | ||
| 43 | /* | 41 | /* |
| 44 | * provide updated file attributes | ||
| 45 | */ | ||
| 46 | static void afs_vnode_cache_get_attr(const void *cookie_netfs_data, | ||
| 47 | uint64_t *size) | ||
| 48 | { | ||
| 49 | const struct afs_vnode *vnode = cookie_netfs_data; | ||
| 50 | |||
| 51 | _enter("{%x,%x,%llx},", | ||
| 52 | vnode->fid.vnode, vnode->fid.unique, | ||
| 53 | vnode->status.data_version); | ||
| 54 | |||
| 55 | *size = vnode->status.size; | ||
| 56 | } | ||
| 57 | |||
| 58 | /* | ||
| 59 | * check that the auxiliary data indicates that the entry is still valid | 42 | * check that the auxiliary data indicates that the entry is still valid |
| 60 | */ | 43 | */ |
| 61 | static enum fscache_checkaux afs_vnode_cache_check_aux(void *cookie_netfs_data, | 44 | static enum fscache_checkaux afs_vnode_cache_check_aux(void *cookie_netfs_data, |
| 62 | const void *buffer, | 45 | const void *buffer, |
| 63 | uint16_t buflen) | 46 | uint16_t buflen, |
| 47 | loff_t object_size) | ||
| 64 | { | 48 | { |
| 65 | struct afs_vnode *vnode = cookie_netfs_data; | 49 | struct afs_vnode *vnode = cookie_netfs_data; |
| 66 | struct afs_vnode_cache_aux aux; | 50 | struct afs_vnode_cache_aux aux; |
diff --git a/fs/afs/cell.c b/fs/afs/cell.c index 0747460221cb..4235a05afc76 100644 --- a/fs/afs/cell.c +++ b/fs/afs/cell.c | |||
| @@ -524,7 +524,7 @@ static int afs_activate_cell(struct afs_net *net, struct afs_cell *cell) | |||
| 524 | &afs_cell_cache_index_def, | 524 | &afs_cell_cache_index_def, |
| 525 | cell->name, strlen(cell->name), | 525 | cell->name, strlen(cell->name), |
| 526 | NULL, 0, | 526 | NULL, 0, |
| 527 | cell, true); | 527 | cell, 0, true); |
| 528 | #endif | 528 | #endif |
| 529 | ret = afs_proc_cell_setup(net, cell); | 529 | ret = afs_proc_cell_setup(net, cell); |
| 530 | if (ret < 0) | 530 | if (ret < 0) |
diff --git a/fs/afs/file.c b/fs/afs/file.c index a39192ced99e..79e665a35fea 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c | |||
| @@ -339,7 +339,8 @@ int afs_page_filler(void *data, struct page *page) | |||
| 339 | /* send the page to the cache */ | 339 | /* send the page to the cache */ |
| 340 | #ifdef CONFIG_AFS_FSCACHE | 340 | #ifdef CONFIG_AFS_FSCACHE |
| 341 | if (PageFsCache(page) && | 341 | if (PageFsCache(page) && |
| 342 | fscache_write_page(vnode->cache, page, GFP_KERNEL) != 0) { | 342 | fscache_write_page(vnode->cache, page, vnode->status.size, |
| 343 | GFP_KERNEL) != 0) { | ||
| 343 | fscache_uncache_page(vnode->cache, page); | 344 | fscache_uncache_page(vnode->cache, page); |
| 344 | BUG_ON(PageFsCache(page)); | 345 | BUG_ON(PageFsCache(page)); |
| 345 | } | 346 | } |
| @@ -403,7 +404,8 @@ static void afs_readpages_page_done(struct afs_call *call, struct afs_read *req) | |||
| 403 | /* send the page to the cache */ | 404 | /* send the page to the cache */ |
| 404 | #ifdef CONFIG_AFS_FSCACHE | 405 | #ifdef CONFIG_AFS_FSCACHE |
| 405 | if (PageFsCache(page) && | 406 | if (PageFsCache(page) && |
| 406 | fscache_write_page(vnode->cache, page, GFP_KERNEL) != 0) { | 407 | fscache_write_page(vnode->cache, page, vnode->status.size, |
| 408 | GFP_KERNEL) != 0) { | ||
| 407 | fscache_uncache_page(vnode->cache, page); | 409 | fscache_uncache_page(vnode->cache, page); |
| 408 | BUG_ON(PageFsCache(page)); | 410 | BUG_ON(PageFsCache(page)); |
| 409 | } | 411 | } |
diff --git a/fs/afs/inode.c b/fs/afs/inode.c index e499713efd2e..65c5b1edd338 100644 --- a/fs/afs/inode.c +++ b/fs/afs/inode.c | |||
| @@ -265,7 +265,7 @@ static void afs_get_inode_cache(struct afs_vnode *vnode) | |||
| 265 | &afs_vnode_cache_index_def, | 265 | &afs_vnode_cache_index_def, |
| 266 | &key, sizeof(key), | 266 | &key, sizeof(key), |
| 267 | &aux, sizeof(aux), | 267 | &aux, sizeof(aux), |
| 268 | vnode, true); | 268 | vnode, vnode->status.size, true); |
| 269 | #endif | 269 | #endif |
| 270 | } | 270 | } |
| 271 | 271 | ||
diff --git a/fs/afs/volume.c b/fs/afs/volume.c index 345cb2d675d2..3037bd01f617 100644 --- a/fs/afs/volume.c +++ b/fs/afs/volume.c | |||
| @@ -227,7 +227,7 @@ void afs_activate_volume(struct afs_volume *volume) | |||
| 227 | &afs_volume_cache_index_def, | 227 | &afs_volume_cache_index_def, |
| 228 | &volume->vid, sizeof(volume->vid), | 228 | &volume->vid, sizeof(volume->vid), |
| 229 | NULL, 0, | 229 | NULL, 0, |
| 230 | volume, true); | 230 | volume, 0, true); |
| 231 | #endif | 231 | #endif |
| 232 | 232 | ||
| 233 | write_lock(&volume->cell->proc_lock); | 233 | write_lock(&volume->cell->proc_lock); |
diff --git a/fs/cachefiles/interface.c b/fs/cachefiles/interface.c index 3264dcfdc92a..222bc5d8b62c 100644 --- a/fs/cachefiles/interface.c +++ b/fs/cachefiles/interface.c | |||
| @@ -441,7 +441,7 @@ static int cachefiles_attr_changed(struct fscache_object *_object) | |||
| 441 | loff_t oi_size; | 441 | loff_t oi_size; |
| 442 | int ret; | 442 | int ret; |
| 443 | 443 | ||
| 444 | _object->cookie->def->get_attr(_object->cookie->netfs_data, &ni_size); | 444 | ni_size = _object->store_limit_l; |
| 445 | 445 | ||
| 446 | _enter("{OBJ%x},[%llu]", | 446 | _enter("{OBJ%x},[%llu]", |
| 447 | _object->debug_id, (unsigned long long) ni_size); | 447 | _object->debug_id, (unsigned long long) ni_size); |
| @@ -513,8 +513,7 @@ static void cachefiles_invalidate_object(struct fscache_operation *op) | |||
| 513 | cache = container_of(object->fscache.cache, | 513 | cache = container_of(object->fscache.cache, |
| 514 | struct cachefiles_cache, cache); | 514 | struct cachefiles_cache, cache); |
| 515 | 515 | ||
| 516 | op->object->cookie->def->get_attr(op->object->cookie->netfs_data, | 516 | ni_size = op->object->store_limit_l; |
| 517 | &ni_size); | ||
| 518 | 517 | ||
| 519 | _enter("{OBJ%x},[%llu]", | 518 | _enter("{OBJ%x},[%llu]", |
| 520 | op->object->debug_id, (unsigned long long)ni_size); | 519 | op->object->debug_id, (unsigned long long)ni_size); |
diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c index d84423c264af..0a29a00aed2e 100644 --- a/fs/cachefiles/xattr.c +++ b/fs/cachefiles/xattr.c | |||
| @@ -182,7 +182,8 @@ int cachefiles_check_auxdata(struct cachefiles_object *object) | |||
| 182 | goto error; | 182 | goto error; |
| 183 | 183 | ||
| 184 | xlen--; | 184 | xlen--; |
| 185 | validity = fscache_check_aux(&object->fscache, &auxbuf->data, xlen); | 185 | validity = fscache_check_aux(&object->fscache, &auxbuf->data, xlen, |
| 186 | i_size_read(d_backing_inode(dentry))); | ||
| 186 | if (validity != FSCACHE_CHECKAUX_OKAY) | 187 | if (validity != FSCACHE_CHECKAUX_OKAY) |
| 187 | goto error; | 188 | goto error; |
| 188 | 189 | ||
| @@ -251,7 +252,8 @@ int cachefiles_check_object_xattr(struct cachefiles_object *object, | |||
| 251 | object->fscache.cookie->def->name, dlen); | 252 | object->fscache.cookie->def->name, dlen); |
| 252 | 253 | ||
| 253 | result = fscache_check_aux(&object->fscache, | 254 | result = fscache_check_aux(&object->fscache, |
| 254 | &auxbuf->data, dlen); | 255 | &auxbuf->data, dlen, |
| 256 | i_size_read(d_backing_inode(dentry))); | ||
| 255 | 257 | ||
| 256 | switch (result) { | 258 | switch (result) { |
| 257 | /* entry okay as is */ | 259 | /* entry okay as is */ |
diff --git a/fs/ceph/cache.c b/fs/ceph/cache.c index fee869061f05..33a211b364ed 100644 --- a/fs/ceph/cache.c +++ b/fs/ceph/cache.c | |||
| @@ -27,7 +27,6 @@ | |||
| 27 | struct ceph_aux_inode { | 27 | struct ceph_aux_inode { |
| 28 | u64 version; | 28 | u64 version; |
| 29 | struct timespec mtime; | 29 | struct timespec mtime; |
| 30 | loff_t size; | ||
| 31 | }; | 30 | }; |
| 32 | 31 | ||
| 33 | struct fscache_netfs ceph_cache_netfs = { | 32 | struct fscache_netfs ceph_cache_netfs = { |
| @@ -101,7 +100,7 @@ int ceph_fscache_register_fs(struct ceph_fs_client* fsc) | |||
| 101 | &ceph_fscache_fsid_object_def, | 100 | &ceph_fscache_fsid_object_def, |
| 102 | &ent->fsid, sizeof(ent->fsid) + uniq_len, | 101 | &ent->fsid, sizeof(ent->fsid) + uniq_len, |
| 103 | NULL, 0, | 102 | NULL, 0, |
| 104 | fsc, true); | 103 | fsc, 0, true); |
| 105 | 104 | ||
| 106 | if (fsc->fscache) { | 105 | if (fsc->fscache) { |
| 107 | ent->fscache = fsc->fscache; | 106 | ent->fscache = fsc->fscache; |
| @@ -117,27 +116,21 @@ out_unlock: | |||
| 117 | return err; | 116 | return err; |
| 118 | } | 117 | } |
| 119 | 118 | ||
| 120 | static void ceph_fscache_inode_get_attr(const void *cookie_netfs_data, | ||
| 121 | uint64_t *size) | ||
| 122 | { | ||
| 123 | const struct ceph_inode_info* ci = cookie_netfs_data; | ||
| 124 | *size = i_size_read(&ci->vfs_inode); | ||
| 125 | } | ||
| 126 | |||
| 127 | static enum fscache_checkaux ceph_fscache_inode_check_aux( | 119 | static enum fscache_checkaux ceph_fscache_inode_check_aux( |
| 128 | void *cookie_netfs_data, const void *data, uint16_t dlen) | 120 | void *cookie_netfs_data, const void *data, uint16_t dlen, |
| 121 | loff_t object_size) | ||
| 129 | { | 122 | { |
| 130 | struct ceph_aux_inode aux; | 123 | struct ceph_aux_inode aux; |
| 131 | struct ceph_inode_info* ci = cookie_netfs_data; | 124 | struct ceph_inode_info* ci = cookie_netfs_data; |
| 132 | struct inode* inode = &ci->vfs_inode; | 125 | struct inode* inode = &ci->vfs_inode; |
| 133 | 126 | ||
| 134 | if (dlen != sizeof(aux)) | 127 | if (dlen != sizeof(aux) || |
| 128 | i_size_read(inode) != object_size) | ||
| 135 | return FSCACHE_CHECKAUX_OBSOLETE; | 129 | return FSCACHE_CHECKAUX_OBSOLETE; |
| 136 | 130 | ||
| 137 | memset(&aux, 0, sizeof(aux)); | 131 | memset(&aux, 0, sizeof(aux)); |
| 138 | aux.version = ci->i_version; | 132 | aux.version = ci->i_version; |
| 139 | aux.mtime = inode->i_mtime; | 133 | aux.mtime = inode->i_mtime; |
| 140 | aux.size = i_size_read(inode); | ||
| 141 | 134 | ||
| 142 | if (memcmp(data, &aux, sizeof(aux)) != 0) | 135 | if (memcmp(data, &aux, sizeof(aux)) != 0) |
| 143 | return FSCACHE_CHECKAUX_OBSOLETE; | 136 | return FSCACHE_CHECKAUX_OBSOLETE; |
| @@ -149,7 +142,6 @@ static enum fscache_checkaux ceph_fscache_inode_check_aux( | |||
| 149 | static const struct fscache_cookie_def ceph_fscache_inode_object_def = { | 142 | static const struct fscache_cookie_def ceph_fscache_inode_object_def = { |
| 150 | .name = "CEPH.inode", | 143 | .name = "CEPH.inode", |
| 151 | .type = FSCACHE_COOKIE_TYPE_DATAFILE, | 144 | .type = FSCACHE_COOKIE_TYPE_DATAFILE, |
| 152 | .get_attr = ceph_fscache_inode_get_attr, | ||
| 153 | .check_aux = ceph_fscache_inode_check_aux, | 145 | .check_aux = ceph_fscache_inode_check_aux, |
| 154 | }; | 146 | }; |
| 155 | 147 | ||
| @@ -172,12 +164,11 @@ void ceph_fscache_register_inode_cookie(struct inode *inode) | |||
| 172 | memset(&aux, 0, sizeof(aux)); | 164 | memset(&aux, 0, sizeof(aux)); |
| 173 | aux.version = ci->i_version; | 165 | aux.version = ci->i_version; |
| 174 | aux.mtime = inode->i_mtime; | 166 | aux.mtime = inode->i_mtime; |
| 175 | aux.size = i_size_read(inode); | ||
| 176 | ci->fscache = fscache_acquire_cookie(fsc->fscache, | 167 | ci->fscache = fscache_acquire_cookie(fsc->fscache, |
| 177 | &ceph_fscache_inode_object_def, | 168 | &ceph_fscache_inode_object_def, |
| 178 | &ci->i_vino, sizeof(ci->i_vino), | 169 | &ci->i_vino, sizeof(ci->i_vino), |
| 179 | &aux, sizeof(aux), | 170 | &aux, sizeof(aux), |
| 180 | ci, false); | 171 | ci, i_size_read(inode), false); |
| 181 | } | 172 | } |
| 182 | inode_unlock(inode); | 173 | inode_unlock(inode); |
| 183 | } | 174 | } |
| @@ -214,7 +205,7 @@ void ceph_fscache_file_set_cookie(struct inode *inode, struct file *filp) | |||
| 214 | fscache_disable_cookie(ci->fscache, &ci->i_vino, false); | 205 | fscache_disable_cookie(ci->fscache, &ci->i_vino, false); |
| 215 | fscache_uncache_all_inode_pages(ci->fscache, inode); | 206 | fscache_uncache_all_inode_pages(ci->fscache, inode); |
| 216 | } else { | 207 | } else { |
| 217 | fscache_enable_cookie(ci->fscache, &ci->i_vino, | 208 | fscache_enable_cookie(ci->fscache, &ci->i_vino, i_size_read(inode), |
| 218 | ceph_fscache_can_enable, inode); | 209 | ceph_fscache_can_enable, inode); |
| 219 | if (fscache_cookie_enabled(ci->fscache)) { | 210 | if (fscache_cookie_enabled(ci->fscache)) { |
| 220 | dout("fscache_file_set_cookie %p %p enabling cache\n", | 211 | dout("fscache_file_set_cookie %p %p enabling cache\n", |
| @@ -308,7 +299,8 @@ void ceph_readpage_to_fscache(struct inode *inode, struct page *page) | |||
| 308 | if (!cache_valid(ci)) | 299 | if (!cache_valid(ci)) |
| 309 | return; | 300 | return; |
| 310 | 301 | ||
| 311 | ret = fscache_write_page(ci->fscache, page, GFP_KERNEL); | 302 | ret = fscache_write_page(ci->fscache, page, i_size_read(inode), |
| 303 | GFP_KERNEL); | ||
| 312 | if (ret) | 304 | if (ret) |
| 313 | fscache_uncache_page(ci->fscache, page); | 305 | fscache_uncache_page(ci->fscache, page); |
| 314 | } | 306 | } |
diff --git a/fs/cifs/cache.c b/fs/cifs/cache.c index b4fa270ef532..edf5f40898bf 100644 --- a/fs/cifs/cache.c +++ b/fs/cifs/cache.c | |||
| @@ -87,7 +87,8 @@ char *extract_sharename(const char *treename) | |||
| 87 | static enum | 87 | static enum |
| 88 | fscache_checkaux cifs_fscache_super_check_aux(void *cookie_netfs_data, | 88 | fscache_checkaux cifs_fscache_super_check_aux(void *cookie_netfs_data, |
| 89 | const void *data, | 89 | const void *data, |
| 90 | uint16_t datalen) | 90 | uint16_t datalen, |
| 91 | loff_t object_size) | ||
| 91 | { | 92 | { |
| 92 | struct cifs_fscache_super_auxdata auxdata; | 93 | struct cifs_fscache_super_auxdata auxdata; |
| 93 | const struct cifs_tcon *tcon = cookie_netfs_data; | 94 | const struct cifs_tcon *tcon = cookie_netfs_data; |
| @@ -113,18 +114,11 @@ const struct fscache_cookie_def cifs_fscache_super_index_def = { | |||
| 113 | .check_aux = cifs_fscache_super_check_aux, | 114 | .check_aux = cifs_fscache_super_check_aux, |
| 114 | }; | 115 | }; |
| 115 | 116 | ||
| 116 | static void | ||
| 117 | cifs_fscache_inode_get_attr(const void *cookie_netfs_data, uint64_t *size) | ||
| 118 | { | ||
| 119 | const struct cifsInodeInfo *cifsi = cookie_netfs_data; | ||
| 120 | |||
| 121 | *size = cifsi->vfs_inode.i_size; | ||
| 122 | } | ||
| 123 | |||
| 124 | static enum | 117 | static enum |
| 125 | fscache_checkaux cifs_fscache_inode_check_aux(void *cookie_netfs_data, | 118 | fscache_checkaux cifs_fscache_inode_check_aux(void *cookie_netfs_data, |
| 126 | const void *data, | 119 | const void *data, |
| 127 | uint16_t datalen) | 120 | uint16_t datalen, |
| 121 | loff_t object_size) | ||
| 128 | { | 122 | { |
| 129 | struct cifs_fscache_inode_auxdata auxdata; | 123 | struct cifs_fscache_inode_auxdata auxdata; |
| 130 | struct cifsInodeInfo *cifsi = cookie_netfs_data; | 124 | struct cifsInodeInfo *cifsi = cookie_netfs_data; |
| @@ -146,6 +140,5 @@ fscache_checkaux cifs_fscache_inode_check_aux(void *cookie_netfs_data, | |||
| 146 | const struct fscache_cookie_def cifs_fscache_inode_object_def = { | 140 | const struct fscache_cookie_def cifs_fscache_inode_object_def = { |
| 147 | .name = "CIFS.uniqueid", | 141 | .name = "CIFS.uniqueid", |
| 148 | .type = FSCACHE_COOKIE_TYPE_DATAFILE, | 142 | .type = FSCACHE_COOKIE_TYPE_DATAFILE, |
| 149 | .get_attr = cifs_fscache_inode_get_attr, | ||
| 150 | .check_aux = cifs_fscache_inode_check_aux, | 143 | .check_aux = cifs_fscache_inode_check_aux, |
| 151 | }; | 144 | }; |
diff --git a/fs/cifs/fscache.c b/fs/cifs/fscache.c index b89b59b01759..25d3f66b2d50 100644 --- a/fs/cifs/fscache.c +++ b/fs/cifs/fscache.c | |||
| @@ -79,7 +79,7 @@ void cifs_fscache_get_client_cookie(struct TCP_Server_Info *server) | |||
| 79 | &cifs_fscache_server_index_def, | 79 | &cifs_fscache_server_index_def, |
| 80 | &key, key_len, | 80 | &key, key_len, |
| 81 | NULL, 0, | 81 | NULL, 0, |
| 82 | server, true); | 82 | server, 0, true); |
| 83 | cifs_dbg(FYI, "%s: (0x%p/0x%p)\n", | 83 | cifs_dbg(FYI, "%s: (0x%p/0x%p)\n", |
| 84 | __func__, server, server->fscache); | 84 | __func__, server, server->fscache); |
| 85 | } | 85 | } |
| @@ -109,7 +109,7 @@ void cifs_fscache_get_super_cookie(struct cifs_tcon *tcon) | |||
| 109 | &cifs_fscache_super_index_def, | 109 | &cifs_fscache_super_index_def, |
| 110 | sharename, strlen(sharename), | 110 | sharename, strlen(sharename), |
| 111 | &tcon->resource_id, sizeof(tcon->resource_id), | 111 | &tcon->resource_id, sizeof(tcon->resource_id), |
| 112 | tcon, true); | 112 | tcon, 0, true); |
| 113 | kfree(sharename); | 113 | kfree(sharename); |
| 114 | cifs_dbg(FYI, "%s: (0x%p/0x%p)\n", | 114 | cifs_dbg(FYI, "%s: (0x%p/0x%p)\n", |
| 115 | __func__, server->fscache, tcon->fscache); | 115 | __func__, server->fscache, tcon->fscache); |
| @@ -137,7 +137,7 @@ static void cifs_fscache_acquire_inode_cookie(struct cifsInodeInfo *cifsi, | |||
| 137 | &cifs_fscache_inode_object_def, | 137 | &cifs_fscache_inode_object_def, |
| 138 | &cifsi->uniqueid, sizeof(cifsi->uniqueid), | 138 | &cifsi->uniqueid, sizeof(cifsi->uniqueid), |
| 139 | &auxdata, sizeof(auxdata), | 139 | &auxdata, sizeof(auxdata), |
| 140 | cifsi, true); | 140 | cifsi, cifsi->vfs_inode.i_size, true); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | static void cifs_fscache_enable_inode_cookie(struct inode *inode) | 143 | static void cifs_fscache_enable_inode_cookie(struct inode *inode) |
| @@ -301,13 +301,15 @@ int __cifs_readpages_from_fscache(struct inode *inode, | |||
| 301 | 301 | ||
| 302 | void __cifs_readpage_to_fscache(struct inode *inode, struct page *page) | 302 | void __cifs_readpage_to_fscache(struct inode *inode, struct page *page) |
| 303 | { | 303 | { |
| 304 | struct cifsInodeInfo *cifsi = CIFS_I(inode); | ||
| 304 | int ret; | 305 | int ret; |
| 305 | 306 | ||
| 306 | cifs_dbg(FYI, "%s: (fsc: %p, p: %p, i: %p)\n", | 307 | cifs_dbg(FYI, "%s: (fsc: %p, p: %p, i: %p)\n", |
| 307 | __func__, CIFS_I(inode)->fscache, page, inode); | 308 | __func__, cifsi->fscache, page, inode); |
| 308 | ret = fscache_write_page(CIFS_I(inode)->fscache, page, GFP_KERNEL); | 309 | ret = fscache_write_page(cifsi->fscache, page, |
| 310 | cifsi->vfs_inode.i_size, GFP_KERNEL); | ||
| 309 | if (ret != 0) | 311 | if (ret != 0) |
| 310 | fscache_uncache_page(CIFS_I(inode)->fscache, page); | 312 | fscache_uncache_page(cifsi->fscache, page); |
| 311 | } | 313 | } |
| 312 | 314 | ||
| 313 | void __cifs_fscache_readpages_cancel(struct inode *inode, struct list_head *pages) | 315 | void __cifs_fscache_readpages_cancel(struct inode *inode, struct list_head *pages) |
diff --git a/fs/fscache/cookie.c b/fs/fscache/cookie.c index 4d6210082a60..8ca9a932d225 100644 --- a/fs/fscache/cookie.c +++ b/fs/fscache/cookie.c | |||
| @@ -21,7 +21,8 @@ struct kmem_cache *fscache_cookie_jar; | |||
| 21 | 21 | ||
| 22 | static atomic_t fscache_object_debug_id = ATOMIC_INIT(0); | 22 | static atomic_t fscache_object_debug_id = ATOMIC_INIT(0); |
| 23 | 23 | ||
| 24 | static int fscache_acquire_non_index_cookie(struct fscache_cookie *cookie); | 24 | static int fscache_acquire_non_index_cookie(struct fscache_cookie *cookie, |
| 25 | loff_t object_size); | ||
| 25 | static int fscache_alloc_object(struct fscache_cache *cache, | 26 | static int fscache_alloc_object(struct fscache_cache *cache, |
| 26 | struct fscache_cookie *cookie); | 27 | struct fscache_cookie *cookie); |
| 27 | static int fscache_attach_object(struct fscache_cookie *cookie, | 28 | static int fscache_attach_object(struct fscache_cookie *cookie, |
| @@ -61,6 +62,7 @@ struct fscache_cookie *__fscache_acquire_cookie( | |||
| 61 | const void *index_key, size_t index_key_len, | 62 | const void *index_key, size_t index_key_len, |
| 62 | const void *aux_data, size_t aux_data_len, | 63 | const void *aux_data, size_t aux_data_len, |
| 63 | void *netfs_data, | 64 | void *netfs_data, |
| 65 | loff_t object_size, | ||
| 64 | bool enable) | 66 | bool enable) |
| 65 | { | 67 | { |
| 66 | struct fscache_cookie *cookie; | 68 | struct fscache_cookie *cookie; |
| @@ -160,7 +162,7 @@ struct fscache_cookie *__fscache_acquire_cookie( | |||
| 160 | * - we create indices on disk when we need them as an index | 162 | * - we create indices on disk when we need them as an index |
| 161 | * may exist in multiple caches */ | 163 | * may exist in multiple caches */ |
| 162 | if (cookie->type != FSCACHE_COOKIE_TYPE_INDEX) { | 164 | if (cookie->type != FSCACHE_COOKIE_TYPE_INDEX) { |
| 163 | if (fscache_acquire_non_index_cookie(cookie) == 0) { | 165 | if (fscache_acquire_non_index_cookie(cookie, object_size) == 0) { |
| 164 | set_bit(FSCACHE_COOKIE_ENABLED, &cookie->flags); | 166 | set_bit(FSCACHE_COOKIE_ENABLED, &cookie->flags); |
| 165 | } else { | 167 | } else { |
| 166 | atomic_dec(&parent->n_children); | 168 | atomic_dec(&parent->n_children); |
| @@ -194,6 +196,7 @@ EXPORT_SYMBOL(__fscache_acquire_cookie); | |||
| 194 | */ | 196 | */ |
| 195 | void __fscache_enable_cookie(struct fscache_cookie *cookie, | 197 | void __fscache_enable_cookie(struct fscache_cookie *cookie, |
| 196 | const void *aux_data, | 198 | const void *aux_data, |
| 199 | loff_t object_size, | ||
| 197 | bool (*can_enable)(void *data), | 200 | bool (*can_enable)(void *data), |
| 198 | void *data) | 201 | void *data) |
| 199 | { | 202 | { |
| @@ -215,7 +218,7 @@ void __fscache_enable_cookie(struct fscache_cookie *cookie, | |||
| 215 | /* Wait for outstanding disablement to complete */ | 218 | /* Wait for outstanding disablement to complete */ |
| 216 | __fscache_wait_on_invalidate(cookie); | 219 | __fscache_wait_on_invalidate(cookie); |
| 217 | 220 | ||
| 218 | if (fscache_acquire_non_index_cookie(cookie) == 0) | 221 | if (fscache_acquire_non_index_cookie(cookie, object_size) == 0) |
| 219 | set_bit(FSCACHE_COOKIE_ENABLED, &cookie->flags); | 222 | set_bit(FSCACHE_COOKIE_ENABLED, &cookie->flags); |
| 220 | } else { | 223 | } else { |
| 221 | set_bit(FSCACHE_COOKIE_ENABLED, &cookie->flags); | 224 | set_bit(FSCACHE_COOKIE_ENABLED, &cookie->flags); |
| @@ -232,11 +235,11 @@ EXPORT_SYMBOL(__fscache_enable_cookie); | |||
| 232 | * - this must make sure the index chain is instantiated and instantiate the | 235 | * - this must make sure the index chain is instantiated and instantiate the |
| 233 | * object representation too | 236 | * object representation too |
| 234 | */ | 237 | */ |
| 235 | static int fscache_acquire_non_index_cookie(struct fscache_cookie *cookie) | 238 | static int fscache_acquire_non_index_cookie(struct fscache_cookie *cookie, |
| 239 | loff_t object_size) | ||
| 236 | { | 240 | { |
| 237 | struct fscache_object *object; | 241 | struct fscache_object *object; |
| 238 | struct fscache_cache *cache; | 242 | struct fscache_cache *cache; |
| 239 | uint64_t i_size; | ||
| 240 | int ret; | 243 | int ret; |
| 241 | 244 | ||
| 242 | _enter(""); | 245 | _enter(""); |
| @@ -275,9 +278,6 @@ static int fscache_acquire_non_index_cookie(struct fscache_cookie *cookie) | |||
| 275 | return ret; | 278 | return ret; |
| 276 | } | 279 | } |
| 277 | 280 | ||
| 278 | /* pass on how big the object we're caching is supposed to be */ | ||
| 279 | cookie->def->get_attr(cookie->netfs_data, &i_size); | ||
| 280 | |||
| 281 | spin_lock(&cookie->lock); | 281 | spin_lock(&cookie->lock); |
| 282 | if (hlist_empty(&cookie->backing_objects)) { | 282 | if (hlist_empty(&cookie->backing_objects)) { |
| 283 | spin_unlock(&cookie->lock); | 283 | spin_unlock(&cookie->lock); |
| @@ -287,7 +287,7 @@ static int fscache_acquire_non_index_cookie(struct fscache_cookie *cookie) | |||
| 287 | object = hlist_entry(cookie->backing_objects.first, | 287 | object = hlist_entry(cookie->backing_objects.first, |
| 288 | struct fscache_object, cookie_link); | 288 | struct fscache_object, cookie_link); |
| 289 | 289 | ||
| 290 | fscache_set_store_limit(object, i_size); | 290 | fscache_set_store_limit(object, object_size); |
| 291 | 291 | ||
| 292 | /* initiate the process of looking up all the objects in the chain | 292 | /* initiate the process of looking up all the objects in the chain |
| 293 | * (done by fscache_initialise_object()) */ | 293 | * (done by fscache_initialise_object()) */ |
diff --git a/fs/fscache/fsdef.c b/fs/fscache/fsdef.c index 1122e97d56e8..aa46e48d8c75 100644 --- a/fs/fscache/fsdef.c +++ b/fs/fscache/fsdef.c | |||
| @@ -16,7 +16,8 @@ | |||
| 16 | static | 16 | static |
| 17 | enum fscache_checkaux fscache_fsdef_netfs_check_aux(void *cookie_netfs_data, | 17 | enum fscache_checkaux fscache_fsdef_netfs_check_aux(void *cookie_netfs_data, |
| 18 | const void *data, | 18 | const void *data, |
| 19 | uint16_t datalen); | 19 | uint16_t datalen, |
| 20 | loff_t object_size); | ||
| 20 | 21 | ||
| 21 | /* | 22 | /* |
| 22 | * The root index is owned by FS-Cache itself. | 23 | * The root index is owned by FS-Cache itself. |
| @@ -76,7 +77,8 @@ struct fscache_cookie_def fscache_fsdef_netfs_def = { | |||
| 76 | static enum fscache_checkaux fscache_fsdef_netfs_check_aux( | 77 | static enum fscache_checkaux fscache_fsdef_netfs_check_aux( |
| 77 | void *cookie_netfs_data, | 78 | void *cookie_netfs_data, |
| 78 | const void *data, | 79 | const void *data, |
| 79 | uint16_t datalen) | 80 | uint16_t datalen, |
| 81 | loff_t object_size) | ||
| 80 | { | 82 | { |
| 81 | struct fscache_netfs *netfs = cookie_netfs_data; | 83 | struct fscache_netfs *netfs = cookie_netfs_data; |
| 82 | uint32_t version; | 84 | uint32_t version; |
diff --git a/fs/fscache/object.c b/fs/fscache/object.c index a7b28f876fde..1085ca12e25c 100644 --- a/fs/fscache/object.c +++ b/fs/fscache/object.c | |||
| @@ -922,7 +922,8 @@ static void fscache_dequeue_object(struct fscache_object *object) | |||
| 922 | * and creation). | 922 | * and creation). |
| 923 | */ | 923 | */ |
| 924 | enum fscache_checkaux fscache_check_aux(struct fscache_object *object, | 924 | enum fscache_checkaux fscache_check_aux(struct fscache_object *object, |
| 925 | const void *data, uint16_t datalen) | 925 | const void *data, uint16_t datalen, |
| 926 | loff_t object_size) | ||
| 926 | { | 927 | { |
| 927 | enum fscache_checkaux result; | 928 | enum fscache_checkaux result; |
| 928 | 929 | ||
| @@ -932,7 +933,7 @@ enum fscache_checkaux fscache_check_aux(struct fscache_object *object, | |||
| 932 | } | 933 | } |
| 933 | 934 | ||
| 934 | result = object->cookie->def->check_aux(object->cookie->netfs_data, | 935 | result = object->cookie->def->check_aux(object->cookie->netfs_data, |
| 935 | data, datalen); | 936 | data, datalen, object_size); |
| 936 | switch (result) { | 937 | switch (result) { |
| 937 | /* entry okay as is */ | 938 | /* entry okay as is */ |
| 938 | case FSCACHE_CHECKAUX_OKAY: | 939 | case FSCACHE_CHECKAUX_OKAY: |
diff --git a/fs/fscache/page.c b/fs/fscache/page.c index 810b33aced1c..111349f67d98 100644 --- a/fs/fscache/page.c +++ b/fs/fscache/page.c | |||
| @@ -963,6 +963,7 @@ void fscache_invalidate_writes(struct fscache_cookie *cookie) | |||
| 963 | */ | 963 | */ |
| 964 | int __fscache_write_page(struct fscache_cookie *cookie, | 964 | int __fscache_write_page(struct fscache_cookie *cookie, |
| 965 | struct page *page, | 965 | struct page *page, |
| 966 | loff_t object_size, | ||
| 966 | gfp_t gfp) | 967 | gfp_t gfp) |
| 967 | { | 968 | { |
| 968 | struct fscache_storage *op; | 969 | struct fscache_storage *op; |
| @@ -1014,6 +1015,10 @@ int __fscache_write_page(struct fscache_cookie *cookie, | |||
| 1014 | /* add the page to the pending-storage radix tree on the backing | 1015 | /* add the page to the pending-storage radix tree on the backing |
| 1015 | * object */ | 1016 | * object */ |
| 1016 | spin_lock(&object->lock); | 1017 | spin_lock(&object->lock); |
| 1018 | |||
| 1019 | if (object->store_limit_l != object_size) | ||
| 1020 | fscache_set_store_limit(object, object_size); | ||
| 1021 | |||
| 1017 | spin_lock(&cookie->stores_lock); | 1022 | spin_lock(&cookie->stores_lock); |
| 1018 | 1023 | ||
| 1019 | _debug("store limit %llx", (unsigned long long) object->store_limit); | 1024 | _debug("store limit %llx", (unsigned long long) object->store_limit); |
diff --git a/fs/nfs/fscache-index.c b/fs/nfs/fscache-index.c index 6fd3679b7137..1c5d8d31fc0a 100644 --- a/fs/nfs/fscache-index.c +++ b/fs/nfs/fscache-index.c | |||
| @@ -70,20 +70,6 @@ const struct fscache_cookie_def nfs_fscache_super_index_def = { | |||
| 70 | }; | 70 | }; |
| 71 | 71 | ||
| 72 | /* | 72 | /* |
| 73 | * Get certain file attributes from the netfs data | ||
| 74 | * - This function can be absent for an index | ||
| 75 | * - Not permitted to return an error | ||
| 76 | * - The netfs data from the cookie being used as the source is presented | ||
| 77 | */ | ||
| 78 | static void nfs_fscache_inode_get_attr(const void *cookie_netfs_data, | ||
| 79 | uint64_t *size) | ||
| 80 | { | ||
| 81 | const struct nfs_inode *nfsi = cookie_netfs_data; | ||
| 82 | |||
| 83 | *size = nfsi->vfs_inode.i_size; | ||
| 84 | } | ||
| 85 | |||
| 86 | /* | ||
| 87 | * Consult the netfs about the state of an object | 73 | * Consult the netfs about the state of an object |
| 88 | * - This function can be absent if the index carries no state data | 74 | * - This function can be absent if the index carries no state data |
| 89 | * - The netfs data from the cookie being used as the target is | 75 | * - The netfs data from the cookie being used as the target is |
| @@ -92,7 +78,8 @@ static void nfs_fscache_inode_get_attr(const void *cookie_netfs_data, | |||
| 92 | static | 78 | static |
| 93 | enum fscache_checkaux nfs_fscache_inode_check_aux(void *cookie_netfs_data, | 79 | enum fscache_checkaux nfs_fscache_inode_check_aux(void *cookie_netfs_data, |
| 94 | const void *data, | 80 | const void *data, |
| 95 | uint16_t datalen) | 81 | uint16_t datalen, |
| 82 | loff_t object_size) | ||
| 96 | { | 83 | { |
| 97 | struct nfs_fscache_inode_auxdata auxdata; | 84 | struct nfs_fscache_inode_auxdata auxdata; |
| 98 | struct nfs_inode *nfsi = cookie_netfs_data; | 85 | struct nfs_inode *nfsi = cookie_netfs_data; |
| @@ -101,7 +88,6 @@ enum fscache_checkaux nfs_fscache_inode_check_aux(void *cookie_netfs_data, | |||
| 101 | return FSCACHE_CHECKAUX_OBSOLETE; | 88 | return FSCACHE_CHECKAUX_OBSOLETE; |
| 102 | 89 | ||
| 103 | memset(&auxdata, 0, sizeof(auxdata)); | 90 | memset(&auxdata, 0, sizeof(auxdata)); |
| 104 | auxdata.size = nfsi->vfs_inode.i_size; | ||
| 105 | auxdata.mtime = nfsi->vfs_inode.i_mtime; | 91 | auxdata.mtime = nfsi->vfs_inode.i_mtime; |
| 106 | auxdata.ctime = nfsi->vfs_inode.i_ctime; | 92 | auxdata.ctime = nfsi->vfs_inode.i_ctime; |
| 107 | 93 | ||
| @@ -150,7 +136,6 @@ static void nfs_fh_put_context(void *cookie_netfs_data, void *context) | |||
| 150 | const struct fscache_cookie_def nfs_fscache_inode_object_def = { | 136 | const struct fscache_cookie_def nfs_fscache_inode_object_def = { |
| 151 | .name = "NFS.fh", | 137 | .name = "NFS.fh", |
| 152 | .type = FSCACHE_COOKIE_TYPE_DATAFILE, | 138 | .type = FSCACHE_COOKIE_TYPE_DATAFILE, |
| 153 | .get_attr = nfs_fscache_inode_get_attr, | ||
| 154 | .check_aux = nfs_fscache_inode_check_aux, | 139 | .check_aux = nfs_fscache_inode_check_aux, |
| 155 | .get_context = nfs_fh_get_context, | 140 | .get_context = nfs_fh_get_context, |
| 156 | .put_context = nfs_fh_put_context, | 141 | .put_context = nfs_fh_put_context, |
diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c index c45ba2691cee..b55fc7920c3b 100644 --- a/fs/nfs/fscache.c +++ b/fs/nfs/fscache.c | |||
| @@ -86,7 +86,7 @@ void nfs_fscache_get_client_cookie(struct nfs_client *clp) | |||
| 86 | &nfs_fscache_server_index_def, | 86 | &nfs_fscache_server_index_def, |
| 87 | &key, len, | 87 | &key, len, |
| 88 | NULL, 0, | 88 | NULL, 0, |
| 89 | clp, true); | 89 | clp, 0, true); |
| 90 | dfprintk(FSCACHE, "NFS: get client cookie (0x%p/0x%p)\n", | 90 | dfprintk(FSCACHE, "NFS: get client cookie (0x%p/0x%p)\n", |
| 91 | clp, clp->fscache); | 91 | clp, clp->fscache); |
| 92 | } | 92 | } |
| @@ -188,7 +188,7 @@ void nfs_fscache_get_super_cookie(struct super_block *sb, const char *uniq, int | |||
| 188 | &nfs_fscache_super_index_def, | 188 | &nfs_fscache_super_index_def, |
| 189 | key, sizeof(*key) + ulen, | 189 | key, sizeof(*key) + ulen, |
| 190 | NULL, 0, | 190 | NULL, 0, |
| 191 | nfss, true); | 191 | nfss, 0, true); |
| 192 | dfprintk(FSCACHE, "NFS: get superblock cookie (0x%p/0x%p)\n", | 192 | dfprintk(FSCACHE, "NFS: get superblock cookie (0x%p/0x%p)\n", |
| 193 | nfss, nfss->fscache); | 193 | nfss, nfss->fscache); |
| 194 | return; | 194 | return; |
| @@ -237,7 +237,6 @@ void nfs_fscache_init_inode(struct inode *inode) | |||
| 237 | return; | 237 | return; |
| 238 | 238 | ||
| 239 | memset(&auxdata, 0, sizeof(auxdata)); | 239 | memset(&auxdata, 0, sizeof(auxdata)); |
| 240 | auxdata.size = nfsi->vfs_inode.i_size; | ||
| 241 | auxdata.mtime = nfsi->vfs_inode.i_mtime; | 240 | auxdata.mtime = nfsi->vfs_inode.i_mtime; |
| 242 | auxdata.ctime = nfsi->vfs_inode.i_ctime; | 241 | auxdata.ctime = nfsi->vfs_inode.i_ctime; |
| 243 | 242 | ||
| @@ -248,7 +247,7 @@ void nfs_fscache_init_inode(struct inode *inode) | |||
| 248 | &nfs_fscache_inode_object_def, | 247 | &nfs_fscache_inode_object_def, |
| 249 | nfsi->fh.data, nfsi->fh.size, | 248 | nfsi->fh.data, nfsi->fh.size, |
| 250 | &auxdata, sizeof(auxdata), | 249 | &auxdata, sizeof(auxdata), |
| 251 | nfsi, false); | 250 | nfsi, nfsi->vfs_inode.i_size, false); |
| 252 | } | 251 | } |
| 253 | 252 | ||
| 254 | /* | 253 | /* |
| @@ -263,7 +262,6 @@ void nfs_fscache_clear_inode(struct inode *inode) | |||
| 263 | dfprintk(FSCACHE, "NFS: clear cookie (0x%p/0x%p)\n", nfsi, cookie); | 262 | dfprintk(FSCACHE, "NFS: clear cookie (0x%p/0x%p)\n", nfsi, cookie); |
| 264 | 263 | ||
| 265 | memset(&auxdata, 0, sizeof(auxdata)); | 264 | memset(&auxdata, 0, sizeof(auxdata)); |
| 266 | auxdata.size = nfsi->vfs_inode.i_size; | ||
| 267 | auxdata.mtime = nfsi->vfs_inode.i_mtime; | 265 | auxdata.mtime = nfsi->vfs_inode.i_mtime; |
| 268 | auxdata.ctime = nfsi->vfs_inode.i_ctime; | 266 | auxdata.ctime = nfsi->vfs_inode.i_ctime; |
| 269 | fscache_relinquish_cookie(cookie, &auxdata, false); | 267 | fscache_relinquish_cookie(cookie, &auxdata, false); |
| @@ -306,7 +304,6 @@ void nfs_fscache_open_file(struct inode *inode, struct file *filp) | |||
| 306 | return; | 304 | return; |
| 307 | 305 | ||
| 308 | memset(&auxdata, 0, sizeof(auxdata)); | 306 | memset(&auxdata, 0, sizeof(auxdata)); |
| 309 | auxdata.size = nfsi->vfs_inode.i_size; | ||
| 310 | auxdata.mtime = nfsi->vfs_inode.i_mtime; | 307 | auxdata.mtime = nfsi->vfs_inode.i_mtime; |
| 311 | auxdata.ctime = nfsi->vfs_inode.i_ctime; | 308 | auxdata.ctime = nfsi->vfs_inode.i_ctime; |
| 312 | 309 | ||
| @@ -317,7 +314,7 @@ void nfs_fscache_open_file(struct inode *inode, struct file *filp) | |||
| 317 | fscache_uncache_all_inode_pages(cookie, inode); | 314 | fscache_uncache_all_inode_pages(cookie, inode); |
| 318 | } else { | 315 | } else { |
| 319 | dfprintk(FSCACHE, "NFS: nfsi 0x%p enabling cache\n", nfsi); | 316 | dfprintk(FSCACHE, "NFS: nfsi 0x%p enabling cache\n", nfsi); |
| 320 | fscache_enable_cookie(cookie, &auxdata, | 317 | fscache_enable_cookie(cookie, &auxdata, nfsi->vfs_inode.i_size, |
| 321 | nfs_fscache_can_enable, inode); | 318 | nfs_fscache_can_enable, inode); |
| 322 | if (fscache_cookie_enabled(cookie)) | 319 | if (fscache_cookie_enabled(cookie)) |
| 323 | set_bit(NFS_INO_FSCACHE, &NFS_I(inode)->flags); | 320 | set_bit(NFS_INO_FSCACHE, &NFS_I(inode)->flags); |
| @@ -495,7 +492,8 @@ void __nfs_readpage_to_fscache(struct inode *inode, struct page *page, int sync) | |||
| 495 | "NFS: readpage_to_fscache(fsc:%p/p:%p(i:%lx f:%lx)/%d)\n", | 492 | "NFS: readpage_to_fscache(fsc:%p/p:%p(i:%lx f:%lx)/%d)\n", |
| 496 | nfs_i_fscache(inode), page, page->index, page->flags, sync); | 493 | nfs_i_fscache(inode), page, page->index, page->flags, sync); |
| 497 | 494 | ||
| 498 | ret = fscache_write_page(nfs_i_fscache(inode), page, GFP_KERNEL); | 495 | ret = fscache_write_page(nfs_i_fscache(inode), page, |
| 496 | inode->i_size, GFP_KERNEL); | ||
| 499 | dfprintk(FSCACHE, | 497 | dfprintk(FSCACHE, |
| 500 | "NFS: readpage_to_fscache: p:%p(i:%lu f:%lx) ret %d\n", | 498 | "NFS: readpage_to_fscache: p:%p(i:%lu f:%lx) ret %d\n", |
| 501 | page, page->index, page->flags, ret); | 499 | page, page->index, page->flags, ret); |
diff --git a/fs/nfs/fscache.h b/fs/nfs/fscache.h index 96e989f579d1..161ba2edb9d0 100644 --- a/fs/nfs/fscache.h +++ b/fs/nfs/fscache.h | |||
| @@ -68,7 +68,6 @@ struct nfs_fscache_key { | |||
| 68 | struct nfs_fscache_inode_auxdata { | 68 | struct nfs_fscache_inode_auxdata { |
| 69 | struct timespec mtime; | 69 | struct timespec mtime; |
| 70 | struct timespec ctime; | 70 | struct timespec ctime; |
| 71 | loff_t size; | ||
| 72 | u64 change_attr; | 71 | u64 change_attr; |
| 73 | }; | 72 | }; |
| 74 | 73 | ||
