-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
btrfs-progs: rename "sector size" to "block size" #930
Open
adam900710
wants to merge
10
commits into
kdave:devel
Choose a base branch
from
adam900710:sectorsize_rename
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The function btrfs_record_file_extent() has extra handling that's specific to convert, like allowing the range to be split by block group boundary and image file extent boundary. All of these split can only lead to corruption for non-converted fs. As the only caller out of btrfs-convert is rootdir, which expects the file extent item insert to respect the reserved data extent, and never to be split. Thankfully this is not going to cause huge problem, as btrfs_record_file_extent() has extra checks if the data extent overlaps with any existing one, and if it doesn't the handling will be the same as the kernel. But to avoid abuse, change btrfs_record_file_extent() by: - Rename it to btrfs_convert_file_extent() And add extra comments on that it is specific to btrfs-convert. - Move it to convert/common.[ch] - Introduce a helper insert_reserved_file_extent() for rootdir.c Signed-off-by: Qu Wenruo <[email protected]>
…extent item Just like insert_reserved_file_extent() from the kernel, we can make btrfs_insert_file_extent() accept an on-stack file extent item directly. This makes btrfs_insert_file_extent() more flex, and it can now handle the converted file extent where it has an non-zero offset. And this makes it much easier to expand for future compressed file extent generation. Signed-off-by: Qu Wenruo <[email protected]>
There were two major problems with add_file_items(): it was writing all files sector-by-sector, making compression impossible, and it was assuming that pread would never do a short read. Fix these problems, and create a new helper add_file_item_extent(). Signed-off-by: Mark Harmstone <[email protected]>
Add an option --compress to mkfs.btrfs, to allow creating files using zlib when using --rootdir. Signed-off-by: Mark Harmstone <[email protected]>
Allow --compress to work with zstd, when compiled in. Signed-off-by: Mark Harmstone <[email protected]>
Allow --compress to work with lzo. Signed-off-by: Mark Harmstone <[email protected]> [ Add extra handling when LZO support is not compiled in ] Signed-off-by: Qu Wenruo <[email protected]>
This will change all usage of btrfs_fs_info::sectorsize to btrfs_fs_info::blocksize. There are some extra changes involved: - Rename csum_tree_block_size()'s @csum_sectorsize to @csum_size In fact @csum_sectorsize is only used in the declaration, and the implementation is already using @csum_size instead. - Involved comments and simple function/variable names - btrfs_free_space_ctrl::sectorsize to blocksize - btrfs_mkfs_config::sectorsize to blocksize The following one is not changed yet, as it is part of on-disk format, thus will be changed in a dedicate patch. - btrfs_super_block::sectorsize The following one will not be changed: - btrfs_chunk::sector_size - btrfs_device_item::sector_size As "sector size" is correct terminology for minimum block IO size for a device. Signed-off-by: Qu Wenruo <[email protected]>
"--sectorsize" Btrfs uses the terminology "sectorsize" for the minimum data allocation size, which is very different from other filesystems, and can be a little confusing with the kernel block io sector size (which is the minimum block io size, and is fixed to 512 bytes). Let's start migrating mkfs.btrfs and its documentation to use the more common terminology instead. Signed-off-by: Qu Wenruo <[email protected]>
"blocksize" To align with other filesystems, with extra mentioning of the older "sectorsize" terminology to reduce confusion. Signed-off-by: Qu Wenruo <[email protected]>
This on-disk format rename is to keep the terminology aligned to other filesystems. Signed-off-by: Qu Wenruo <[email protected]>
adam900710
force-pushed
the
devel
branch
2 times, most recently
from
January 5, 2025 23:24
d740473
to
2eb8f9f
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since day 1 of btrfs, we use the name "sector size" to indicate the
minimum data unit size (from btrfs_super_block::sectorsize).
But all other file systems use "block size" to indicate the minimum data
unit size, and inside kernel, a sector is used to describe the minimal
IO block size for a block device.
Furthermore kernel sector size is fixed to 512, and different block
devices have different sector sizes, from the older 512 sector sized
HDDs, to modern day flash devices that are even pushing for 16K sector
size.
This has brought quite some confusiong when we need to co-operate with
other fs/mm people.
I believe it's time to do the migration for btrfs-progs first, then do
it inside the kernel, before we're pushing for iomap support.