diff options
author | Huang Jianan | 2021-12-06 22:35:52 +0800 |
---|---|---|
committer | Gao Xiang | 2021-12-08 09:42:18 +0800 |
commit | 40452ffca3c1a0f2994e826f9fa213b107f1a2d4 (patch) | |
tree | c7f6126f75ba80183a7a7cd34832d4f75e594455 /fs/erofs/sysfs.c | |
parent | 168e9a76200c54c584a23aa88c62c53c4b0edd66 (diff) |
erofs: add sysfs node to control sync decompression strategy
Although readpage is a synchronous path, there will be no additional
kworker scheduling overhead in non-atomic contexts together with
dm-verity.
Let's add a sysfs node to disable sync decompression as an option.
Link: https://lore.kernel.org/r/20211206143552.8384-1-huangjianan@oppo.com
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Diffstat (limited to 'fs/erofs/sysfs.c')
-rw-r--r-- | fs/erofs/sysfs.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c index 33e15fa63c82..666693432107 100644 --- a/fs/erofs/sysfs.c +++ b/fs/erofs/sysfs.c @@ -16,6 +16,7 @@ enum { enum { struct_erofs_sb_info, + struct_erofs_mount_opts, }; struct erofs_attr { @@ -54,7 +55,14 @@ static struct erofs_attr erofs_attr_##_name = { \ #define ATTR_LIST(name) (&erofs_attr_##name.attr) +#ifdef CONFIG_EROFS_FS_ZIP +EROFS_ATTR_RW_UI(sync_decompress, erofs_mount_opts); +#endif + static struct attribute *erofs_attrs[] = { +#ifdef CONFIG_EROFS_FS_ZIP + ATTR_LIST(sync_decompress), +#endif NULL, }; ATTRIBUTE_GROUPS(erofs); @@ -85,6 +93,8 @@ static unsigned char *__struct_ptr(struct erofs_sb_info *sbi, { if (struct_type == struct_erofs_sb_info) return (unsigned char *)sbi + offset; + if (struct_type == struct_erofs_mount_opts) + return (unsigned char *)&sbi->opt + offset; return NULL; } @@ -130,6 +140,11 @@ static ssize_t erofs_attr_store(struct kobject *kobj, struct attribute *attr, return ret; if (t != (unsigned int)t) return -ERANGE; +#ifdef CONFIG_EROFS_FS_ZIP + if (!strcmp(a->attr.name, "sync_decompress") && + (t > EROFS_SYNC_DECOMPRESS_FORCE_OFF)) + return -EINVAL; +#endif *(unsigned int *)ptr = t; return len; case attr_pointer_bool: |