Thread (62 messages) 62 messages, 8 authors, 2021-04-21

Re: [PATCH v3 01/13] btrfs: add sysfs interface for supported sectorsize

From: Anand Jain <hidden>
Date: 2021-03-25 14:42:32

On 25/03/2021 15:14, Qu Wenruo wrote:
Add extra sysfs interface features/supported_ro_sectorsize and
features/supported_rw_sectorsize to indicate subpage support.

Currently for supported_rw_sectorsize all architectures only have their
PAGE_SIZE listed.

While for supported_ro_sectorsize, for systems with 64K page size, 4K
sectorsize is also supported.
  Change-log does match with the changes below.
quoted hunk ↗ jump to hunk
This new sysfs interface would help mkfs.btrfs to do more accurate
warning.

Signed-off-by: Qu Wenruo <redacted>
---
  fs/btrfs/sysfs.c | 15 +++++++++++++++
  1 file changed, 15 insertions(+)
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 6eb1c50fa98c..2f9c2639707c 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -360,11 +360,26 @@ static ssize_t supported_rescue_options_show(struct kobject *kobj,
  BTRFS_ATTR(static_feature, supported_rescue_options,
  	   supported_rescue_options_show);
  
+static ssize_t supported_sectorsizes_show(struct kobject *kobj,
+					  struct kobj_attribute *a,
+					  char *buf)
+{
+	ssize_t ret = 0;
+
+	/* Only support sectorsize == PAGE_SIZE yet */
+	ret += scnprintf(buf + ret, PAGE_SIZE - ret, "%lu\n",
+			 PAGE_SIZE);
+	return ret;
+}
   ret can be removed completely here.

Thanks, Anand

+BTRFS_ATTR(static_feature, supported_sectorsizes,
+	   supported_sectorsizes_show);
+
  static struct attribute *btrfs_supported_static_feature_attrs[] = {
  	BTRFS_ATTR_PTR(static_feature, rmdir_subvol),
  	BTRFS_ATTR_PTR(static_feature, supported_checksums),
  	BTRFS_ATTR_PTR(static_feature, send_stream_version),
  	BTRFS_ATTR_PTR(static_feature, supported_rescue_options),
+	BTRFS_ATTR_PTR(static_feature, supported_sectorsizes),
  	NULL
  };
  
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help