[f2fs-dev] [PATCH] mkfs.f2fs: align each device to zone size

2024-04-10 Thread Sheng Yong via Linux-f2fs-devel
For multiple device, each device should be aligned to zone size, instead of aligning the total size. Signed-off-by: Sheng Yong --- mkfs/f2fs_format.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c index 8f632f8..9e1b0d6

Re: [f2fs-dev] [PATCH] resize.f2fs: get value from new sb during rebuilding cp

2024-04-09 Thread Sheng Yong via Linux-f2fs-devel
On 2024/4/10 8:38, Jaegeuk Kim wrote: On 04/09, Sheng Yong wrote: On 2024/4/9 2:34, Jaegeuk Kim wrote: On 04/08, Sheng Yong wrote: Althrough old and new sb have the same value for now, it would be better to build new checkpoint according to new sb. May need to add assert, if they're

Re: [f2fs-dev] [PATCH] resize.f2fs: get value from new sb during rebuilding cp

2024-04-08 Thread Sheng Yong via Linux-f2fs-devel
On 2024/4/9 2:34, Jaegeuk Kim wrote: On 04/08, Sheng Yong wrote: Althrough old and new sb have the same value for now, it would be better to build new checkpoint according to new sb. May need to add assert, if they're different? We could add assert here, but I think it's

[f2fs-dev] [PATCH] f2fs-tools: print extension list properly

2024-04-08 Thread Sheng Yong via Linux-f2fs-devel
] hot file extentsions [db ] cp_payload [0x 0 : 0] Signed-off-by: Sheng Yong --- fsck/mount.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/fsck/mount.c b/fs

[f2fs-dev] [PATCH] resize.f2fs: get value from new sb during rebuilding cp

2024-04-08 Thread Sheng Yong via Linux-f2fs-devel
Althrough old and new sb have the same value for now, it would be better to build new checkpoint according to new sb. Signed-off-by: Sheng Yong --- fsck/resize.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fsck/resize.c b/fsck/resize.c index 049ddd3..1b4ae85

[f2fs-dev] [PATCH RFC] f2fs: only set release for file that has compressed data

2023-06-27 Thread Sheng Yong via Linux-f2fs-devel
If a file is not comprssed yet or does not have compressed data, for example, its data has a very low compression ratio, do not set FI_COMPRESS_RELEASED flag. Signed-off-by: Sheng Yong --- fs/f2fs/file.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/file.c

Re: [f2fs-dev] [PATCH v4 1/6] f2fs: add helper to check compression level

2023-06-12 Thread Sheng Yong via Linux-f2fs-devel
testcases, and all are passed. thanks, shengyong On 06/12, Sheng Yong wrote: This patch adds a helper function to check if compression level is valid. Signed-off-by: Sheng Yong --- fs/f2fs/compress.c | 31 +++ fs/f2fs/f2fs.h | 2 ++ fs/f2fs/super.c| 4

Re: [f2fs-dev] [PATCH v4 5/6] f2fs: add f2fs_ioc_[get|set]_extra_attr

2023-06-12 Thread Sheng Yong via Linux-f2fs-devel
On 2023/6/12 23:47, Jaegeuk Kim wrote: On 06/12, Sheng Yong wrote: This patch introduces two ioctls: * f2fs_ioc_get_extra_attr * f2fs_ioc_set_extra_attr to get or modify values in f2fs_inode's extra attribute area. What'd be the main purpose of this new ioctl? Use-cases or examples

[f2fs-dev] [PATCH v4 6/6] f2fs: access compression level and flags by extra attr ioctls

2023-06-11 Thread Sheng Yong via Linux-f2fs-devel
Allow getting or setting compression level and flags through F2FS_IOC_GET_EXTRA_ATTR and F2FS_IOC_SET_EXTRA_ATTR. Signed-off-by: Sheng Yong --- fs/f2fs/file.c| 56 --- include/uapi/linux/f2fs.h | 10 ++- 2 files changed, 55 insertions(+), 11

[f2fs-dev] [PATCH v4 3/6] f2fs: add helper to get inode chksum from inode page

2023-06-11 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- fs/f2fs/f2fs.h | 2 ++ fs/f2fs/inode.c | 21 + 2 files changed, 23 insertions(+) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 1b17bbe7e8656..a30c81ac7299d 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3478,6 +3478,8 @@ int

[f2fs-dev] [PATCH v4 5/6] f2fs: add f2fs_ioc_[get|set]_extra_attr

2023-06-11 Thread Sheng Yong via Linux-f2fs-devel
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. Signed-off-by: Sheng Yong --- fs/f2fs

[f2fs-dev] [PATCH v4 4/6] f2fs: add f2fs_ioc_get_compress_blocks

2023-06-11 Thread Sheng Yong via Linux-f2fs-devel
This patch adds f2fs_ioc_get_compress_blocks() to provide a common f2fs_get_compress_blocks(). Signed-off-by: Sheng Yong --- fs/f2fs/file.c | 23 +-- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 23c68ee946e58

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

2023-06-11 Thread Sheng Yong via Linux-f2fs-devel
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

[f2fs-dev] [PATCH v4 1/6] f2fs: add helper to check compression level

