[PATCH 1/2] erofs: support query erofs ondemand feature by sysfs interface

Hongbo Li lihongbo22 at huawei.com
Fri Jun 21 16:18:07 AEST 2024


Erofs over fscache depands on the config CONFIG_EROFS_FS_ONDEMAND
in erofs. There is no way to check whether this feature is supported
or not in userspace. We introduce sysfs file `erofs_ondemand` for
user checking current features. Here is the example:

[Before]
$ cat /sys/fs/erofs/features/erofs_ondemand
cat: /sys/fs/erofs/features/erofs_ondemand: No such file or directory

[After]
$ cat /sys/fs/erofs/features/erofs_ondemand
supported

Signed-off-by: Hongbo Li <lihongbo22 at huawei.com>
---
 fs/erofs/sysfs.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c
index 435e515c0792..1b3d77583f76 100644
--- a/fs/erofs/sysfs.c
+++ b/fs/erofs/sysfs.c
@@ -78,6 +78,9 @@ EROFS_ATTR_FEATURE(sb_chksum);
 EROFS_ATTR_FEATURE(ztailpacking);
 EROFS_ATTR_FEATURE(fragments);
 EROFS_ATTR_FEATURE(dedupe);
+#if IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND)
+EROFS_ATTR_FEATURE(erofs_ondemand);
+#endif
 
 static struct attribute *erofs_feat_attrs[] = {
 	ATTR_LIST(zero_padding),
@@ -90,6 +93,9 @@ static struct attribute *erofs_feat_attrs[] = {
 	ATTR_LIST(ztailpacking),
 	ATTR_LIST(fragments),
 	ATTR_LIST(dedupe),
+#if IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND)
+	ATTR_LIST(erofs_ondemand),
+#endif
 	NULL,
 };
 ATTRIBUTE_GROUPS(erofs_feat);
-- 
2.34.1



More information about the Linux-erofs mailing list