Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: linux-fsdevel@vger.kernel.org, linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: About using on-stack fsdata pointer for write_begin() and write_end() callbacks
Date: Mon, 11 Nov 2024 14:57:06 +1030	[thread overview]
Message-ID: <561428e6-3f71-48cb-bd73-46cc21789f6f@gmx.com> (raw)

Hi,

Recently I'm working on migrating btrfs_buffered_write() to utilize
write_begin() and write_end() callbacks.

Currently only the following filesystems really utilizing that pointer:

- bcachefs
   Which is a structure of 24 bytes without any extra pointer.

- f2fs (for compression)
   Which is holding a pointer to an array of pages.

- ext4
   Only utilize that pointer as a flag for ext4_da_write_begin()

- ocfs2
   This a large structure holding a lot of things

- (Future) btrfs
   Only holds a pointer and a bool.
   (Also needs a way to pass ki_flags to support IOCB_NOWAIT though)

Thus I'm wondering should we make perform_generic_write() to accept a
*fsdata pointer, other than making write_begin() to allocate one.
So that we only need to allocate the memory (or use the on-stack one)
once per write, other than once per folio.

This will cause no change to f2fs/ext4, but should benefit
ocfs2/bcachefs and of-course btrfs.

Or is there some special corner case that relies on the current behavior?

Thanks,
Qu

             reply	other threads:[~2024-11-11  4:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-11  4:27 Qu Wenruo [this message]
2024-11-11  5:52 ` About using on-stack fsdata pointer for write_begin() and write_end() callbacks Christoph Hellwig
2024-11-11  7:36   ` Qu Wenruo
2024-11-12  5:05     ` Christoph Hellwig
2024-11-12  5:31       ` Qu Wenruo
2024-11-12  5:41         ` Christoph Hellwig
2024-11-12  6:03           ` Qu Wenruo
2024-11-12  6:06             ` Christoph Hellwig
2024-11-12  6:13               ` Qu Wenruo

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=561428e6-3f71-48cb-bd73-46cc21789f6f@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@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