2023-06-11 Thread Sheng Yong via Linux-f2fs-devel
This patch adds a helper function to check if compression level is valid. Signed-off-by: Sheng Yong --- fs/f2fs/compress.c | 31 +++ fs/f2fs/f2fs.h | 2 ++ fs/f2fs/super.c| 4 ++-- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/fs/f2fs

[f2fs-dev] [PATCH v4 2/6] f2fs: cleanup MIN_INLINE_XATTR_SIZE

2023-06-11 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- fs/f2fs/super.c | 2 +- fs/f2fs/xattr.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 023981824d240..d7630f6dcbd62 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1361,7 +1361,7 @@ static int

[f2fs-dev] [PATCH v2 2/2] f2fs_io: convert compression ioctls to [get|set]_attr

2023-06-03 Thread Sheng Yong via Linux-f2fs-devel
Convert old compression ioctls to get extra attr ioctls. Signed-off-by: Sheng Yong --- tools/f2fs_io/f2fs_io.c | 25 ++--- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c index 70e0347..f6e6057 100644

[f2fs-dev] [PATCH v2 1/2] f2fs_io: add [get|set_attr] to access inode extra attributes

2023-06-03 Thread Sheng Yong via Linux-f2fs-devel
This patch adds get_attr and set_attr to access inode's extra attributes. Signed-off-by: Sheng Yong --- v2: update manpage of f2fs_io --- man/f2fs_io.8 | 65 tools/f2fs_io/f2fs_io.c | 165 tools/f2fs_io/f2fs_io.h | 34

[f2fs-dev] [PATCH v3] f2fs: add f2fs_ioc_[get|set]_extra_attr

