[PATCH v4 0/6] f2fs: add f2fs_ioc_[get|set]_extra_attr

From: Sheng Yong
Date: Sun Jun 11 2023 - 23:02:02 EST


This patchset introduces two ioctls to get or modify values in
f2fs_inode's extra attribute area:
* f2fs_ioc_get_extra_attr
* f2fs_ioc_set_extra_attr

The argument of these two ioctls is `struct f2fs_extra_attr', which has
three members:
* field: indicates which field in extra attribute area is handled
* attr: value or userspace pointer
* attr_size: size of `attr'

The `field' member could help extend functionality of these two ioctls
without modify or add new interfaces, if more fields are added into
extra attributes ares in the feture.

In order to reuse existed functions, several helpers are added to:
* read inode chksum from inode page
* get compress blocks
* verify compression level
And, a compress_option v2 is added to access compress level and flags.

Thanks,
shengyong

v4:
* split into small commits
v3:
* setting lz4(hc) level correctly
v2:
* fix compiling error if CONFIG_F2FS_FS_ZSTD is disabled by adding a
helper f2fs_is_compress_level_valid()
* fix compiling warning for casting unsinged long long to pointer

Sheng Yong (6):
f2fs: add helper to check compression level
f2fs: cleanup MIN_INLINE_XATTR_SIZE
f2fs: add helper to get inode chksum from inode page
f2fs: add f2fs_ioc_get_compress_blocks
f2fs: add f2fs_ioc_[get|set]_extra_attr
f2fs: access compression level and flags by extra attr ioctls

fs/f2fs/compress.c | 31 +++++
fs/f2fs/f2fs.h | 4 +
fs/f2fs/file.c | 280 ++++++++++++++++++++++++++++++++++++--
fs/f2fs/inode.c | 21 +++
fs/f2fs/super.c | 6 +-
fs/f2fs/xattr.h | 1 +
include/uapi/linux/f2fs.h | 33 +++++
7 files changed, 359 insertions(+), 17 deletions(-)

--
2.40.1