lkml.org 
[lkml]   [2021]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC 03/19] cachefiles: refactor cachefiles_adjust_size()
Date
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(+)

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;
--
2.27.0
\
 
 \ /
  Last update: 2021-12-10 08:36    [W:0.157 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site