aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cachefiles
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
commitee1235a9a06813429c201bf186397a6feeea07bf (patch)
tree444566605bfafce0b155a76e061a73c264329424 /fs/cachefiles
parent402cb8dda949d9b8c0df20ad2527d139faad7ca1 (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/cachefiles')
-rw-r--r--fs/cachefiles/interface.c5
-rw-r--r--fs/cachefiles/xattr.c6
2 files changed, 6 insertions, 5 deletions
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 */