lkml.org 
[lkml]   [2022]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v6 06/22] cachefiles: enable on-demand read mode
    Date
    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@linux.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 91b88a499737..2c38c5361bda 100644
    --- a/fs/cachefiles/daemon.c
    +++ b/fs/cachefiles/daemon.c
    @@ -741,11 +741,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;
    @@ -757,6 +752,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
    \
     
     \ /
      Last update: 2022-03-25 13:25    [W:4.190 / U:0.088 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site