mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jingbo Xu <jefflexu@linux.alibaba.com>
To: dhowells@redhat.com, linux-cachefs@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 0/2] fscache/cachefiles: some work for on-demand mode
Date: Tue, 21 Feb 2023 18:33:11 +0800	[thread overview]
Message-ID: <20230221103313.120834-1-jefflexu@linux.alibaba.com> (raw)

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@linux.alibaba.com/
[2] https://lore.kernel.org/all/20230221091719.126127-2-jefflexu@linux.alibaba.com/

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


             reply	other threads:[~2023-02-21 10:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21 10:33 Jingbo Xu [this message]
2023-02-21 10:33 ` [PATCH 1/2] cachefiles: don't align the write IO in ondemand mode Jingbo Xu
2023-02-21 10:33 ` [PATCH 2/2] fscache: introduce fscache_begin_wait_operation() helper Jingbo Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230221103313.120834-1-jefflexu@linux.alibaba.com \
    --to=jefflexu@linux.alibaba.com \
    --cc=dhowells@redhat.com \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®