2023-06-03 Thread Sheng Yong via Linux-f2fs-devel
* 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. Signed-off-by: Sheng Yong --- v3: * setting lz4(hc

Re: [f2fs-dev] [PATCH] f2fs: add f2fs_ioc_[get|set]_extra_attr

2023-06-01 Thread Sheng Yong via Linux-f2fs-devel
On 2023/6/1 11:16, Eric Biggers wrote: On Mon, May 29, 2023 at 09:35:00AM +0800, Sheng Yong via Linux-f2fs-devel wrote: This patch introduces two ioctls: * f2fs_ioc_get_extra_attr * f2fs_ioc_set_extra_attr to get or modify values in extra attribute area. The argument of these two

[f2fs-dev] [PATCH v2] f2fs: add f2fs_ioc_[get|set]_extra_attr

2023-05-30 Thread Sheng Yong via Linux-f2fs-devel
* 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. Signed-off-by: Sheng Yong --- v2: * fix compiling error

[f2fs-dev] [PATCH 2/2] f2fs_io: convert compression ioctls to [get|set]_attr

2023-05-28 Thread Sheng Yong via Linux-f2fs-devel
Convert compression related ioctls to get extra attr ioctls. Signed-off-by: Sheng Yong --- tools/f2fs_io/f2fs_io.c | 25 ++--- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c index 70e0347..f6e6057 100644

[f2fs-dev] [PATCH 1/2] f2fs_io: add [get|set_attr] to access inode extra attributes

2023-05-28 Thread Sheng Yong via Linux-f2fs-devel
This patch adds get_attr and set_attr to access inode's extra attributes. Signed-off-by: Sheng Yong --- tools/f2fs_io/f2fs_io.c | 165 tools/f2fs_io/f2fs_io.h | 34 + 2 files changed, 199 insertions(+) diff --git a/tools/f2fs_io/f2fs_io.c b

[f2fs-dev] [PATCH] f2fs: add f2fs_ioc_[get|set]_extra_attr

2023-05-28 Thread Sheng Yong via Linux-f2fs-devel
* 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. Signed-off-by: Sheng Yong --- fs/f2fs/f2fs.h

Re: [f2fs-dev] [RFC PATCH] f2fs: expand f2fs_compr_option to allow ioctl setting compression level

2023-03-30 Thread Sheng Yong via Linux-f2fs-devel
On 2023/3/31 0:15, Yangtao Li wrote: Hi Sheng Yong, Your idea, I also put forward before. And has been sent to version 2, but Chao and Jaegeuk have no comments yet. Time to talk about the series? https://lore.kernel.org/linux-f2fs-devel/20230112133503.16802-1-frank...@vivo.com/ Hi

[f2fs-dev] [RFC PATCH] f2fs: expand f2fs_compr_option to allow ioctl setting compression level

2023-03-30 Thread Sheng Yong via Linux-f2fs-devel
: New tool sets the MSB 4 bits to 1, get_option could return V0 values, but set_option will fail. Signed-off-by: Sheng Yong --- fs/f2fs/file.c| 41 ++- include/uapi/linux/f2fs.h | 39 ++--- 2 files changed, 72

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
f2fs_should_compress() always returns false. This patch moves set_compress_inode(), which do extension check, in f2fs_should_compress() to check extensions before setting inline data flag. Fixes: 7165841d578e ("f2fs: fix to check inline_data during compressed inode conversion") Signed-off

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

2022-11-17 Thread Sheng Yong via Linux-f2fs-devel
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 d315c2de136f2..74d3f2d2271f3 100644 --- a/fs/f2fs/compress.c +++

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

2022-11-15 Thread Sheng Yong via Linux-f2fs-devel
false. This patch moves set_compress_inode(), which do extension check, in f2fs_should_compress() to check extensions before setting inline data flag. Fixes: 7165841d578e ("f2fs: fix to check inline_data during compressed inode conversion") Signed-off-by: Sheng Yong Signed-off-by: J

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

2022-11-15 Thread Sheng Yong via Linux-f2fs-devel
(), which do extension check, in f2fs_should_compress() to check extensions before setting inline data flag. Fixes: 7165841d578e ("f2fs: fix to check inline_data during compressed inode conversion") Signed-off-by: Sheng Yong Signed-off-by: Jaegeuk Kim --- fs/f2fs/f2fs.h | 1 + fs/f2

[f2fs-dev] [PATCH v2] fsck.f2fs: avoid uncessary recalculation

2022-11-14 Thread Sheng Yong via Linux-f2fs-devel
There is no need to recalculate ADDRS_PER_INODE and ADDRS_PER_BLOCK, especially in a for loop. Signed-off-by: Sheng Yong --- fsck/fsck.c | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index ebc60ad..df91c82 100644 --- a/fsck

Re: [f2fs-dev] [PATCH v2 1/2] f2fs: fix to enable compress for newly created file if extension matches

2022-11-13 Thread Sheng Yong via Linux-f2fs-devel
=962379487b5cb9f3b85ea367b130c2c6ca584edf Hi, Jaegeuk, Absolutely. Thanks for addressing it. Second one is needed to address build error. Sorry for missing adding a hunk of that patch :( The above 2 commits are already tested, shall I resend a new patchset? thanks, shengyong On 11/11, Sheng Yong wrote

[f2fs-dev] [PATCH v2 2/2] f2fs: move set_file_temperature into f2fs_new_inode

2022-11-11 Thread Sheng Yong via Linux-f2fs-devel
Since the file name has already passed to f2fs_new_inode(), let's move set_file_temperature() into f2fs_new_inode(). Signed-off-by: Sheng Yong --- fs/f2fs/namei.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 36e251f438568

[f2fs-dev] [PATCH v2 1/2] f2fs: fix to enable compress for newly created file if extension matches

2022-11-11 Thread Sheng Yong via Linux-f2fs-devel
(), which do extension check, in f2fs_should_compress() to check extensions before setting inline data flag. Fixes: 7165841d578e ("f2fs: fix to check inline_data during compressed inode conversion") Signed-off-by: Sheng Yong --- fs/f2fs/namei.c | 27 +-- 1 file c

[f2fs-dev] [PATCH 2/4] fsck.f2fs: add parentheses for SB_MASK

2022-11-10 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- fsck/fsck.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsck/fsck.h b/fsck/fsck.h index 939450f..dabd8b9 100644 --- a/fsck/fsck.h +++ b/fsck/fsck.h @@ -50,7 +50,7 @@ enum SB_ADDR { SB_MAX_ADDR, }; -#define SB_MASK(i) (1 <

[f2fs-dev] [PATCH 3/4] fsck.f2fs: fix potential overflow of copying i_name

2022-11-10 Thread Sheng Yong via Linux-f2fs-devel
If i_namelen is corrupted, there may be an overflow when doing memcpy. Signed-off-by: Sheng Yong --- fsck/fsck.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index 036a834..ebc60ad 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -742,8

[f2fs-dev] [PATCH 1/4] dump.f2fs: remove unavailable optiont -g

2022-11-10 Thread Sheng Yong via Linux-f2fs-devel
Option "-g" for dump.f2fs is unavailable and not used in dump.f2fs. Signed-off-by: Sheng Yong --- fsck/main.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/fsck/main.c b/fsck/main.c index 3268664..9b50787 100644 --- a/fsck/main.c +++ b/fsck/main.c

[f2fs-dev] [PATCH 4/4] fsck.f2fs: avoid uncessary recalculation

2022-11-10 Thread Sheng Yong via Linux-f2fs-devel
There is no need to recalculate ADDRS_PER_INODE and ADDRS_PER_BLOCK, especially in a for loop. Signed-off-by: Sheng Yong --- fsck/fsck.c | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index ebc60ad..ec096f2 100644 --- a/fsck

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

2022-11-09 Thread Sheng Yong via Linux-f2fs-devel
在 2022/11/9 21:57, Chao Yu 写道: On 2022/11/9 19:01, Sheng Yong 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-dev] [PATCH] f2fs: fix to enable compress for newly created file if extension matches

2022-11-09 Thread Sheng Yong via Linux-f2fs-devel
has I_NEW flag and must have no pin/atomic/swap flag), instead of calling f2fs_should_compress(), checking its file type is enough here. Signed-off-by: Sheng Yong --- fs/f2fs/namei.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index

Re: [f2fs-dev] WARNING: ODEBUG bug in f2fs_fill_super

2019-02-20 Thread Sheng Yong
/debugobjects.c:329 debug_print_object+0x16a/0x210 lib/debugobjects.c:326 Kernel panic - not syncing: panic_on_warn set ... Was this fixed by something? It happened a number of times, but then stopped after Oct 23 2018. Was it: commit 26b5a079197c8cb6725565968b7fd3299bd1877b Author: Sheng Yong

