mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russ Fellows <russ.fellows@gmail.com>
To: miklos@szeredi.hu
Cc: amir73il@gmail.com, fuse-devel@lists.linux.dev,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Russ Fellows <russ.fellows@gmail.com>
Subject: [PATCH v4 0/2] fuse: allow parallel direct writes for passthrough
Date: Sun, 26 Jul 2026 01:59:53 +0000	[thread overview]
Message-ID: <20260726015955.319132-1-russ.fellows@gmail.com> (raw)
In-Reply-To: <20260616231325.16788-1-russ.fellows@gmail.com>

This is v4, about six weeks after v3 [1] -- apologies for the delay.
Thanks to Amir Goldstein for the detailed review of v3 and for the
suggested patches; this revision implements that feedback.  The v3
thread [1] has the full context and Amir's comments.

The series is also available at:
  https://github.com/russfellows/linux-fuse-passthrough-patches

FUSE passthrough writes are fully serialised on the inode lock, even when
the server advertises FOPEN_PARALLEL_DIRECT_WRITES and the write is a
direct, non-append, within-EOF overwrite.  Native FUSE direct-IO writes
already take a shared lock in that case; there is no reason passthrough
cannot do the same.  With a passthrough backing file on XFS, this is the
difference between serialised and fully parallel 4K random-write O_DIRECT
throughput.

Patch 1 stops fuse_file_io_open() from stripping
FOPEN_PARALLEL_DIRECT_WRITES on passthrough opens (which bypass the page
cache without FOPEN_DIRECT_IO).  Patch 2 lets fuse_passthrough_write_iter()
take the shared lock for eligible writes by sharing the existing direct-IO
write-lock helper rather than duplicating it.

Rebased onto v6.18.39 (LTS).

Changes since v3:
 - Patch 1: keep only the FOPEN_IOMODE_CACHED() helper (drop the
   IS_DIRECT / IS_PASSTHROUGH macros, which described how I/O is performed
   rather than the ff->iomode state and were misleading); fold the
   O_DIRECT/fcntl note into the FOPEN_PARALLEL_DIRECT_WRITES comment; and
   simplify fuse_file_io_open() so a pure direct-IO open needs no early
   return.  (Per Amir's review and suggested diff.)
 - Patch 2: instead of duplicating fuse_dio_lock() into passthrough.c,
   generalise it: fuse_io_wr_exclusive_lock() now also handles passthrough,
   the uncached-io refcount is factored into fuse_parallel_dio_start/end()
   (no-ops for passthrough's permanent uncached iomode), and
   fuse_dio_lock()/fuse_dio_unlock() are renamed fuse_io_wr_lock()/
   fuse_io_wr_unlock() and shared by both write paths.  (Per Amir's review
   and suggested diff.)

Testing (fstests / xfstests)
----------------------------
Run with the libfuse passthrough_hp server under xfstests (FSTYP=fuse),
'./check -fuse -g quick' (642 tests), on v6.18.39, backing XFS on a
RAM-backed null_blk device.  An unpatched v6.18.39 baseline was captured
first, then the same tree with this series applied; results were diffed to
isolate any patch-induced change.  Two server configs were exercised, as
suggested by Amir:

  passthrough (default):    unpatched 25 failed / patched 25 failed
  passthrough --direct-io:  unpatched 27 failed / patched 27 failed

In both configs the failing set is identical with and without the series
(the --direct-io set is the default set plus generic/355 and generic/362).
Every failure is pre-existing on the unpatched kernel and is a known
passthrough_hp / fuse limitation (permission/ACL/atime/mmap-coherency
tests), unrelated to this change:

  => zero regressions introduced by the series in either config.

No kernel warnings, lockdep reports, or splats were observed in any run.

Performance
-----------
Custom FUSE passthrough daemon advertising FOPEN_PASSTHROUGH |
FOPEN_PARALLEL_DIRECT_WRITES, XFS on a RAM-backed null_blk device, kernel
v6.18.39.  fio 4K random write, O_DIRECT, libaio, iodepth=64, single shared
file:

  numjobs | unpatched (IOPS) | patched (IOPS)
  --------|------------------|---------------
        1 |         352,000  |       352,000
        2 |         440,000  |       648,000
        3 |         429,000  |       951,000
        4 |         423,000  |       987,000

Unpatched write throughput is flat regardless of job count (the exclusive
inode lock serialises all writers to the file); with the series it scales
with concurrency, ~2.3x at 4 jobs, up to the backing device ceiling.
Single-job is unchanged (no lock contention), and 4K random *read*
throughput is unchanged (~1.37M IOPS with and without the series), since
reads never took the exclusive lock.

[1] v3: https://lore.kernel.org/all/20260616231325.16788-1-russ.fellows@gmail.com/

Russ Fellows (2):
  fuse: preserve FOPEN_PARALLEL_DIRECT_WRITES for passthrough opens
  fuse: allow parallel direct writes in passthrough write_iter

 fs/fuse/file.c        | 53 ++++++++++++++++++++++++++++++++++---------
 fs/fuse/fuse_i.h      |  2 ++
 fs/fuse/iomode.c      | 23 ++++++++++---------
 fs/fuse/passthrough.c |  6 ++---
 4 files changed, 59 insertions(+), 25 deletions(-)

--
2.51.0

  parent reply	other threads:[~2026-07-26  1:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16 23:13 [PATCH v3 0/2] fuse: fix passthrough parallel direct writes Russ Fellows
2026-06-16 23:13 ` [PATCH v3 1/2] fuse: preserve FOPEN_PARALLEL_DIRECT_WRITES for passthrough opens Russ Fellows
2026-06-19  8:12   ` Amir Goldstein
2026-06-16 23:13 ` [PATCH v3 2/2] fuse: allow parallel direct writes in passthrough write_iter Russ Fellows
2026-06-19  9:05   ` Amir Goldstein
2026-07-26  1:59 ` Russ Fellows [this message]
2026-07-26  1:59   ` [PATCH v4 1/2] fuse: preserve FOPEN_PARALLEL_DIRECT_WRITES for passthrough opens Russ Fellows
2026-07-26  1:59   ` [PATCH v4 2/2] fuse: allow parallel direct writes in passthrough write_iter Russ Fellows
2026-08-01 19:41   ` [PATCH v4 0/2] fuse: allow parallel direct writes for passthrough Amir Goldstein

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=20260726015955.319132-1-russ.fellows@gmail.com \
    --to=russ.fellows@gmail.com \
    --cc=amir73il@gmail.com \
    --cc=fuse-devel@lists.linux.dev \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®