[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220331115753.89431-6-jefflexu@linux.alibaba.com>
Date: Thu, 31 Mar 2022 19:57:39 +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: torvalds@...ux-foundation.org, gregkh@...uxfoundation.org,
willy@...radead.org, 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,
luodaowen.backend@...edance.com, tianzichen@...ishou.com,
fannaihao@...du.com
Subject: [PATCH v7 05/19] cachefiles: enable on-demand read mode
Enable on-demand read mode by adding an optional parameter to the "bind"
command.
On-demand mode will be turned on when this parameter is "ondemand", i.e.
"bind ondemand". Otherwise cachefiles will work in the original mode.
Signed-off-by: Jeffle Xu <jefflexu@...ux.alibaba.com>
---
fs/cachefiles/daemon.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/fs/cachefiles/daemon.c b/fs/cachefiles/daemon.c
index d155a6da90d3..bd902a4c4cd8 100644
--- a/fs/cachefiles/daemon.c
+++ b/fs/cachefiles/daemon.c
@@ -738,11 +738,6 @@ static int cachefiles_daemon_bind(struct cachefiles_cache *cache, char *args)
cache->brun_percent >= 100)
return -ERANGE;
- if (*args) {
- pr_err("'bind' command doesn't take an argument\n");
- return -EINVAL;
- }
-
if (!cache->rootdirname) {
pr_err("No cache directory specified\n");
return -EINVAL;
@@ -754,6 +749,14 @@ static int cachefiles_daemon_bind(struct cachefiles_cache *cache, char *args)
return -EBUSY;
}
+ if (IS_ENABLED(CONFIG_CACHEFILES_ONDEMAND) &&
+ !strcmp(args, "ondemand")) {
+ set_bit(CACHEFILES_ONDEMAND_MODE, &cache->flags);
+ } else if (*args) {
+ pr_err("'bind' command doesn't take an argument\n");
+ return -EINVAL;
+ }
+
/* Make sure we have copies of the tag string */
if (!cache->tag) {
/*
--
2.27.0
Powered by blists - more mailing lists