[f2fs-dev] [PATCH v2] f2fs: UBSAN: set boolean value iostat_enable correctly

2019-01-15 Thread Sheng Yong
enable is enabled, set its value as true. Signed-off-by: Sheng Yong --- v2->v1: clear iostat_enable when disabling it --- fs/f2fs/sysfs.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index 0575edbe3ed6..f1ab9000b294 100644 ---

[f2fs-dev] [PATCH 1/2] f2fs: UBSAN: set boolean value iostat_enable correctly

2019-01-14 Thread Sheng Yong
enable is enabled, set its value as `true'. Signed-off-by: Sheng Yong --- fs/f2fs/sysfs.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index 0575edbe3ed6..b192627742a9 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -278,10 +

[f2fs-dev] [PATCH 2/2] f2fs: add brackets for macros

2019-01-14 Thread Sheng Yong
Signed-off-by: Sheng Yong --- fs/f2fs/f2fs.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index eeede26339a8..70eb7b085b2e 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -254,7 +254,7 @@ struct discard_entry { /* max discard

[f2fs-dev] [PATCH v2] f2fs: check if file namelen exceeds max value

2019-01-06 Thread Sheng Yong
Dentry bitmap is not enough to detect incorrect dentries. So this patch also checks the namelen value of a dentry. Signed-off-by: Gong Chen Signed-off-by: Sheng Yong --- v2->v1: Sorry, my bad. Fix incorrect brackets. --- fs/f2fs/dir.c | 3 ++- 1 file changed, 2 insertions(+), 1 delet

[f2fs-dev] [PATCH] f2fs: check if file namelen exceeds max value

2019-01-04 Thread Sheng Yong
Dentry bitmap is not enough to detect incorrect dentries. So this patch also checks the namelen value of a dentry. Signed-off-by: Gong Chen Signed-off-by: Sheng Yong --- fs/f2fs/dir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index

[f2fs-dev] [PATCH] f2fs: clear PG_writeback if IPU failed

2018-12-04 Thread Sheng Yong
If IPU failed, nothing is commited, we should end page writeback. Signed-off-by: Sheng Yong --- fs/f2fs/data.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 8780f3d737c4..b29b754141d8 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1853,6

Re: [f2fs-dev] [PATCH] f2fs: avoid frequent costly fsck triggers

2018-11-29 Thread Sheng Yong
Hi, Jaegeuk and Chao, On 2018/11/29 1:48, Jaegeuk Kim wrote: On 11/28, Chao Yu wrote: On 2018/11/28 16:10, Jaegeuk Kim wrote: On 11/28, Chao Yu wrote: Hi Jaeguek, On 2018/11/28 15:31, Jaegeuk Kim wrote: If we want to re-enable nat_bits, we rely on fsck which requires full scan of directory

Re: [f2fs-dev] [PATCH] f2fs: check memory boundary by insane namelen

2018-11-23 Thread Sheng Yong
Hi, Jaegeuk and Chao, On 2018/11/15 15:50, Jaegeuk Kim wrote: If namelen is corrupted to have very long value, fill_dentries can copy wrong memory area. Is there any scenario that could hit this corruption? Or this is triggered by fuzzing injection? thanks, Sheng Yong Signed-off

Re: [f2fs-dev] [PATCH v2] f2fs: fix race between write_checkpoint and write_begin

2018-11-14 Thread Sheng Yong
On 2018/11/15 9:59, Chao Yu wrote: On 2018/11/14 19:34, Sheng Yong wrote: The following race could lead to inconsistent SIT bitmap: Task A Task B == == f2fs_write_checkpoint block_operations f2fs_lock_all down_write

[f2fs-dev] [PATCH v2] f2fs: fix race between write_checkpoint and write_begin

2018-11-14 Thread Sheng Yong
finish write checkpoint sudden-power-off If SPO occurs after checkpoint is finished, SIT bitmap will be set incorrectly. Signed-off-by: Sheng Yong --- v2->v1: Sorry for late. We can use f2fs_lock_op directly, but it makes it a bit complicate to unlock. So v2 still uses __do_map_lock with

[f2fs-dev] [PATCH] f2fs: fix race between write_checkpoint and write_begin

2018-11-12 Thread Sheng Yong
finish write checkpoint sudden-power-off If SPO occurs after checkpoint is finished, SIT bitmap will be set incorrectly. This patch uses node_write to avoid the race condition. Signed-off-by: Sheng Yong --- fs/f2fs/data.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/f2fs/data.c b/fs

[f2fs-dev] [PATCH v2] f2fs: cleanup dirty pages if recover failed

2018-10-12 Thread Sheng Yong
546495] do_syscall_64+0x65/0x130 [ 53.546503] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 53.547639] ---[ end trace b804d1ea2fec893e ]--- So if recover fails, we need to drop all recovered data. Signed-off-by: Sheng Yong --- v2->v1: * track all recovered inodes so that if recovery fail, we can find an

Re: [f2fs-dev] [PATCH] fsck.f2fs: do not check segment type of empty curseg

2018-10-09 Thread Sheng Yong
Sorry, this seems wrong, please ignore this :( On 2018/10/8 21:09, Sheng Yong wrote: If a curseg is not used, its SIT entry may have an inconsistent type. This will be fixed during recover. Fixes: df8065e52928be ("fsck.f2fs: introduce fsck_chk_curseg_info") Signed-off-by:

[f2fs-dev] [PATCH] fsck.f2fs: do not check segment type of empty curseg

2018-10-08 Thread Sheng Yong
If a curseg is not used, its SIT entry may have an inconsistent type. This will be fixed during recover. Fixes: df8065e52928be ("fsck.f2fs: introduce fsck_chk_curseg_info") Signed-off-by: Sheng Yong --- fsck/fsck.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/f

[f2fs-dev] [PATCH] f2fs: cleanup dirty pages if recover failed

2018-09-27 Thread Sheng Yong
546495] do_syscall_64+0x65/0x130 [ 53.546503] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 53.547639] ---[ end trace b804d1ea2fec893e ]--- So if recover fails, we need to drop all recovered data. Signed-off-by: Sheng Yong --- fs/f2fs/recovery.c | 19 --- fs/f2fs/super.c| 15

Re: [f2fs-dev] [PATCH] fsck.f2fs: detect and recover corrupted quota file

2018-09-18 Thread Sheng Yong
Hi, Chao On 2018/9/19 9:28, Chao Yu wrote: Once quota file is corrupted, kernel will set CP_QUOTA_NEED_FSCK_FLAG into checkpoint pack, this patch makes fsck supporting to detect the flag and try to rebuild corrupted quota file. Signed-off-by: Chao Yu --- fsck/fsck.c | 3 ++-

Re: [f2fs-dev] [PATCH] fsck.f2fs: detect and recover corrupted quota file

2018-08-29 Thread Sheng Yong
Hi, Chao On 2018/8/29 20:09, Chao Yu wrote: Once quota file is corrupted, kernel will set CP_QUOTA_NEED_FSCK_FLAG into checkpoint pack, this patch makes fsck supporting to detect the flag and try to rebuild corrupted quota file. Do we need to drop recovery data? Recovery data is never checked

[f2fs-dev] [PATCH] f2fs: wake up gc thread immediately when gc_urgent is set

2018-08-04 Thread Sheng Yong
Fixes: 5b0e95398e2b ("f2fs: introduce sbi->gc_mode to determine the policy") Signed-off-by: Sheng Yong --- fs/f2fs/sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index f22782a0defe..cd2e030e47b8 100644 --- a/fs/f2fs/sysfs.c +++ b/fs

Re: [f2fs-dev] [PATCH] f2fs: check total CP pack block count correctly

2018-08-01 Thread Sheng Yong
On 2018/8/1 18:26, Chao Yu wrote: On 2018/8/1 15:36, Sheng Yong wrote: On 2018/8/1 14:56, Chao Yu wrote: Hi Sheng, On 2018/8/1 11:46, Sheng Yong wrote: Fixes: 652d19558a347 ('f2fs: fix to do sanity check with block address in main area') Reported-by: Zhang Xiaobo Signed-off-by: Sheng

Re: [f2fs-dev] [PATCH] f2fs: check total CP pack block count correctly

2018-08-01 Thread Sheng Yong
On 2018/8/1 14:56, Chao Yu wrote: Hi Sheng, On 2018/8/1 11:46, Sheng Yong wrote: Fixes: 652d19558a347 ('f2fs: fix to do sanity check with block address in main area') Reported-by: Zhang Xiaobo Signed-off-by: Sheng Yong That's my bad, and thanks for the fix. Do you mind merge

[f2fs-dev] [PATCH] f2fs: check total CP pack block count correctly

2018-07-31 Thread Sheng Yong
Fixes: 652d19558a347 ('f2fs: fix to do sanity check with block address in main area') Reported-by: Zhang Xiaobo Signed-off-by: Sheng Yong --- fs/f2fs/checkpoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 3587aa53dc90

Re: [f2fs-dev] [PATCH] fsck.f2fs: rebuild qf_ino if quota node is corrupted

2018-07-27 Thread Sheng Yong
On 2018/7/27 17:23, Jaegeuk Kim wrote: On 07/24, Sheng Yong wrote: Hi, Jaegeuk On 2018/7/23 20:49, Jaegeuk Kim wrote: On 07/23, Sheng Yong wrote: If a quota node is corrupted, it may be removed. But its qf_ino in super blocks is not cleared. To keep quota feature available, let's try

[f2fs-dev] [RFC PATCH v2] fsck.f2fs: rebuild qf_ino if quota node is unreachable

2018-07-26 Thread Sheng Yong
quota structures later. Signed-off-by: Sheng Yong --- v2->v1: calculate inode checksum when write quota inode, update commit msg --- fsck/fsck.c | 82 +--- fsck/fsck.h | 1 + fsck/mount.c | 7 +++-- 3 files changed, 84 insertions(+), 6 deleti

Re: [f2fs-dev] [PATCH] f2fs: quota: remove journalled project quota

2018-07-26 Thread Sheng Yong
Hi, Chao On 2018/7/26 19:38, Chao Yu wrote: On 2018/7/26 19:25, Sheng Yong wrote: Quota sysfiles are already using journalled method to save quota value. And non-journalled project quota is not supported by userspace tools. So there is no need to implement journalled project quota. Well

[f2fs-dev] [PATCH] f2fs: quota: remove journalled project quota

2018-07-26 Thread Sheng Yong
Quota sysfiles are already using journalled method to save quota value. And non-journalled project quota is not supported by userspace tools. So there is no need to implement journalled project quota. Signed-off-by: Sheng Yong --- Documentation/filesystems/f2fs.txt | 2 -- fs/f2fs/super.c

[f2fs-dev] [PATCH v2] f2fs: quota: fix incorrect comments

2018-07-26 Thread Sheng Yong
Signed-off-by: Sheng Yong --- fs/f2fs/checkpoint.c | 5 - fs/f2fs/super.c | 5 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 04841f32d4d9..581710760ba6 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c

Re: [f2fs-dev] [PATCH 3/3] f2fs: quota: fix incorrect error message and comments

2018-07-25 Thread Sheng Yong
On 2018/7/25 23:44, Chao Yu wrote: On 2018/7/24 20:17, Sheng Yong wrote: Signed-off-by: Sheng Yong --- fs/f2fs/checkpoint.c | 5 - fs/f2fs/recovery.c | 2 +- fs/f2fs/super.c | 5 + 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs

Re: [f2fs-dev] [PATCH RESEND] f2fs: fix to restrict mount condition when without CONFIG_QUOTA

2018-07-25 Thread Sheng Yong
Hi, Chao On 2018/7/26 7:19, Chao Yu wrote: From: Chao Yu Like quota_ino feature, we need to reject mounting RDWR with image which enables project_quota feature when there is no CONFIG_QUOTA be set in kernel. Signed-off-by: Chao Yu --- fs/f2fs/super.c | 6 ++ 1 file changed, 6

[f2fs-dev] [PATCH 2/3] f2fs: quota: decrease the lock granularity of statfs_project

2018-07-24 Thread Sheng Yong
According to fs/quota/dquot.c, `dq_data_lock' protects mem_dqinfo structures and modifications of dquot pointers in the inode, and `dquot->dq_dqb_lock' protects data from dq_dqb. We should use dquot->dq_dqb_lock in statfs_project instead of dq_dat_lock. Signed-off-by: Sheng Yong --- f

