Thread (3 messages) 3 messages, 3 authors, 2021-05-06

Re: [PATCH v3] btrfs-progs: mkfs: only output the warning if the sectorsize is not supported

From: David Sterba <hidden>
Date: 2021-05-06 14:46:04

On Tue, Apr 20, 2021 at 03:30:36PM +0800, Qu Wenruo wrote:
Currently mkfs.btrfs will output a warning message if the sectorsize is
not the same as page size:
  WARNING: the filesystem may not be mountable, sectorsize 4096 doesn't match page size 65536

But since btrfs subpage support for 64K page size is comming, this
output is populating the golden output of fstests, causing tons of false
alerts.

This patch will make teach mkfs.btrfs to check
/sys/fs/btrfs/features/supported_sectorsizes, and compare if the sector
size is supported.

Then only output above warning message if the sector size is not
supported.

This patch will also introduce a new helper,
sysfs_open_global_feature_file() to make it more obvious which global
feature file we're opening.

Signed-off-by: Qu Wenruo <redacted>
---
changelog:
v2:
- Introduce new helper to open global feature file
- Extra the supported sectorsize check into its own function
- Do proper token check other than strstr()
- Fix the bug that we're passing @page_size to check
v3:
- Fix the wrong delim for the next runs of strtok_r()
- Also check the terminal '\0' to handle cases like "4096" and "40960"
  This is not really needed, as the is_power_of_2() has already ruled
  out such cases.
  But just to be extra sure.
V3 replaced in devel, thanks.
+/*
+ * Open a file in global btrfs features directory and return the file
+ * descriptor or error.
+ */
+int sysfs_open_global_feature_file(const char *feature_name)
I've switched this to take a path relative to the toplevel directory ie
/sys/fs/btrfs, this is more general and can be used to read other sysfs
files. We'll use that more as not everything is provided via ioctls and
exporting that in sysfs is quite cheap.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help