[f2fs-dev] [PATCH] fsck.f2fs: check all-zero inline data with helper is_zeroed

2024-07-11 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- fsck/fsck.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index e2fb042d3dec..6cb02729aec7 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -1081,10 +1081,7 @@ check_next

[f2fs-dev] [PATCH] fsck.f2fs: update superblock if invalid

2024-07-11 Thread Sheng Yong via Linux-f2fs-devel
, and each of them is indicated using one bit. Signed-off-by: Sheng Yong --- fsck/fsck.c | 6 +++--- fsck/mount.c | 16 ++-- include/f2fs_fs.h | 11 --- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index b15931eba3a0

[f2fs-dev] [PATCH] f2fs-tools: show device info of sb->devs

2024-07-11 Thread Sheng Yong via Linux-f2fs-devel
Show multidevice infomation like the follwoing: devs[i].path[meta.img] devs[i].total_segments [0x 3f : 63] devs[i].path[data.img] devs[i].total_segments [0x 80 : 128] Signed-off-by: Sheng

[f2fs-dev] [PATCH] fsck.f2fs: fix checking wp of all devices

2024-07-11 Thread Sheng Yong via Linux-f2fs-devel
For zoned model, the first device (devices[0]) is not zoned device, whose zoned_model is not F2FS_ZONED_HM. Let's skip it and check write pointer of left devices continuously. Signed-off-by: Sheng Yong --- fsck/fsck.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsck

[f2fs-dev] [PATCH] f2fs-tools: cleanup is_sit_bitmap_set

2024-07-11 Thread Sheng Yong via Linux-f2fs-devel
Remove redundant function definition of is_sit_bitmap_set() and export it. Signed-off-by: Sheng Yong --- fsck/dump.c | 2 +- fsck/fsck.c | 12 fsck/fsck.h | 2 +- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/fsck/dump.c b/fsck/dump.c index 90e3e0e93c61

Re: [f2fs-dev] [RCF PATCH v3 00/10] f2fs-tools: introduce inject.f2fs

2024-07-10 Thread Sheng Yong via Linux-f2fs-devel
/#u Thanks for the fix. Thanks, shengyong Thanks, On 07/04, Sheng Yong wrote: This patchset introduces a new tool inject.f2fs to modify metadata or data (directory entry) of f2fs image offline flexibly. With inject.f2fs, it is easier to generate a corrupted f2fs image, which can help verify

[f2fs-dev] [PATCH v3] f2fs: only fragment segment in the same section

