diff options
author | David Howells <dhowells@redhat.com> | 2018-04-04 13:41:28 +0100 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2018-04-06 14:05:14 +0100 |
commit | ee1235a9a06813429c201bf186397a6feeea07bf (patch) | |
tree | 444566605bfafce0b155a76e061a73c264329424 /fs/afs | |
parent | 402cb8dda949d9b8c0df20ad2527d139faad7ca1 (diff) | |
download | linux-ee1235a9a06813429c201bf186397a6feeea07bf.tar.gz linux-ee1235a9a06813429c201bf186397a6feeea07bf.tar.bz2 linux-ee1235a9a06813429c201bf186397a6feeea07bf.zip |
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/afs')
-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 |
5 files changed, 11 insertions, 25 deletions
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 @@ #include <linux/sched.h> #include "internal.h" -static void afs_vnode_cache_get_attr(const void *cookie_netfs_data, - uint64_t *size); static enum fscache_checkaux afs_vnode_cache_check_aux(void *cookie_netfs_data, const void *buffer, - uint16_t buflen); + uint16_t buflen, + loff_t object_size); struct fscache_netfs afs_cache_netfs = { .name = "afs", @@ -36,31 +35,16 @@ struct fscache_cookie_def afs_volume_cache_index_def = { struct fscache_cookie_def afs_vnode_cache_index_def = { .name = "AFS.vnode", .type = FSCACHE_COOKIE_TYPE_DATAFILE, - .get_attr = afs_vnode_cache_get_attr, .check_aux = afs_vnode_cache_check_aux, }; /* - * provide updated file attributes - */ -static void afs_vnode_cache_get_attr(const void *cookie_netfs_data, - uint64_t *size) -{ - const struct afs_vnode *vnode = cookie_netfs_data; - - _enter("{%x,%x,%llx},", - vnode->fid.vnode, vnode->fid.unique, - vnode->status.data_version); - - *size = vnode->status.size; -} - -/* * check that the auxiliary data indicates that the entry is still valid */ static enum fscache_checkaux afs_vnode_cache_check_aux(void *cookie_netfs_data, const void *buffer, - uint16_t buflen) + uint16_t buflen, + loff_t object_size) { struct afs_vnode *vnode = cookie_netfs_data; 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) &afs_cell_cache_index_def, cell->name, strlen(cell->name), NULL, 0, - cell, true); + cell, 0, true); #endif ret = afs_proc_cell_setup(net, cell); 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) /* send the page to the cache */ #ifdef CONFIG_AFS_FSCACHE if (PageFsCache(page) && - fscache_write_page(vnode->cache, page, GFP_KERNEL) != 0) { + fscache_write_page(vnode->cache, page, vnode->status.size, + GFP_KERNEL) != 0) { fscache_uncache_page(vnode->cache, page); BUG_ON(PageFsCache(page)); } @@ -403,7 +404,8 @@ static void afs_readpages_page_done(struct afs_call *call, struct afs_read *req) /* send the page to the cache */ #ifdef CONFIG_AFS_FSCACHE if (PageFsCache(page) && - fscache_write_page(vnode->cache, page, GFP_KERNEL) != 0) { + fscache_write_page(vnode->cache, page, vnode->status.size, + GFP_KERNEL) != 0) { fscache_uncache_page(vnode->cache, page); BUG_ON(PageFsCache(page)); } 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) &afs_vnode_cache_index_def, &key, sizeof(key), &aux, sizeof(aux), - vnode, true); + vnode, vnode->status.size, true); #endif } 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) &afs_volume_cache_index_def, &volume->vid, sizeof(volume->vid), NULL, 0, - volume, true); + volume, 0, true); #endif write_lock(&volume->cell->proc_lock); |