[f2fs-dev] [PATCH] f2fs: remove F2FS_SET_FEATURE() and F2FS_CLEAR_FEATURE() macro

2022-11-23 Thread Yangtao Li via Linux-f2fs-devel
F2FS_SET_FEATURE() and F2FS_CLEAR_FEATURE() have never been used since they were introduced by this commit 76f105a2dbcd("f2fs: add feature facility in superblock"). So let's remove them. BTW, convert f2fs_sb_has_##name to return bool. Signed-off-by: Yangtao Li --- fs/f2fs/f2fs.h | 6 +- 1 f

[f2fs-dev] [PATCH v2] f2fs: introduce f2fs_is_readonly() for readability

2022-11-23 Thread Yangtao Li via Linux-f2fs-devel
Introduce f2fs_is_readonly() and use it to simplify code. Signed-off-by: Yangtao Li --- fs/f2fs/f2fs.h | 5 + fs/f2fs/super.c | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index f0833638f59e..eaef7ccee5ae 100644 --- a/fs/f2fs/f2fs.

Re: [f2fs-dev] [PATCH v4] f2fs: fix to enable compress for newly created file if extension matches

2022-11-23 Thread Chao Yu
On 2022/11/24 5:29, Jaegeuk Kim wrote: + if (S_ISDIR(inode->i_mode)) + goto inherit_comp; Documentation/filesystems/f2fs.rst - Priority in between FS_COMPR_FL, FS_NOCOMP_FS, extensions: * compress_extension=so; nocompress_extension=zip; chattr +c dir; touch dir/foo

Re: [f2fs-dev] [PATCH] f2fs: set zstd compress level correctly

2022-11-23 Thread Nick Terrell via Linux-f2fs-devel
> On Nov 17, 2022, at 7:10 AM, Sheng Yong wrote: > > > > Fixes: cf30f6a5f0c6 ("lib: zstd: Add kernel-specific API") > Signed-off-by: Sheng Yong > --- > fs/f2fs/compress.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c > index

Re: [f2fs-dev] [PATCH v3] fsverity: stop using PG_error to track error status

2022-11-23 Thread Eric Biggers
On Thu, Nov 10, 2022 at 12:21:06AM -0800, Eric Biggers wrote: > On Fri, Oct 28, 2022 at 10:58:07AM -0700, Eric Biggers wrote: > > From: Eric Biggers > > > > As a step towards freeing the PG_error flag for other uses, change ext4 > > and f2fs to stop using PG_error to track verity errors. Instead

Re: [f2fs-dev] [PATCH v7] f2fs: introduce F2FS_IOC_START_ATOMIC_REPLACE

2022-11-23 Thread Jaegeuk Kim
On 11/23, Chao Yu wrote: > On 2022/11/12 1:04, Daeho Jeong wrote: > > From: Daeho Jeong > > > > introduce a new ioctl to replace the whole content of a file atomically, > > which means it induces truncate and content update at the same time. > > We can start it with F2FS_IOC_START_ATOMIC_REPLACE

Re: [f2fs-dev] [PATCH v5] f2fs: fix to enable compress for newly created file if extension matches

2022-11-23 Thread Jaegeuk Kim
If compress_extension is set, and a newly created file matches the extension, the file could be marked as compression file. However, if inline_data is also enabled, there is no chance to check its extension since f2fs_should_compress() always returns false. This patch moves set_compress_inode(), w

Re: [f2fs-dev] [PATCH v4] f2fs: fix to enable compress for newly created file if extension matches

2022-11-23 Thread Jaegeuk Kim
On 11/23, Chao Yu wrote: > On 2022/11/17 9:12, Jaegeuk Kim wrote: > > If compress_extension is set, and a newly created file matches the > > extension, the file could be marked as compression file. However, > > if inline_data is also enabled, there is no chance to check its > > extension since f2fs

Re: [f2fs-dev] [PATCH] f2fs: introduce f2fs_is_readonly() for readability

2022-11-23 Thread Eric Biggers
On Thu, Nov 24, 2022 at 01:01:53AM +0800, Yangtao Li via Linux-f2fs-devel wrote: > Introduce f2fs_is_readonly() and use it to simplify code. > > Signed-off-by: Yangtao Li > --- > fs/f2fs/f2fs.h | 5 + > fs/f2fs/super.c | 5 ++--- > 2 files changed, 7 insertions(+), 3 deletions(-) > > diff

[f2fs-dev] [PATCH] f2fs: introduce f2fs_is_readonly() for readability

2022-11-23 Thread Yangtao Li via Linux-f2fs-devel
Introduce f2fs_is_readonly() and use it to simplify code. Signed-off-by: Yangtao Li --- fs/f2fs/f2fs.h | 5 + fs/f2fs/super.c | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index f0833638f59e..efc9d6d7b506 100644 --- a/fs/f2fs/f2fs.

[f2fs-dev] [PATCH v2 1/2] f2fs: define MIN_DISCARD_GRANULARITY macro

2022-11-23 Thread Yangtao Li via Linux-f2fs-devel
Do cleanup in f2fs_tuning_parameters() and __init_discard_policy(), let's use macro instead of number. Suggested-by: Chao Yu Signed-off-by: Yangtao Li --- fs/f2fs/f2fs.h| 2 ++ fs/f2fs/segment.c | 4 ++-- fs/f2fs/super.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --gi

[f2fs-dev] [PATCH v2 2/2] f2fs: introduce discard_urgent_util sysfs node