[f2fs-dev] [PATCH 1/3] f2fs: quota: do not mount as RDWR without QUOTA if quota feature enabled

2018-07-24 Thread Sheng Yong
If quota feature is enabled, quota is on by default. However, if CONFIG_QUOTA is not built in kernel, dquot entries will not get updated, which leads to quota inconsistency. Signed-off-by: Sheng Yong --- fs/f2fs/super.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff

[f2fs-dev] [PATCH 3/3] f2fs: quota: fix incorrect error message and comments

2018-07-24 Thread Sheng Yong
Signed-off-by: Sheng Yong --- fs/f2fs/checkpoint.c | 5 - fs/f2fs/recovery.c | 2 +- fs/f2fs/super.c | 5 + 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 9c29526a7633..9a0222d9e28c 100644 --- a/fs/f2fs/checkpoint.c

Re: [f2fs-dev] [PATCH] fsck.f2fs: rebuild qf_ino if quota node is corrupted

2018-07-23 Thread Sheng Yong
Hi, Jaegeuk On 2018/7/23 20:49, Jaegeuk Kim wrote: On 07/23, Sheng Yong wrote: If a quota node is corrupted, it may be removed. But its qf_ino in super blocks is not cleared. To keep quota feature available, let's try to rebuild a new quota node. Hi Sheng, IIRC, we need to rebuild whole

