[PATCH 0/2] fscache/cachefiles: some work for on-demand mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there's some work to make users of fscache on-demand mode support
PAGE_SIZE larger than 4KB (e.g. 16/64KB in aarch64) [1].  I think they
may be also useful for other users of fscache/cachefiles.


Strictly speacking, patch 1 is a bug fix though the issue doesn't cause
serious harm when erofs doesn't support large PAGE_SIZE (other than
4KB).

__cachefiles_prepare_write() will align the requested file range to
PAGE_SIZE boundary.  This is reasonable for libnetfs as libnetfs will
construct an iter with the aligned file range from the ground.

While for fscache on-demand mode, cachefiles_ondemand_fd_write_iter() is
called by the user daemon, and thus it is unexpected to align the file
range to PAGE_SIZE boundary, as the iov_iter/kiocb is given by the user
daemon.  If the given file range is not aligned with the block size of
the backing filesystem, let's fail the write directly.


Patch 2 adds a new helper, by which users of fscache on-demand mode
could wait for the wrangling of the cache object and then derive the
object size (set in cachefiles_ondemand_copen()).
fscache_begin_read_operation() is not feasible for this purpose as
in this case @want_state is FSCACHE_WANT_PARAMS and it will not wait
there for object wrangling when cookie is in
FSCACHE_COOKIE_STATE_CREATING state.  An example use case of this helper
is illustrated in [2].


Any comment is welcomed.


[1] https://lore.kernel.org/all/20230221091719.126127-1-jefflexu@xxxxxxxxxxxxxxxxx/
[2] https://lore.kernel.org/all/20230221091719.126127-2-jefflexu@xxxxxxxxxxxxxxxxx/

Jingbo Xu (2):
  cachefiles: don't align the write IO in ondemand mode
  fscache: introduce fscache_begin_wait_operation() helper

 fs/cachefiles/ondemand.c |  3 ++-
 fs/fscache/io.c          |  9 +++++++++
 include/linux/fscache.h  | 22 ++++++++++++++++++++++
 3 files changed, 33 insertions(+), 1 deletion(-)

-- 
2.19.1.6.gb485710b

--
Linux-cachefs mailing list
Linux-cachefs@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/linux-cachefs




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]
  Powered by Linux