cachefiles,netfs: sunset ondemand mode
Subsystems (3)
PATCH 1/1 cachefiles,netfs: sunset ondemand mode
It was an effort to enhance fscache as a kernel cache for lazy pulling (at least according to previous Incremental FS discussion [1]) and EROFS over fscache was the in-tree user of this mode.
fscache has since evolved to be netfslib-oriented, serving network filesystem inodes via the netfs library, but EROFS never acts as a network filesystem and we need to cache golden filesystem images rather than individual EROFS inodes.
Since EROFS over fscache is now removed, clean up netfs/fscache/ cachefiles upstream too.
[1] https://lore.kernel.org/r/CAOQ4uxi4dzxArY24YO=+kBCK2gGoq3Ptb8WkzCqSogPgU_R3dQ@mail.gmail.com
--- fs/cachefiles/Kconfig | 12 - fs/cachefiles/Makefile | 1 - fs/cachefiles/daemon.c | 76 +--- fs/cachefiles/interface.c | 8 - fs/cachefiles/internal.h | 128 ------- fs/cachefiles/io.c | 25 -- fs/cachefiles/namei.c | 8 - fs/cachefiles/ondemand.c | 761 -------------------------------------- include/linux/netfs.h | 9 - 9 files changed, 4 insertions(+), 1024 deletions(-) delete mode 100644 fs/cachefiles/ondemand.c
fs/cachefiles/Kconfig +0 -12
@@ -26,15 +26,3 @@ config CACHEFILES_ERROR_INJECTION help This permits error injection to be enabled in cachefiles whilst a cache is in service. - -config CACHEFILES_ONDEMAND - bool "Support for on-demand read" - depends on CACHEFILES - default n - help - This permits userspace to enable the cachefiles on-demand read mode. - In this mode, when a cache miss occurs, responsibility for fetching - the data lies with the cachefiles backend instead of with the netfs - and is delegated to userspace. - - If unsure, say N.
fs/cachefiles/Makefile +0 -1
@@ -16,6 +16,5 @@ cachefiles-y := \ xattr.o cachefiles-$(CONFIG_CACHEFILES_ERROR_INJECTION) += error_inject.o -cachefiles-$(CONFIG_CACHEFILES_ONDEMAND) += ondemand.o obj-$(CONFIG_CACHEFILES) := cachefiles.o
fs/cachefiles/daemon.c +4 -72
123 lines not on this page · raw message
fs/cachefiles/interface.c +0 -8
@@ -32,11 +32,6 @@ struct cachefiles_object *cachefiles_alloc_object(struct fscache_cookie *cookie)if (!object)return NULL ; -if (cachefiles_ondemand_init_obj_info (object, volume)) { -kmem_cache_free (cachefiles_object_jar, object); -return NULL ; - } -refcount_set (&object->ref,1 );spin_lock_init (&object->lock);
@@ -94,7 +89,6 @@ void cachefiles_put_object(struct cachefiles_object *object, ASSERTCMP(object->file, ==, NULL);kfree (object->d_name); -cachefiles_ondemand_deinit_obj_info (object); cache = object->volume->cache->cache;fscache_put_cookie (object->cookie, fscache_cookie_put_object); object->cookie =NULL ;
@@ -374,8 +368,6 @@ static void cachefiles_withdraw_cookie(struct fscache_cookie *cookie)spin_unlock (&cache->object_list_lock); } -cachefiles_ondemand_clean_object (object); -if (object->file) {cachefiles_begin_secure (cache, &saved_cred);cachefiles_clean_up_object (object, cache);
fs/cachefiles/internal.h +0 -128
174 lines not on this page · raw message
fs/cachefiles/io.c +0 -25
@@ -390,7 +390,6 @@ cachefiles_do_prepare_read(struct netfs_cache_resources *cres,size_t len = *_len;loff_t off, to;ino_t ino = file ?file_inode (file)->i_ino :0 ; -int rc;_enter ("%zx @%llx/%llx" , len, start, i_size);
@@ -403,8 +402,6 @@ cachefiles_do_prepare_read(struct netfs_cache_resources *cres,if (test_bit (FSCACHE_COOKIE_NO_DATA_TO_READ , &cookie->flags)) {__set_bit (NETFS_SREQ_COPY_TO_CACHE , _flags); why = cachefiles_trace_read_no_data; -if (!test_bit (NETFS_SREQ_ONDEMAND , _flags)) - goto out_no_object; }/* The object and the file may be being created in the background. */
@@ -421,7 +418,6 @@ cachefiles_do_prepare_read(struct netfs_cache_resources *cres, object =cachefiles_cres_object (cres); cache = object->volume->cache;cachefiles_begin_secure (cache, &saved_cred); -retry: off =cachefiles_inject_read_error ();if (off ==0 ) off =vfs_llseek (file, start,SEEK_DATA );
@@ -474,14 +470,6 @@ cachefiles_do_prepare_read(struct netfs_cache_resources *cres, download_and_store:__set_bit (NETFS_SREQ_COPY_TO_CACHE , _flags); -if (test_bit (NETFS_SREQ_ONDEMAND , _flags)) { - rc =cachefiles_ondemand_read (object, start, len); -if (!rc) { -__clear_bit (NETFS_SREQ_ONDEMAND , _flags); - goto retry; - } - ret =NETFS_INVALID_READ ; - } out:cachefiles_end_secure (cache, saved_cred); out_no_object:
@@ -501,18 +489,6 @@ static enum netfs_io_source cachefiles_prepare_read(struct netfs_io_subrequest * &subreq->flags, subreq->rreq->inode->i_ino); } -/* -* Prepare an on-demand read operation, shortening it to a cached/uncached -* boundary as appropriate. -*/ -static enum netfs_io_source -cachefiles_prepare_ondemand_read (struct netfs_cache_resources *cres, -loff_t start,size_t *_len,loff_t i_size, -unsigned long *_flags,ino_t ino) -{ -return cachefiles_do_prepare_read (cres, start, _len, i_size, _flags, ino); -} -/* * Prepare for a write to occur. */
@@ -731,7 +707,6 @@ static const struct netfs_cache_ops cachefiles_netfs_cache_ops = { .prepare_read = cachefiles_prepare_read, .prepare_write = cachefiles_prepare_write, .prepare_write_subreq = cachefiles_prepare_write_subreq, - .prepare_ondemand_read = cachefiles_prepare_ondemand_read, .query_occupancy = cachefiles_query_occupancy, };
fs/cachefiles/namei.c +0 -8
@@ -442,10 +442,6 @@ struct file *cachefiles_create_tmpfile(struct cachefiles_object *object)if (!cachefiles_mark_inode_in_use (object,file_inode (file)))WARN_ON (1 ); - ret =cachefiles_ondemand_init_object (object); -if (ret <0 ) - goto err_unuse; - ni_size = object->cookie->object_size; ni_size =round_up (ni_size,CACHEFILES_DIO_BLOCK_SIZE );
@@ -546,10 +542,6 @@ static bool cachefiles_open_file(struct cachefiles_object *object, }_debug ("file -> %pd positive" , dentry); - ret =cachefiles_ondemand_init_object (object); -if (ret <0 ) - goto error_fput; - ret =cachefiles_check_auxdata (object, file);if (ret <0 ) goto check_failed;
fs/cachefiles/ondemand.c deleted +0 -761
761 lines not on this page · raw message
include/linux/netfs.h +0 -9
@@ -191,7 +191,6 @@ struct netfs_io_subrequest {#define NETFS_SREQ_COPY_TO_CACHE 0/* Set if should copy the data to the cache */ #define NETFS_SREQ_CLEAR_TAIL 1/* Set if the rest of the read should be cleared */ #define NETFS_SREQ_MADE_PROGRESS 4/* Set if we transferred at least some data */ -#define NETFS_SREQ_ONDEMAND 5/* Set if it's from on-demand read mode */ #define NETFS_SREQ_BOUNDARY 6/* Set if ends on hard boundary (eg. ceph object) */ #define NETFS_SREQ_HIT_EOF 7/* Set if short due to EOF */ #define NETFS_SREQ_IN_PROGRESS 8/* Unlocked when the subrequest completes */
@@ -373,14 +372,6 @@ struct netfs_cache_ops { loff_t *_start, size_t *_len, size_t upper_len, loff_t i_size, bool no_space_allocated_yet); -/* Prepare an on-demand read operation, shortening it to a cached/uncached -* boundary as appropriate. -*/ -enum netfs_io_source (*prepare_ondemand_read)(struct netfs_cache_resources *cres, -loff_t start,size_t *_len, -loff_t i_size, -unsigned long *_flags,ino_t ino); -/* Query the occupancy of the cache in a region, returning where the * next chunk of data starts and how long it is. */
Signature · 1 line
2.47.3
Christian Brauner
maintainerQuoted 9 lines
It was an effort to enhance fscache as a kernel cache for lazy pulling (at least according to previous Incremental FS discussion [1]) and EROFS over fscache was the in-tree user of this mode.
fscache has since evolved to be netfslib-oriented, serving network filesystem inodes via the netfs library, but EROFS never acts as a network filesystem and we need to cache golden filesystem images rather than individual EROFS inodes.
Quoted 6 lines
Since EROFS over fscache is now removed, clean up netfs/fscache/ cachefiles upstream too.
[1] https://lore.kernel.org/r/CAOQ4uxi4dzxArY24YO=+kBCK2gGoq3Ptb8WkzCqSogPgU_R3dQ@mail.gmail.com
Signed-off-by Gao Xiang <[email protected]>
Seems sensible to me. So I'll take it unless David has objections.
Signature · 1 line
Christian Brauner <[email protected]>
Hi Christian,
Quoted 9 lines · Christian Brauner
Quoted 9 lines
It was an effort to enhance fscache as a kernel cache for lazy pulling (at least according to previous Incremental FS discussion [1]) and EROFS over fscache was the in-tree user of this mode.
fscache has since evolved to be netfslib-oriented, serving network filesystem inodes via the netfs library, but EROFS never acts as a network filesystem and we need to cache golden filesystem images rather than individual EROFS inodes.
Quoted 8 lines
Quoted 6 lines
Since EROFS over fscache is now removed, clean up netfs/fscache/ cachefiles upstream too.
[1] https://lore.kernel.org/r/CAOQ4uxi4dzxArY24YO=+kBCK2gGoq3Ptb8WkzCqSogPgU_R3dQ@mail.gmail.com
Signed-off-by Gao Xiang <[email protected]>Seems sensible to me. So I'll take it unless David has objections.
I hope David can ack it too. I didn't test this patch seriously since I have no proper environment to set up netfs although it should be a trivial removal.
Thanks,
Gao Xiang
Quoted 3 lines
Signature · 2 lines
-- Christian Brauner <[email protected]>
David Howells
maintainerThere are a number of mostly minor issues with this patch, as can be found listed here by Sashiko:
https://sashiko.dev/#/patchset/20260716103030.3065561-1-dhowells%40redhat.com
I've fixed them up in my tree and they'll appear in v7 of my "netfs: Keep track of folios in a segmented bio_vec[] chain" patches.
David
Hi David,
Quoted 7 lines · David Howells
There are a number of mostly minor issues with this patch, as can be found listed here by Sashiko:
https://sashiko.dev/#/patchset/20260716103030.3065561-1-dhowells%40redhat.comI've fixed them up in my tree and they'll appear in v7 of my "netfs: Keep track of folios in a segmented bio_vec[] chain" patches.
Sashiko's report on this individual patch is:
https://sashiko.dev/#/patchset/20260706030439.14212-1-xiang%40kernel.org
I once thought it'd be better to be the first patch if you'd like to apply to the netfs series, but anyway, you could adapt this patch if needed, and thanks for carrying this.
Thanks,
Gao Xiang
Quoted 4 lines
David