[f2fs-dev] [PATCH] fsck.f2fs: rebuild qf_ino if quota node is corrupted

2018-07-22 Thread Sheng Yong
If a quota node is corrupted, it may be removed. But its qf_ino in super blocks is not cleared. To keep quota feature available, let's try to rebuild a new quota node. Signed-off-by: Sheng Yong --- fsck/fsck.c | 82 +--- fsck/fsck.h | 1 + fsck

[f2fs-dev] [PATCH] fsck.f2fs: init quota_file before re-create quota file

2018-07-11 Thread Sheng Yong
`quota_handle->qh_qf->filesize' is not initialized by quota_create_file(). It contains random value, which is updated to quota file's i_size in quota_file_close(). Since quota file is re-created, `filesize' can be initialized as 0. Signed-off-by: Sheng Yong --- fsck/quotaio.c | 1 +

[f2fs-dev] [PATCH] f2fs-tools: set namelen parameter of convert_encrypted_name as unsigned

2018-07-10 Thread Sheng Yong
To avoid overflow, set namelen parameter of convert_encrypted_name as unsigned int. convert_encrypted_name() will check if namelen exceeds the limitation. Signed-off-by: Sheng Yong --- fsck/fsck.c | 6 +++--- fsck/fsck.h | 2 +- fsck/mount.c | 2 +- 3 files changed, 5 insertions(+), 5

