mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
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@linux.alibaba.com> Link: https://lore.kernel.org/r/20220509074028.74954-7-jefflexu@linux.alibaba.com Acked-by: David Howells <dhowells@redhat.com> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
This commit is contained in:
@@ -755,11 +755,6 @@ static int cachefiles_daemon_bind(struct cachefiles_cache *cache, char *args)
|
|||||||
cache->brun_percent >= 100)
|
cache->brun_percent >= 100)
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
|
|
||||||
if (*args) {
|
|
||||||
pr_err("'bind' command doesn't take an argument\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cache->rootdirname) {
|
if (!cache->rootdirname) {
|
||||||
pr_err("No cache directory specified\n");
|
pr_err("No cache directory specified\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -771,6 +766,18 @@ static int cachefiles_daemon_bind(struct cachefiles_cache *cache, char *args)
|
|||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IS_ENABLED(CONFIG_CACHEFILES_ONDEMAND)) {
|
||||||
|
if (!strcmp(args, "ondemand")) {
|
||||||
|
set_bit(CACHEFILES_ONDEMAND_MODE, &cache->flags);
|
||||||
|
} else if (*args) {
|
||||||
|
pr_err("Invalid argument to the 'bind' command\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
} else if (*args) {
|
||||||
|
pr_err("'bind' command doesn't take an argument\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Make sure we have copies of the tag string */
|
/* Make sure we have copies of the tag string */
|
||||||
if (!cache->tag) {
|
if (!cache->tag) {
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user