Message ID | 20211210073619.21667-4-jefflexu@linux.alibaba.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | fscache,erofs: fscache-based demand-read semantics | expand |
diff --git a/fs/cachefiles/interface.c b/fs/cachefiles/interface.c index 51c968cd00a6..b85051250cb7 100644 --- a/fs/cachefiles/interface.c +++ b/fs/cachefiles/interface.c @@ -110,6 +110,7 @@ static int cachefiles_adjust_size(struct cachefiles_object *object) { struct iattr newattrs; struct file *file = object->file; + struct cachefiles_cache *cache = object->volume->cache; uint64_t ni_size; loff_t oi_size; int ret; @@ -123,6 +124,9 @@ static int cachefiles_adjust_size(struct cachefiles_object *object) if (!file) return -ENOBUFS; + if (cache->mode == CACHEFILES_MODE_DEMAND) + return 0; + oi_size = i_size_read(file_inode(file)); if (oi_size == ni_size) return 0;
In demand-read mode, fs using fscache for demand-read doesn't know the exact file size of the data blob file, and the input @object_size parameter of fscache_acquire_cookie() could be fake in this case. Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com> --- fs/cachefiles/interface.c | 4 ++++ 1 file changed, 4 insertions(+)