Re: [f2fs-dev] [PATCH v2] fsck.f2fs: fix to do sanity check with extra_attr feature

2018-07-09 Thread Sheng Yong
Hi, Chao, On 2018/7/9 23:25, Chao Yu wrote: From: Chao Yu This patch tries to fix incorrect extra_attr bit or i_extra_isize value in fsck. Signed-off-by: Chao Yu --- v2: - fix to replace F2FS_INLINE_DATA with F2FS_EXTRA_ATTR. fsck/fsck.c | 18 +- 1 file changed, 17

Re: [f2fs-dev] [PATCH] f2fs-tools: avoid mounting f2fs if tools already open the device

2018-07-09 Thread Sheng Yong
Hi, Chao, On 2018/7/9 23:14, Chao Yu wrote: On 2018/7/4 17:50, Sheng Yong wrote: If the block device is opened by tools, F2FS should not be mounted. Especially when fsck is running, errors unexpected may happen. So if tools open a block device, we give it the O_EXCL flag to make sure the block

Re: [f2fs-dev] [PATCH 2/2] fsck.f2fs: check extra_attr feature

2018-07-08 Thread Sheng Yong
On 2018/7/9 10:15, Chao Yu wrote: Hi Sheng, On 2018/7/3 18:10, Sheng Yong wrote: Check extra_attr feature for inode. If it is corrupted, remove the inode. Could you check the patch: [PATCH] fsck.f2fs: fix to do sanity check with extra_attr feature Would it better to do sanity check

[f2fs-dev] [PATCH] f2fs-tools: avoid mounting f2fs if tools already open the device

2018-07-04 Thread Sheng Yong
If the block device is opened by tools, F2FS should not be mounted. Especially when fsck is running, errors unexpected may happen. So if tools open a block device, we give it the O_EXCL flag to make sure the block device is opened exclusivly. Signed-off-by: Sheng Yong --- lib/libf2fs.c | 27

[f2fs-dev] [PATCH 2/2] fsck.f2fs: check extra_attr feature

2018-07-03 Thread Sheng Yong
Check extra_attr feature for inode. If it is corrupted, remove the inode. Link: https://bugzilla.kernel.org/show_bug.cgi?id=200219 Reported-by: Wen Xu Signed-off-by: Sheng Yong --- fsck/fsck.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/fsck/fsck.c b/fsck/fsck.c index 15264b2

[f2fs-dev] [PATCH 1/2] fsck.f2fs: check extent of inline data/dentry inode

2018-07-03 Thread Sheng Yong
Check extent for inline data/dentry inode. If an inode contains inline data/dentry, it should have no extent. Link: https://bugzilla.kernel.org/show_bug.cgi?id=200175 Reported-by: Wen Xu Signed-off-by: Sheng Yong --- fsck/fsck.c | 16 +++- fsck/fsck.h | 1 + 2 files changed, 12

[f2fs-dev] [PATCH] fsck.f2fs: clear qf_ino if quota node is removed

2018-06-21 Thread Sheng Yong
If a quota node is corrupted, it may be removed. Then its qf_ino should also be removed. Signed-off-by: Sheng Yong --- fsck/fsck.c | 19 +-- fsck/fsck.h | 1 + fsck/mount.c | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c

[f2fs-dev] [PATCH v2] fsck.f2fs: introduce fsck_chk_curseg_info

2018-06-20 Thread Sheng Yong
If curseg is an empty segment, it will not be checked. This patch introduces fsck_chk_curseg_info() to check SIT/SSA type of cursegs to avoid curseg corruption. Signed-off-by: Sheng Yong --- v2: check c.fix_on and c.preen_mode before updating se->type fsck/fsck.c |

[f2fs-dev] [PATCH] f2fs-tools: do not count free_segs in flush_sit_entries

2018-06-13 Thread Sheng Yong
flush_sit_entries() is always called before write_checkpoint(). Since free_segs is counted in write_checkpoint, there is no need to do that in flush_sit_entries. Besides, the value of free_segs may be not correct if we skip uptodate seg_entries. Signed-off-by: Sheng Yong --- fsck/mount.c | 7

[f2fs-dev] [PATCH 1/2] sload.f2fs: update sit entries of cursegs

2018-06-12 Thread Sheng Yong
move_curseg_info->reset_curseg changes cursegs, however, new segment entries are not set as dirty. As a result, flush_sit_entries will not update entries in SIT, especially when an empty segment is selected as the new curseg, its seg_entry->type is lost. Signed-off-by: Sheng Yong ---

[f2fs-dev] [RFC PATCH 2/2] fsck.f2fs: introduce fsck_chk_curseg_info

2018-06-12 Thread Sheng Yong
If curseg is an empty segment, it will not be checked. This patch introduces fsck_chk_curseg_info() to check SIT/SSA type of cursegs to avoid curseg corruption. Signed-off-by: Sheng Yong --- fsck/fsck.c | 34 ++ fsck/fsck.h | 1 + fsck/main.c | 2 ++ 3 files

Re: [f2fs-dev] [PATCH] resize.f2fs: skip cursegs when finding next free block

