btrfs-progs: refactor around btrfs_insert_file_extent()
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | btrfs-progs: do not call btrfs_record_file_extent() out of btrfs-convertcommon/ common/ convert/ +5 more | +349 | 0 replies | |
| 2/2 | btrfs-progs: make btrfs_insert_file_extent() to accept an on-stack file extent itemconvert/ kernel-shared/ kernel-shared/ +2 more | +51 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] btrfs-progs: refactor around btrfs_insert_file_extent()
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