From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/2] btrfs-progs: refactor around btrfs_insert_file_extent()
Date: Tue, 5 Nov 2024 17:18:12 +1030 [thread overview]
Message-ID: <cover.1730788965.git.wqu@suse.com> (raw)
Although btrfs_insert_file_extent() is a btrfs-progs specific function,
it's pretty close (although not yet similiar enough to cross-port) to
insert_reserved_file_extent() from kernel.
That kernel function uses an on-stack btrfs_file_extent_item to pass all
the needed parameters, supporting both compressed and uncompressed data
extents.
That is way more flex than btrfs_insert_file_extent() from btrfs-progs,
which can not support:
- Non-zero offset
- Ram_bytes larger than num_bytes
- Compressed extents
To prepare for the incoming support of compressed data extents
generation for mkfs --rootdir, we need a more generic way to insert file
extents.
This patch improve the situation by:
- Move btrfs_record_file_extent() to be a convert specific function
The extra handling are all for converted btrfs, and can split extents
where regular btrfs doesn't want.
For mkfs/rootdir.c, the only caller out of convert, introduce a
helper, insert_reserved_file_extent() to handle the case.
- Make btrfs_insert_file_extent() to accept an on-stack btrfs_file_extent_item
Just like insert_reserved_file_extent() from kernel.
Allowing us to customize ever member of the btrfs_file_extent_item.
Now this makes btrfs_insert_file_extent() flex enough for converted
fs, and the incoming compressed file extents.
Qu Wenruo (2):
btrfs-progs: do not call btrfs_record_file_extent() out of
btrfs-convert
btrfs-progs: make btrfs_insert_file_extent() to accept an on-stack
file extent item
common/extent-tree-utils.c | 240 -------------------------------------
common/extent-tree-utils.h | 5 -
convert/common.c | 237 +++++++++++++++++++++++++++++++++++-
convert/common.h | 6 +
convert/main.c | 10 +-
convert/source-fs.c | 4 +-
convert/source-reiserfs.c | 2 +-
kernel-shared/file-item.c | 44 ++-----
kernel-shared/file-item.h | 4 +-
kernel-shared/file.c | 6 +-
mkfs/rootdir.c | 104 +++++++++++++++-
11 files changed, 369 insertions(+), 293 deletions(-)
--
2.47.0
next reply other threads:[~2024-11-05 6:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-05 6:48 Qu Wenruo [this message]
2024-11-05 6:48 ` [PATCH 1/2] btrfs-progs: do not call btrfs_record_file_extent() out of btrfs-convert Qu Wenruo
2024-11-05 6:48 ` [PATCH 2/2] btrfs-progs: make btrfs_insert_file_extent() to accept an on-stack file extent item 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=cover.1730788965.git.wqu@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@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