2018-06-04 Thread Sheng Yong
Hi, Jaegeuk On 2018/6/5 4:55, Jaegeuk Kim wrote: On 06/04, Sheng Yong wrote: resize.f2fs (f2fs_defragment) tries to migrate blocks to new positions. However, if a curseg is selected, and f2fs_defragment is broken by any error, curseg->next_blkoff is left not updated. To avoid this, we s

[f2fs-dev] [PATCH] resize.f2fs: skip cursegs when finding next free block

2018-06-04 Thread Sheng Yong
resize.f2fs (f2fs_defragment) tries to migrate blocks to new positions. However, if a curseg is selected, and f2fs_defragment is broken by any error, curseg->next_blkoff is left not updated. To avoid this, we skip cursegs when finding next free block. Signed-off-by: Sheng Yong --- fsck/f2f

[f2fs-dev] [PATCH] f2fs: clear discard_wake earlier

2018-05-08 Thread Sheng Yong
If SBI_NEED_FSCK is set, discard_wake will never be cleared. As a result, the condition of wait_event_interruptible_timeout() is always true, which gets discard thread run too frequently. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fs/f2fs/segment.c | 7 --- 1 file chan

[f2fs-dev] [PATCH] f2fs: do not check F2FS_INLINE_DOTS in recover

2018-04-22 Thread Sheng Yong
Only dir may have F2FS_INLINE_DOTS flag, so there is no need to check the flag in recover flow. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fs/f2fs/recovery.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index 1b23d3febe4c..709dd4

[f2fs-dev] [PATCH] f2fs: remove duplicated dquot_initialize and fix error handling

2018-04-21 Thread Sheng Yong
This patch removes duplicated dquot_initialize in recover_orphan_inode(), and fix the error handling if dquot_initialize fails. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fs/f2fs/checkpoint.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/checkp

[f2fs-dev] [PATCH] f2fs: check if inmem_pages list is empty correctly

2018-04-17 Thread Sheng Yong
`cur' will never be NULL, we should check inmem_pages list instead. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fs/f2fs/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 5854cc4e1d67..bf9dab55b370 100644 --

[f2fs-dev] [PATCH 2/2] f2fs-tools: remove duplicated declaration of f2fs_configuration c

2018-04-09 Thread Sheng Yong
The variable `c' is declared twice in f2fs_fs.h. This patch removes the second declaration. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- include/f2fs_fs.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h index 2b0be2d..cbfdab5

[f2fs-dev] [PATCH v2 1/2] f2fs-tools: introduce new option V to show version

2018-04-09 Thread Sheng Yong
This patch introduces a new option -V to show the version of f2fs tools and exit after that. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- v2->v1: add -V for all f2fs tools fsck/main.c | 30 +- include/f2fs_fs.h | 6 +++

Re: [f2fs-dev] [PATCH] mkfs.f2fs: introduce new option V to show version

2018-04-09 Thread Sheng Yong
On 2018/4/10 1:55, Jaegeuk Kim wrote: On 04/08, Chao Yu wrote: On 2018/4/8 10:15, Sheng Yong wrote: This patch introduces a new option -V to show the version of mkfs.f2fs and exit after that. BTW, should we add -V for other misc tools? Yes, could you please add this for others? OK

[f2fs-dev] [PATCH] mkfs.f2fs: introduce new option V to show version

2018-04-07 Thread Sheng Yong
This patch introduces a new option -V to show the version of mkfs.f2fs and exit after that. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- mkfs/f2fs_format_main.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_

[f2fs-dev] [PATCH] resize.f2fs: clear CP_COMPACT_SUM_FLAG when rebuilding checkpoint

2018-04-07 Thread Sheng Yong
Resize rebuilds checkpoint with 6 summary blocks, so if CP_COMPACT_SUM_FLAG is set in the old checkpoint, clear it. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fsck/resize.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fsck/resize.c b/fsck/resize.c index 7643511..0

Re: [f2fs-dev] [PATCH 1/2] f2fs-tools: improve loggings

2018-03-18 Thread Sheng Yong
Hi, Ju Hyung and list, On 2018/3/17 23:04, Park Ju Hyung wrote: - Print errors and warnings to stderr - Print errors and warnings regardless of debugging level - Make info/error/warning logs consistent - Print POSIX errors when possible - Use more consistent terms and grammar Shall

[f2fs-dev] [RFC PATCH v5 3/3] ext4: do not allow mount with test_dummy_encryption if encrypt not set

2018-03-15 Thread Sheng Yong
When mounting with test_dummy_encryption option, if encrypt feature is not set, return fail instead of setting encrypt feature forcely. Cc: linux-e...@vger.kernel.org Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fs/ext4/super.c | 7 +++ 1 file changed, 3 insertions(+), 4 del

[f2fs-dev] [RFC PATCH v5 2/3] f2fs: introduce a new mount option test_dummy_encryption

2018-03-15 Thread Sheng Yong
This patch introduces a new mount option `test_dummy_encryption' to allow fscrypt to create a fake fscrypt context. This is used by xfstests. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- Documentation/filesystems/f2fs.txt | 2 ++ fs/f2fs/dir.c | 4 +++- f

  1   2   3   >