Skip to content
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

mkfs.bcachefs defaults to block size 512 for a device with block size 512 #765

Open
myxoid opened this issue Oct 12, 2024 · 0 comments
Open

Comments

@myxoid
Copy link

myxoid commented Oct 12, 2024

Public documentation says the block size defaults to 4096.

bcachefs-tools built at b34d1341919c4edd3251c7f69c2588acd1196d71

I used mkfs.bcachefs rather than bcachefs format, but from reading the code, that should make no difference.

The man page does list defaults for a few things, but not the block size.


Looking at the code, this line:

opt_set(fs_opts, block_size, max_dev_block_size);

could be replaced with:

opt_set(fs_opts, block_size, max(4096, max_dev_block_size));

Or the documentation could be adjusted to say "block_size (default: maximum of all supplied device blocks sizes)".


It would be nice to a have stub man pages for the mkfs.* commands explaining that they are equivalent to ...


Total pedantry: Unless you are checking that all block sizes are powers of two, you should be calculating LCM instead of max, initialising lcm_dev_block_size to 1, not 0, and checking that the user-supplied block size % LCM block size is zero.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant