public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Bernd Schubert <bernd.schubert@fastmail.fm>
Cc: Bernd Schubert <bschubert@ddn.com>,
	miklos@szeredi.hu, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fuse: Allow to align reads/writes
Date: Wed, 3 Jul 2024 13:30:17 -0400	[thread overview]
Message-ID: <20240703173017.GB736953@perftesting> (raw)
In-Reply-To: <e6a58319-e6b1-40dc-81b8-11bd3641a9ca@fastmail.fm>

On Wed, Jul 03, 2024 at 05:58:20PM +0200, Bernd Schubert wrote:
> 
> 
> On 7/3/24 17:15, Josef Bacik wrote:
> > On Tue, Jul 02, 2024 at 06:31:08PM +0200, Bernd Schubert wrote:
> >> Read/writes IOs should be page aligned as fuse server
> >> might need to copy data to another buffer otherwise in
> >> order to fulfill network or device storage requirements.
> >>
> >> Simple reproducer is with libfuse, example/passthrough*
> >> and opening a file with O_DIRECT - without this change
> >> writing to that file failed with -EINVAL if the underlying
> >> file system was using ext4 (for passthrough_hp the
> >> 'passthrough' feature has to be disabled).
> >>
> >> Given this needs server side changes as new feature flag is
> >> introduced.
> >>
> >> Disadvantage of aligned writes is that server side needs
> >> needs another splice syscall (when splice is used) to seek
> >> over the unaligned area - i.e. syscall and memory copy overhead.
> >>
> >> Signed-off-by: Bernd Schubert <bschubert@ddn.com>
> >>
> >> ---
> >> From implementation point of view 'struct fuse_in_arg' /
> >> 'struct fuse_arg' gets another parameter 'align_size', which has to
> >> be set by fuse_write_args_fill. For all other fuse operations this
> >> parameter has to be 0, which is guranteed by the existing
> >> initialization via FUSE_ARGS and C99 style
> >> initialization { .size = 0, .value = NULL }, i.e. other members are
> >> zero.
> >> Another choice would have been to extend fuse_write_in to
> >> PAGE_SIZE - sizeof(fuse_in_header), but then would be an
> >> arch/PAGE_SIZE depending struct size and would also require
> >> lots of stack usage.
> > 
> > Can I see the libfuse side of this?  I'm confused why we need the align_size at
> > all?  Is it enough to just say that this connection is aligned, negotiate what
> > the alignment is up front, and then avoid sending it along on every write?
> 
> Sure, I had forgotten to post it
> https://github.com/bsbernd/libfuse/commit/89049d066efade047a72bcd1af8ad68061b11e7c
> 
> We could also just act on fc->align_writes / FUSE_ALIGN_WRITES and always use 
> sizeof(struct fuse_in_header) + sizeof(struct fuse_write_in) in libfuse and would
> avoid to send it inside of fuse_write_in. We still need to add it to struct fuse_in_arg,
> unless you want to check the request type within fuse_copy_args().

I think I like this approach better, at the very least it allows us to use the
padding for other silly things in the future.

> 
> The part I don't like in general about current fuse header handling (besides alignment)
> is that any header size changes will break fuse server and therefore need to be very
> carefully handled. See for example libfuse commit 681a0c1178fa.
> 

Agreed, if we could have the length of the control struct in the header then
then things would be a lot simpler to extend later on, but here we are.  Thanks,

Josef

  reply	other threads:[~2024-07-03 17:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-02 16:31 [PATCH] fuse: Allow to align reads/writes Bernd Schubert
2024-07-03 11:59 ` Bernd Schubert
2024-07-03 15:15 ` Josef Bacik
2024-07-03 15:58   ` Bernd Schubert
2024-07-03 17:30     ` Josef Bacik [this message]
2024-07-03 17:49       ` Joanne Koong
2024-07-03 18:07         ` Bernd Schubert
2024-07-03 20:28           ` Joanne Koong
2024-07-03 20:44             ` Bernd Schubert
2024-07-04 15:10               ` Josef Bacik
2024-07-04 15:49                 ` Bernd Schubert

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=20240703173017.GB736953@perftesting \
    --to=josef@toxicpanda.com \
    --cc=bernd.schubert@fastmail.fm \
    --cc=bschubert@ddn.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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