2022-11-23 Thread Yangtao Li via Linux-f2fs-devel
Through this node, you can control the background discard to run more aggressively or not aggressively when reach the utilization rate of the space. Signed-off-by: Yangtao Li --- Documentation/ABI/testing/sysfs-fs-f2fs | 8 fs/f2fs/f2fs.h | 1 + fs/f2fs/segment.

Re: [f2fs-dev] [PATCH v4] f2fs: fix to enable compress for newly created file if extension matches

2022-11-23 Thread Sheng Yong via Linux-f2fs-devel
On 2022/11/23 22:54, Chao Yu wrote: On 2022/11/17 9:12, Jaegeuk Kim wrote: If compress_extension is set, and a newly created file matches the extension, the file could be marked as compression file. However, if inline_data is also enabled, there is no chance to check its extension since f2fs_s

Re: [f2fs-dev] [PATCH] f2fs: init discard policy after thread wakeup

2022-11-23 Thread Yangtao Li via Linux-f2fs-devel
HI Chao, >> set_freezable(); >> >> do { > > if (!atomic_read(&dcc->discard_cmd_cnt)) > wait_ms = dpolicy.max_interval; dpolicy has not been initialized for the first time, and the value in the stack is unstable. Thx, Yangtao _

Re: [f2fs-dev] [PATCH] f2fs: define DEFAULT_SMALL_VOLUME_DISCARD_GRANULARITY macro

2022-11-23 Thread Chao Yu
On 2022/11/19 2:02, Yangtao Li wrote: Do cleanup in f2fs_tuning_parameters(), let's use macro instead of number. Signed-off-by: Yangtao Li --- fs/f2fs/f2fs.h | 2 ++ fs/f2fs/super.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index

Re: [f2fs-dev] [PATCH] f2fs: fix description about discard_granularity node

2022-11-23 Thread Chao Yu
On 2022/11/19 1:40, Yangtao Li wrote: Let's fix the inconsistency in the text description. Default discard granularity is 16. For small devices, default value is 1. Signed-off-by: Yangtao Li Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mail

Re: [f2fs-dev] [PATCH] f2fs: init discard policy after thread wakeup

2022-11-23 Thread Chao Yu
On 2022/11/18 11:46, Yangtao Li wrote: Under the current logic, after the discard thread wakes up, it will not run according to the expected policy, but will use the expected policy before sleep. Move the strategy selection to after the thread wakes up, so that the running state of the thread mee

Re: [f2fs-dev] [PATCH] f2fs: introduce discard_urgent_util sysfs node

2022-11-23 Thread Chao Yu
On 2022/11/17 22:35, Yangtao Li wrote: Through this node, you can control the background discard to run more aggressively when reach the utilization rate of the space. Signed-off-by: Yangtao Li --- Documentation/ABI/testing/sysfs-fs-f2fs | 8 fs/f2fs/f2fs.h

Re: [f2fs-dev] [PATCH] f2fs: make __queue_discard_cmd() return void

2022-11-23 Thread Chao Yu
On 2022/11/17 1:10, Yangtao Li wrote: Since __queue_discard_cmd() never returns an error, let's make it return void. Signed-off-by: Yangtao Li Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list [email protected]

Re: [f2fs-dev] [PATCH v7] f2fs: introduce F2FS_IOC_START_ATOMIC_REPLACE

2022-11-23 Thread Chao Yu
On 2022/11/12 1:04, Daeho Jeong wrote: From: Daeho Jeong introduce a new ioctl to replace the whole content of a file atomically, which means it induces truncate and content update at the same time. We can start it with F2FS_IOC_START_ATOMIC_REPLACE and complete it with F2FS_IOC_COMMIT_ATOMIC_W

Re: [f2fs-dev] [PATCH] f2fs: remove useless io_aware_gran variable

2022-11-23 Thread Chao Yu
On 2022/11/16 21:10, Yuwei Guan wrote: This 'io_aware_gran' is initialized as MAX_PLIST_NUM in __init_discard_policy(), and use as 'i < dpolicy->io_aware_gran' in __issue_discard_cmd(), but 'i < dpolicy->io_aware_gran' is true always, so remvoe this variable. I guess we can export it via sysfs

Re: [f2fs-dev] [PATCH] f2fs: fix to set DISCARD opt

2022-11-23 Thread Chao Yu
On 2022/11/16 2:40, Yangtao Li wrote: Some minor modifications to discard opt and related parameters: 1.introduce f2fs_is_readonly() and use it to simplify code 2.The FLUSH_MERGE opt is set by default only in non-ro mode. 3.When ro and DISCARD are set at the same time, an error is repor

Re: [f2fs-dev] [PATCH v4] f2fs: fix to enable compress for newly created file if extension matches

2022-11-23 Thread Chao Yu
On 2022/11/17 9:12, Jaegeuk Kim wrote: If compress_extension is set, and a newly created file matches the extension, the file could be marked as compression file. However, if inline_data is also enabled, there is no chance to check its extension since f2fs_should_compress() always returns false.

[f2fs-dev] [PATCH] f2fs: add support for counting the average time of submit discard cmd

2022-11-23 Thread Yangtao Li via Linux-f2fs-devel
This patch adds support for counting the average time of submit discard command, and we can see its value in debugfs. Signed-off-by: Yangtao Li --- fs/f2fs/debug.c | 7 +-- fs/f2fs/f2fs.h| 5 + fs/f2fs/segment.c | 17 +++-- 3 files changed, 25 insertions(+), 4 deletio