2024-07-09 Thread Sheng Yong via Linux-f2fs-devel
the next free segment. * if curseg is in the middle of the section, select candicate randomly in the range of [curseg + 1, last_seg_in_the_same_section] to keep type consistent. Reviewed-by: Chao Yu Signed-off-by: Sheng Yong --- v3: adjust `if (__is_large_section)' check v2: update c

[f2fs-dev] [PATCH v2] f2fs: fix start segno of large section

2024-07-08 Thread Sheng Yong via Linux-f2fs-devel
("f2fs: fix to avoid touching checkpointed data in get_victim()") Signed-off-by: Sheng Yong --- v2: use GET_SEC_FROM_SEG and GET_SEG_FROM_SEC to get start segno of section --- fs/f2fs/segment.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.h b/fs/f2fs

Re: [f2fs-dev] [PATCH] f2fs: fix start segno of large section

2024-07-08 Thread Sheng Yong via Linux-f2fs-devel
On 2024/7/8 14:09, Chao Yu wrote: On 2024/7/6 17:16, Sheng Yong wrote: get_ckpt_valid_blocks() checks valid ckpt blocks in current section. It counts all vblocks from the first to the last segment in the large section. However, START_SEGNO() is used to get the first segno in an SIT block

[f2fs-dev] [PATCH] f2fs: fix start segno of large section

2024-07-06 Thread Sheng Yong via Linux-f2fs-devel
("f2fs: fix to avoid touching checkpointed data in get_victim()") Signed-off-by: Sheng Yong --- fs/f2fs/segment.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index e1c0f418aa11..6ed5bc811d2c 100644 --- a/fs/f2fs/segment.h +++

[f2fs-dev] [RCF PATCH v3 01/10] f2fs-tools: export is_digits

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
Reviewed-by: Chao Yu Signed-off-by: Sheng Yong --- fsck/fsck.h | 3 +++ fsck/main.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/fsck/fsck.h b/fsck/fsck.h index 6cac926..4ca75b3 100644 --- a/fsck/fsck.h +++ b/fsck/fsck.h @@ -353,4 +353,7 @@ int update_inode(struct

[f2fs-dev] [RCF PATCH v3 09/10] inject.f2fs: add dentry injection

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
* d_ino: dentry ino * d_ftype: dentry ftype Signed-off-by: Sheng Yong --- fsck/inject.c | 184 ++ fsck/inject.h | 1 + 2 files changed, 185 insertions(+) diff --git a/fsck/inject.c b/fsck/inject.c index 2a21dae..a7d2a2c 100644 --- a/fsck

[f2fs-dev] [RCF PATCH v3 02/10] inject.f2fs: introduce inject.f2fs

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
, nothing really gets changed, and that could be used to get the value of a specified field. The following patches enable injecting each part of f2fs. Reviewed-by: Chao Yu Signed-off-by: Sheng Yong --- fsck/Makefile.am | 5 ++-- fsck/inject.c | 64

[f2fs-dev] [RCF PATCH v3 06/10] inject.f2fs: add sit injection

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
automatically. * blk: is the block address of the sit entry. The members could be injected in cp contains: * vblocks: sit entry vblocks * valid_map: sit entry valid_map * mtime: sit entry mtime Reviewed-by: Chao Yu Signed-off-by: Sheng Yong --- fsck/inject.c | 133

[f2fs-dev] [RCF PATCH v3 04/10] inject.f2fs: add cp injection

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
* cur_data_segno: cur_data_segno array * cur_data_blkoff: cur_data_blkoff array Reviewed-by: Chao Yu Signed-off-by: Sheng Yong --- fsck/fsck.h | 3 ++ fsck/inject.c | 127 ++ fsck/inject.h | 1 + fsck/main.c | 1 + fsck/mount.c | 26

[f2fs-dev] [RCF PATCH v3 00/10] f2fs-tools: introduce inject.f2fs

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
ct inode's dentry hash == inject.f2fs --dent --nid $INO --mb d_hash --val 0x12345 $DEV Info: inject dentry Info: inject nid 4 : 0x4 Info: inject member d_hash Info: inject value 74565 : 0x12345 [..] Info: inject dentry d_hash of nid 4: 0xc77b804e -> 0x12345 Sheng Yong (10): f2fs-tools: export is_digits

[f2fs-dev] [RCF PATCH v3 05/10] inject.f2fs: add nat injection

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
automatically. * nid: is the nid of the nat entry The members could be injected in cp contains: * version: nat entry version * ino: nat entry ino * block_addr: nat entry block_addr Reviewed-by: Chao Yu Signed-off-by: Sheng Yong --- fsck/inject.c | 122

[f2fs-dev] [RCF PATCH v3 07/10] inject.f2fs: add ssa injection

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
: * entry_type: summary block footer entry_type * check_sum: summary block footer check_sum * nid: summary entry nid * version: summary entry version * ofs_in_node: summary entry ofs_in_node Reviewed-by: Chao Yu Signed-off-by: Sheng Yong --- fsck/inject.c | 123

[f2fs-dev] [RCF PATCH v3 08/10] inject.f2fs: add node injection

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
i_inode_checksum * i_addr: inode i_addr array * i_nid: inode i_nid array * addr: {in}direct node nid/addr array Reviewed-by: Chao Yu Signed-off-by: Sheng Yong --- fsck/inject.c | 213 ++ fsck/inject.h | 1 + 2 files changed, 214 insertions(+) diff --git

[f2fs-dev] [RCF PATCH v3 03/10] inject.f2fs: add sb injection

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
: magic number * s_stop_reason: s_stop_reason array * s_errors: s_errors array * devs.path: path in devs array Signed-off-by: Sheng Yong --- fsck/inject.c | 140 +- fsck/inject.h | 5 ++ fsck/main.c | 5 +- fsck/mount.c | 4 +- 4 files

[f2fs-dev] [RCF PATCH v3 10/10] man: add inject.f2fs man page

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
Reviewed-by: Chao Yu Signed-off-by: Sheng Yong --- man/Makefile.am | 2 +- man/inject.f2fs.8 | 225 ++ 2 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 man/inject.f2fs.8 diff --git a/man/Makefile.am b/man/Makefile.am index

[f2fs-dev] [RFC PATCH v2 03/10] inject.f2fs: add sb injection

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
: magic number * s_stop_reason: s_stop_reason array * s_errors: s_errors array * devs.path: path in devs array Signed-off-by: Sheng Yong --- fsck/inject.c | 134 +- fsck/inject.h | 5 ++ fsck/main.c | 5 +- 3 files changed, 142 insertions

[f2fs-dev] [RFC PATCH v2 02/10] inject.f2fs: introduce inject.f2fs

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
, nothing really gets changed, and that could be used to get the value of a specified field. The following patches enable injecting each part of f2fs. Signed-off-by: Sheng Yong --- fsck/Makefile.am | 5 ++-- fsck/inject.c | 64 +++ fsck/inject.h

[f2fs-dev] [RFC PATCH v2 00/10] f2fs-tools: introduce inject.f2fs

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
ent --nid $INO --mb d_hash --val 0x12345 $DEV Info: inject dentry Info: inject nid 4 : 0x4 Info: inject member d_hash Info: inject value 74565 : 0x12345 [..] Info: inject dentry d_hash of nid 4: 0xc77b804e -> 0x12345 Sheng Yong (10): f2fs-tools: export is_digits inject.f2fs: introduce inject.f2fs

[f2fs-dev] [RFC PATCH v2 08/10] inject.f2fs: add node injection

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
i_inode_checksum * i_addr: inode i_addr array * i_nid: inode i_nid array * addr: {in}direct node nid/addr array Signed-off-by: Sheng Yong --- fsck/inject.c | 213 ++ fsck/inject.h | 1 + 2 files changed, 214 insertions(+) diff --git a/fsck/inject.c b/fsck

[f2fs-dev] [RFC PATCH v2 09/10] inject.f2fs: add dentry injection

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
* d_ino: dentry ino * d_ftype: dentry ftype Signed-off-by: Sheng Yong --- fsck/inject.c | 179 ++ fsck/inject.h | 1 + 2 files changed, 180 insertions(+) diff --git a/fsck/inject.c b/fsck/inject.c index c48728e..bae9afb 100644 --- a/fsck

[f2fs-dev] [RFC PATCH v2 10/10] man: add inject.f2fs man page

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- man/Makefile.am | 2 +- man/inject.f2fs.8 | 225 ++ 2 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 man/inject.f2fs.8 diff --git a/man/Makefile.am b/man/Makefile.am index 9363b82..b78344a 100644

[f2fs-dev] [RFC PATCH v2 05/10] inject.f2fs: add nat injection

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
automatically. * nid: is the nid of the nat entry The members could be injected in cp contains: * version: nat entry version * ino: nat entry ino * block_addr: nat entry block_addr Signed-off-by: Sheng Yong --- fsck/inject.c | 119 ++ fsck/inject.h

[f2fs-dev] [RFC PATCH v2 06/10] inject.f2fs: add sit injection

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
automatically. * blk: is the block address of the sit entry. The members could be injected in cp contains: * vblocks: sit entry vblocks * valid_map: sit entry valid_map * mtime: sit entry mtime Signed-off-by: Sheng Yong --- fsck/inject.c | 130

[f2fs-dev] [RFC PATCH v2 04/10] inject.f2fs: add cp injection

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
* cur_data_segno: cur_data_segno array * cur_data_blkoff: cur_data_blkoff array Signed-off-by: Sheng Yong --- fsck/fsck.h | 3 ++ fsck/inject.c | 125 ++ fsck/inject.h | 1 + fsck/main.c | 1 + fsck/mount.c | 26 +++ 5 files

[f2fs-dev] [RFC PATCH v2 01/10] f2fs-tools: export is_digits

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- fsck/fsck.h | 3 +++ fsck/main.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/fsck/fsck.h b/fsck/fsck.h index 6cac926..4ca75b3 100644 --- a/fsck/fsck.h +++ b/fsck/fsck.h @@ -353,4 +353,7 @@ int update_inode(struct f2fs_sb_info *sbi, struct

[f2fs-dev] [RFC PATCH v2 07/10] inject.f2fs: add ssa injection

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
: * entry_type: summary block footer entry_type * check_sum: summary block footer check_sum * nid: summary entry nid * version: summary entry version * ofs_in_node: summary entry ofs_in_node Signed-off-by: Sheng Yong --- fsck/inject.c | 123 ++ fsck

[f2fs-dev] [PATCH v2] f2fs: only fragment segment in the same section

2024-06-25 Thread Sheng Yong via Linux-f2fs-devel
the next free segment. * if curseg is in the middle of the secion, select candicate randomly in the range of [curseg + 1, last_seg_in_the_same_section] to keep type consistent. Signed-off-by: Sheng Yong --- v2: update commit msg --- fs/f2fs/segment.c | 15 +-- 1 file ch

[f2fs-dev] [PATCH] f2fs: only fragment segment in the same section

2024-06-25 Thread Sheng Yong via Linux-f2fs-devel
order to allow simulate segment fragmentation in large section mode, this patch limits the random range within the same section. Signed-off-by: Sheng Yong --- fs/f2fs/segment.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c

[f2fs-dev] [RFC PATCH 10/10] man: add inject.f2fs man page

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- man/Makefile.am | 2 +- man/inject.f2fs.8 | 225 ++ 2 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 man/inject.f2fs.8 diff --git a/man/Makefile.am b/man/Makefile.am index 9363b82..b78344a 100644

[f2fs-dev] [RFC PATCH 05/10] inject.f2fs: add nat injection

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
automatically. * nid: is the nid of the nat entry The members could be injected in cp contains: * version: nat entry version * ino: nat entry ino * block_addr: nat entry block_addr Signed-off-by: Sheng Yong --- fsck/inject.c | 119 ++ fsck/inject.h

[f2fs-dev] [RFC PATCH 07/10] inject.f2fs: add ssa injection

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
: * entry_type: summary block footer entry_type * check_sum: summary block footer check_sum * nid: summary entry nid * version: summary entry version * ofs_in_node: summary entry ofs_in_node Signed-off-by: Sheng Yong --- fsck/inject.c | 123 ++ fsck

[f2fs-dev] [RFC PATCH 06/10] inject.f2fs: add sit injection

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
automatically. * blk: is the block address of the sit entry. The members could be injected in cp contains: * vblocks: sit entry vblocks * valid_map: sit entry valid_map * mtime: sit entry mtime Signed-off-by: Sheng Yong --- fsck/inject.c | 130

[f2fs-dev] [RFC PATCH 09/10] inject.f2fs: add dentry injection

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
* d_ino: dentry ino * d_ftype: dentry ftype Signed-off-by: Sheng Yong --- fsck/inject.c | 148 ++ fsck/inject.h | 1 + 2 files changed, 149 insertions(+) diff --git a/fsck/inject.c b/fsck/inject.c index 20ae87c..3d26b25 100644 --- a/fsck

[f2fs-dev] [RFC PATCH 04/10] inject.f2fs: add cp injection

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
array * cur_data_blkoff: cur_data_blkoff array Signed-off-by: Sheng Yong --- fsck/fsck.h | 2 + fsck/inject.c | 124 ++ fsck/inject.h | 1 + fsck/main.c | 1 + fsck/mount.c | 6 +++ 5 files changed, 134 insertions(+) diff --git

[f2fs-dev] [RFC PATCH 02/10] inject.f2fs: introduce inject.f2fs

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
, nothing really gets changed, and that could be used to get the value of a specified field. The following patches enable injecting each part of f2fs. Signed-off-by: Sheng Yong --- fsck/Makefile.am | 5 ++-- fsck/inject.c | 64 +++ fsck/inject.h

[f2fs-dev] [RFC PATCH 03/10] inject.f2fs: add sb injection

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
: magic number * s_stop_reason: s_stop_reason array * s_errors: s_errors array * devs.path: path in devs array Signed-off-by: Sheng Yong --- fsck/inject.c | 134 +- fsck/inject.h | 5 ++ fsck/main.c | 5 +- 3 files changed, 142 insertions

[f2fs-dev] [RFC PATCH 00/10] f2fs-tools: introduce inject.f2fs

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
INO --mb d_hash --val 0x12345 $DEV Info: inject dentry Info: inject nid 4 : 0x4 Info: inject member d_hash Info: inject value 74565 : 0x12345 [..] Info: inject dentry d_hash of nid 4: 0xc77b804e -> 0x12345 Sheng Yong (10): f2fs-tools: export is_digits inject.f2fs: introduce inject.f2fs i

[f2fs-dev] [RFC PATCH 01/10] f2fs-tools: export is_digits

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- fsck/fsck.h | 3 +++ fsck/main.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/fsck/fsck.h b/fsck/fsck.h index 6cac926..4ca75b3 100644 --- a/fsck/fsck.h +++ b/fsck/fsck.h @@ -353,4 +353,7 @@ int update_inode(struct f2fs_sb_info *sbi, struct

[f2fs-dev] [RFC PATCH 08/10] inject.f2fs: add node injection

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
i_inode_checksum * i_addr: inode i_addr array * i_nid: inode i_nid array * addr: {in}direct node nid/addr array Signed-off-by: Sheng Yong --- fsck/inject.c | 209 ++ fsck/inject.h | 1 + 2 files changed, 210 insertions(+) diff --git a/fsck/inject.c b/fsck

[f2fs-dev] [PATCH v2] f2fs: alloc new section if curseg is not the first seg in its zone

2024-05-30 Thread Sheng Yong via Linux-f2fs-devel
If curseg is not the first segment in its zone, the zone is not empty. A new section should be allocated and avoid resetting the old zone. Reviewed-by: Chao Yu Signed-off-by: Sheng Yong --- v2: remove and update inaccurate commit msg --- fs/f2fs/segment.c | 3 ++- 1 file changed, 2 insertions

[f2fs-dev] [PATCH] f2fs: avoid resetting non empty zone

2024-05-29 Thread Sheng Yong via Linux-f2fs-devel
/testfile': Input/output error Signed-off-by: Sheng Yong --- fs/f2fs/segment.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 4c8836ded90fc..50b38cbe33401 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -5004,7 +5004,8

[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:

  1   2   3   >