[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211210073619.21667-3-jefflexu@linux.alibaba.com>
Date: Fri, 10 Dec 2021 15:36:02 +0800
From: Jeffle Xu <jefflexu@...ux.alibaba.com>
To: dhowells@...hat.com, linux-cachefs@...hat.com, xiang@...nel.org,
chao@...nel.org, linux-erofs@...ts.ozlabs.org
Cc: linux-fsdevel@...r.kernel.org, joseph.qi@...ux.alibaba.com,
bo.liu@...ux.alibaba.com, tao.peng@...ux.alibaba.com,
gerry@...ux.alibaba.com, eguan@...ux.alibaba.com,
linux-kernel@...r.kernel.org
Subject: [RFC 02/19] cachefiles: implement key scheme for demand-read mode
In demand-read mode, user daemon may prepare data blob files in advance
before they are lookud up.
Thus simplify the logic of placing backing files, in which backing files
are under "cache/<volume>/" directory directly.
Also skip coherency checking currently to ease the development and debug.
Signed-off-by: Jeffle Xu <jefflexu@...ux.alibaba.com>
---
fs/cachefiles/namei.c | 8 +++++++-
fs/cachefiles/xattr.c | 5 +++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c
index 61d412580353..981e6e80690b 100644
--- a/fs/cachefiles/namei.c
+++ b/fs/cachefiles/namei.c
@@ -603,11 +603,17 @@ static bool cachefiles_open_file(struct cachefiles_object *object,
bool cachefiles_look_up_object(struct cachefiles_object *object)
{
struct cachefiles_volume *volume = object->volume;
- struct dentry *dentry, *fan = volume->fanout[(u8)object->cookie->key_hash];
+ struct cachefiles_cache *cache = volume->cache;
+ struct dentry *dentry, *fan;
int ret;
_enter("OBJ%x,%s,", object->debug_id, object->d_name);
+ if (cache->mode == CACHEFILES_MODE_CACHE)
+ fan = volume->fanout[(u8)object->cookie->key_hash];
+ else
+ fan = volume->dentry;
+
/* Look up path "cache/vol/fanout/file". */
ret = cachefiles_inject_read_error();
if (ret == 0)
diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c
index 0601c46a22ef..f562dd0d4bdd 100644
--- a/fs/cachefiles/xattr.c
+++ b/fs/cachefiles/xattr.c
@@ -88,6 +88,7 @@ int cachefiles_set_object_xattr(struct cachefiles_object *object)
*/
int cachefiles_check_auxdata(struct cachefiles_object *object, struct file *file)
{
+ struct cachefiles_cache *cache = object->volume->cache;
struct cachefiles_xattr *buf;
struct dentry *dentry = file->f_path.dentry;
unsigned int len = object->cookie->aux_len, tlen;
@@ -96,6 +97,10 @@ int cachefiles_check_auxdata(struct cachefiles_object *object, struct file *file
ssize_t xlen;
int ret = -ESTALE;
+ /* TODO: coherency check */
+ if (cache->mode == CACHEFILES_MODE_DEMAND)
+ return 0;
+
tlen = sizeof(struct cachefiles_xattr) + len;
buf = kmalloc(tlen, GFP_KERNEL);
if (!buf)
--
2.27.0
Powered by blists - more mailing lists