[f2fs-dev] [RFC PATCH 16/24] tests: add fsck testcase of fixing sit entry valid_map

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- tests/f_sit_bad_valid_map/README| 5 +++ tests/f_sit_bad_valid_map/expect.in | 35 tests/f_sit_bad_valid_map/script| 50 + 3 files changed, 90 insertions(+) create mode 100644 tests/f_sit_bad_valid_map/README

[f2fs-dev] [RFC PATCH 17/24] tests: add fsck testcase of fixing sum entry nid

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- tests/f_ssa_bad_nid/README| 5 tests/f_ssa_bad_nid/expect.in | 34 +++ tests/f_ssa_bad_nid/script| 44 +++ 3 files changed, 83 insertions(+) create mode 100644 tests/f_ssa_bad_nid/README create m

[f2fs-dev] [RFC PATCH 12/24] tests: add fsck testcase of fixing nat entry with invalid ino

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- tests/f_nat_bad_ino/README| 4 tests/f_nat_bad_ino/expect.in | 39 +++ tests/f_nat_bad_ino/script| 39 +++ 3 files changed, 82 insertions(+) create mode 100644 tests/f_nat_bad_ino/README

[f2fs-dev] [RFC PATCH 18/24] tests: add fsck testcase of fixing sum footer type

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- tests/f_ssa_bad_type/README| 5 + tests/f_ssa_bad_type/expect.in | 34 + tests/f_ssa_bad_type/script| 39 ++ 3 files changed, 78 insertions(+) create mode 100644 tests/f_ssa_bad_type/README cr

[f2fs-dev] [RFC PATCH 20/24] tests: add fsck testcase of fixing invalid i_addr

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- tests/f_inode_bad_iaddr/README| 6 tests/f_inode_bad_iaddr/expect.in | 38 tests/f_inode_bad_iaddr/script| 58 +++ 3 files changed, 102 insertions(+) create mode 100644 tests/f_inode_bad_iaddr/README cr

[f2fs-dev] [RFC PATCH 15/24] tests: add fsck testcase of fixing sit entry vblocks

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- tests/f_sit_bad_vblocks/README| 5 tests/f_sit_bad_vblocks/expect.in | 34 +++ tests/f_sit_bad_vblocks/script| 45 +++ 3 files changed, 84 insertions(+) create mode 100644 tests/f_sit_bad_vblocks/README

[f2fs-dev] [RFC PATCH 14/24] tests: add fsck testcase of fixing sit entry type

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- tests/f_sit_bad_type/README| 5 tests/f_sit_bad_type/expect.in | 34 + tests/f_sit_bad_type/script| 45 ++ 3 files changed, 84 insertions(+) create mode 100644 tests/f_sit_bad_type/README create

[f2fs-dev] [RFC PATCH 19/24] tests: add fsck testcase of fixing sum entry ofs_in_node

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- tests/f_ssa_bad_ofs_in_node/README| 5 +++ tests/f_ssa_bad_ofs_in_node/expect.in | 34 + tests/f_ssa_bad_ofs_in_node/script| 44 +++ 3 files changed, 83 insertions(+) create mode 100644 tests/f_ssa_bad_ofs_in_node

[f2fs-dev] [RFC PATCH 05/24] inject.f2fs: add member `feature' in inject_sb

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
This patch adds a new member `feature' in inject_sb to inject features. Signed-off-by: Sheng Yong --- fsck/inject.c | 5 + man/inject.f2fs.8 | 3 +++ 2 files changed, 8 insertions(+) diff --git a/fsck/inject.c b/fsck/inject.c index c3e68eb35246..c997334ec57d 100644 --- a/fsck/inject.c +

[f2fs-dev] [RFC PATCH 10/24] tests: add fsck testcase of fixing errors recorded in sb

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- tests/f_sb_errors/README| 5 tests/f_sb_errors/expect.in | 59 + tests/f_sb_errors/script| 23 +++ 3 files changed, 87 insertions(+) create mode 100644 tests/f_sb_errors/README create mode 100644 tests/f

[f2fs-dev] [RFC PATCH 13/24] tests: add fsck testcase of fixing nat entry with invalid blkaddr

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- tests/f_nat_bad_blkaddr/README| 4 tests/f_nat_bad_blkaddr/expect.in | 39 +++ tests/f_nat_bad_blkaddr/script| 35 +++ 3 files changed, 78 insertions(+) create mode 100644 tests/f_nat_bad_blkaddr/READ

[f2fs-dev] [RFC PATCH 03/24] fsck.f2fs: fix invalidate checkpoint

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
If one cp is invalidate, set CP_FSCK_FLAG to allow fixing cp at the end of check. Signed-off-by: Sheng Yong --- fsck/f2fs.h | 6 ++ fsck/mount.c | 11 --- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/fsck/f2fs.h b/fsck/f2fs.h index 187e73cf9aec..651a1f734281 1006

[f2fs-dev] [RFC PATCH 07/24] inject.f2fs: add member `filename' in inject_dentry

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
This patch adds a new member `filename' in inject_dentry to inject dentry filename. The dentry is specified by nid option. Note that `.' and `..' dentries are special, because they are not in the parent directory of nid. So this patch also adds a new option `--dots' to inject these two dentries.

[f2fs-dev] [RFC PATCH 23/24] tests: add fsck testcase of fixing duplicated dots

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- tests/f_dentry_dup_dots/README| 11 +++ tests/f_dentry_dup_dots/expect.in | 150 ++ tests/f_dentry_dup_dots/script| 58 3 files changed, 219 insertions(+) create mode 100644 tests/f_dentry_dup_dots/README create mo

[f2fs-dev] [RFC PATCH 24/24] tests: add fsck testcase of fixing loop fsync dnodes

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- tests/f_loop_fsync_dnodes/README | 39 + tests/f_loop_fsync_dnodes/expect.in | 40 ++ tests/f_loop_fsync_dnodes/imgs.tar.gz | Bin 0 -> 173228 bytes tests/f_loop_fsync_dnodes/script | 16 +++ 4 fi

[f2fs-dev] [RFC PATCH 09/24] tests: add fsck testcase of fixing bad super magic

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- tests/f_sb_bad_magic/README| 3 +++ tests/f_sb_bad_magic/expect.in | 40 ++ tests/f_sb_bad_magic/script| 16 ++ 3 files changed, 59 insertions(+) create mode 100644 tests/f_sb_bad_magic/README create mode 100644

[f2fs-dev] [RFC PATCH 11/24] tests: add fsck testcase of fixing cp crc

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- tests/f_cp_bad_crc/README| 5 tests/f_cp_bad_crc/expect.in | 22 + tests/f_cp_bad_crc/script| 46 3 files changed, 73 insertions(+) create mode 100644 tests/f_cp_bad_crc/README create mode 100644 te

[f2fs-dev] [RFC PATCH 02/24] dump.f2fs: print checkpoint crc

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- fsck/mount.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/fsck/mount.c b/fsck/mount.c index a189ba73e4bf..a09a974fc810 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -560,6 +560,7 @@ printout: void print_ckpt_info(struct f2fs_sb_info *sbi) { s

[f2fs-dev] [RFC PATCH 21/24] tests: add fsck testcase of fixing dentry hash code

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- tests/f_dentry_bad_hash/README| 8 tests/f_dentry_bad_hash/expect.in | 62 +++ tests/f_dentry_bad_hash/script| 71 +++ 3 files changed, 141 insertions(+) create mode 100644 tests/f_dentry_bad_hash/REA

[f2fs-dev] [RFC PATCH 01/24] f2fs-tools: add option N to answer no for all questions

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
In some scenarino, such as autotest, it is not expected to answer question from fsck or dump. To simply answer no to all these questions, this patch adds an option `N' to do that. Signed-off-by: Sheng Yong --- fsck/dump.c | 3 +++ fsck/fsck.c | 2 +- fsck/main.c | 14

[f2fs-dev] [RFC PATCH 06/24] inject.f2fs: add members in inject_node

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
This patch adds new members in inject_node to inject inode: * i_ext.fofs: extent fofs * i_ext.blk_addr: extent blk_addr * i_ext.len: extent len * i_inline_xattr_size: inline xattr size * i_compr_blocks: compression blocks Signed-off-by: Sheng Yong --- fsck/inject.c | 28

[f2fs-dev] [RFC PATCH 04/24] inject.f2fs: add members in inject_cp

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
The following members are add to inject more fields in cp: * next_blkaddr: inject fsync dnodes An error is returned if no fsync dnode is found. However, the injection is not supported on zoned device. This is because fsync dnodes must remains at the end of current warm node segnemt, any dnode ch

[f2fs-dev] [RFC PATCH 22/24] tests: add fsck testcase of fixing lost dots

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
Signed-off-by: Sheng Yong --- tests/f_dentry_lost_dots/README| 7 +++ tests/f_dentry_lost_dots/expect.in | 74 ++ tests/f_dentry_lost_dots/script| 46 +++ 3 files changed, 127 insertions(+) create mode 100644 tests/f_dentry_lost_dots/README c

[f2fs-dev] [RFC PATCH 00/24] f2fs-tools: add testcases

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
Hi, all This patchset tries to add an auto testsuit for f2fs-tools (fsck only for now). The basic idea of these testcases are: 1. create f2fs image 2. corrupt the image by inject specific fields 3. fsck fixes the image 4. verify fsck output with expected message Some helper scripts are provi

[f2fs-dev] [RFC PATCH 08/24] tests: prepare helper scripts for testcases

2024-10-29 Thread Sheng Yong via Linux-f2fs-devel
This patch addes helper scripts for auto testcases, and testcases of fsck will be submitted in the following commits. The basic idea of these testcases are: 1. create f2fs image 2. corrupt the image by inject specific fields 3. fsck fixes the corrupted image 4. verify fsck output with expected

[f2fs-dev] [PATCH] fsck.f2fs: fix incorrect parent blkaddr when adding lost dots

2024-10-23 Thread Sheng Yong via Linux-f2fs-devel
If dot or dotdot is lost, fsck tries to add a new dentry by f2fs_add_link(). The blkaddr of the directory inode should be passed to it in order to update the dirty inode at the right place. This patch fixes the uninitialized `blkaddr' to avoid corrupting f2fs image. Signed-off-by: Sheng Yong ---

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

2024-09-03 Thread Sheng Yong via Linux-f2fs-devel
Hi, Jaegeuk, I noticed that this commit is not queued in either dev or master branch. Do you have any comments on this commit :-) thanks, shengyong On 2024/7/4 10:57, Sheng Yong wrote: This patch enables injecting dentry block or dir entry. print_raw_dentry_info() is added to show values of no

[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
If a superblock failed in sanity check, it should be fixed. This patch add a new state `sb_invalid' to tell fsck needs to update superblock at the end of all checkings. This patch also cleans up force_stop, abnormal_stop, fs_errors and sb_invalid by merging them into an `invalid_sb' flags, and eac

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

[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/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..4c1d4d3c

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

2024-07-10 Thread Sheng Yong via Linux-f2fs-devel
On 2024/7/11 7:04, Jaegeuk Kim wrote: On 07/10, Jaegeuk Kim wrote: Hi Sheng, Can we have a list of tests to check the expected behavior of given inject.f2fs followed by fsck.f2fs? Hi, Jaegeuk, Yes, I'm working on the testcases of fsck.f2fs and inject.f2fs. The basic idea is: 1. creates an

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

2024-07-09 Thread Sheng Yong via Linux-f2fs-devel
When new_curseg() is allocating a new segment, if mode=fragment:xxx is switched on in large section scenario, __get_next_segno() will select the next segno randomly in the range of [0, maxsegno] in order to fragment segments. If the candidate segno is free, get_new_segment() will use it directly a

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

2024-07-08 Thread Sheng Yong via Linux-f2fs-devel
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. This patch fixes that to get the correct start segno. Fixes: 61461fc921b7 ("f2f

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

2024-07-07 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. This

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

2024-07-06 Thread Sheng Yong via Linux-f2fs-devel
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. This patch fixes that to get the correct start segno. Fixes: 61461fc921b7 ("f2f

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

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

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting dentry block or dir entry. print_raw_dentry_info() is added to show values of node footer. The meanings of options are: * dent: means dentry is injected. The members could be injected in cp contains: * d_bitmap: dentry block d_bitmap of nid * d_hash: dentry hash *

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

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
This patch 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 fsck or reproduce userspace behaviors of some a fault. If option `--dry-run' is used, n

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

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting sit entry. print_raw_sit_entry_info() is added to show values of the sit entry. The meanings of options are: * sit: means sit entry is injected, its argument chooses which sit pack to be injected, where 0 means the current valid sit is choosen automati

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

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting checkpoint. To archive this, a helper write_raw_cp_blocks() is added to write the first and last blocks of a specific cp. And print_ckpt_info() is exported to show new checkpoint info. The meanings of options are: * cp: means cp is injected, its argument chooses which

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

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
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 fsck or reproduce userspace behaviors of some a fault. If option `--dry-run' is used

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

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting nat entry. print_raw_nat_entry_info() is added to show values of the nat entry. The meanings of options are: * nat: means nat entry is injected, its argument chooses which nat pack to be injected, where 0 means the current valid nat is choosen automati

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

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting summary block or summary entry. print_raw_sum_entry_info() and print_sum_footer_info() are added to show values of the ssa entry and summary footer. The meanings of options are: * ssa: means ssa entry is injected. The members could be injected in cp contains: * entr

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

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting node block. print_node_footer_info() is added to show values of node footer. The meanings of options are: * node: means node is injected. The members could be injected in cp contains: * nid: node footer nid * ino: node footer ino * flag: node footer flag * cp_ver

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

2024-07-03 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting super block. The meanings of options are: * sb: means sb is injected, its argument chooses which sb pack to be injected, where 0 means the current valid sb is choosen automatically. * mb: indicates which member in sb is injected, its argument is the

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

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

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting super block. The meanings of options are: * sb: means sb is injected, its argument chooses which sb pack to be injected, where 0 means the current valid sb is choosen automatically. * mb: indicates which member in sb is injected, its argument is the

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

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
This patch 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 fsck or reproduce userspace behaviors of some a fault. If option `--dry-run' is used, n

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

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
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 fsck or reproduce userspace behaviors of some a fault. If option `--dry-run' is used

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

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting node block. print_node_footer_info() is added to show values of node footer. The meanings of options are: * node: means node is injected. The members could be injected in cp contains: * nid: node footer nid * ino: node footer ino * flag: node footer flag * cp_ver

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

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting dentry block or dir entry. print_raw_dentry_info() is added to show values of node footer. The meanings of options are: * dent: means dentry is injected. The members could be injected in cp contains: * d_bitmap: dentry block d_bitmap of nid * d_hash: dentry hash *

[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
This patch enables injecting nat entry. print_raw_nat_entry_info() is added to show values of the nat entry. The meanings of options are: * nat: means nat entry is injected, its argument chooses which nat pack to be injected, where 0 means the current valid nat is choosen automati

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

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting sit entry. print_raw_sit_entry_info() is added to show values of the sit entry. The meanings of options are: * sit: means sit entry is injected, its argument chooses which sit pack to be injected, where 0 means the current valid sit is choosen automati

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

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting checkpoint. To archive this, a helper write_raw_cp_blocks() is added to write the first and last blocks of a specific cp. And print_ckpt_info() is exported to show new checkpoint info. The meanings of options are: * cp: means cp is injected, its argument chooses which

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

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

2024-06-27 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting summary block or summary entry. print_raw_sum_entry_info() and print_sum_footer_info() are added to show values of the ssa entry and summary footer. The meanings of options are: * ssa: means ssa entry is injected. The members could be injected in cp contains: * entr

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

2024-06-25 Thread Sheng Yong via Linux-f2fs-devel
When new_curseg() is allocating a new segment, if mode=fragment:xxx is switched on in large section scenario, __get_next_segno() will select the next segno randomly in the range of [0, maxsegno] in order to fragment segments. If the candidate segno is free, get_new_segment() will use it directly a

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

2024-06-25 Thread Sheng Yong via Linux-f2fs-devel
If mode=fragment:xxx is enabled in large section mode, segno returned by __get_next_segno() may located in new section with different type, which messes up ssa type. This could be reproduced by the following steps: dd if=/dev/zero of=test.img bs=1M count=10240 mkfs.f2fs -s 128 test.img mount

[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
This patch enables injecting nat entry. print_raw_nat_entry_info() is added to show values of the nat entry. The meanings of options are: * nat: means nat entry is injected, its argument chooses which nat pack to be injected, where 0 means the current valid nat is choosen automati

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

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting summary block or summary entry. print_raw_sum_entry_info() and print_sum_footer_info() are added to show values of the ssa entry and summary footer. The meanings of options are: * ssa: means ssa entry is injected. The members could be injected in cp contains: * entr

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

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting sit entry. print_raw_sit_entry_info() is added to show values of the sit entry. The meanings of options are: * sit: means sit entry is injected, its argument chooses which sit pack to be injected, where 0 means the current valid sit is choosen automati

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

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting dentry block or dir entry. print_raw_dentry_info() is added to show values of node footer. The meanings of options are: * dent: means dentry is injected. The members could be injected in cp contains: * d_bitmap: dentry block d_bitmap of nid * d_hash: dentry hash *

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

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting checkpoint. To archive this, a helper update_checkpoint() is added to write specific cp. And print_ckpt_info() is exported to show new checkpoint info. The meanings of options are: * cp: means cp is injected, its argument chooses which cp pack to be injected, w

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

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
This patch 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 fsck or reproduce userspace behaviors of some a fault. If option `--dry-run' is used, n

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

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting super block. The meanings of options are: * sb: means sb is injected, its argument chooses which sb pack to be injected, where 0 means the current valid sb is choosen automatically. * mb: indicates which member in sb is injected, its argument is the

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

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
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 fsck or reproduce userspace behaviors of some a fault. If option `--dry-run' is used

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

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

2024-06-24 Thread Sheng Yong via Linux-f2fs-devel
This patch enables injecting node block. print_node_footer_info() is added to show values of node footer. The meanings of options are: * node: means node is injected. The members could be injected in cp contains: * nid: node footer nid * ino: node footer ino * flag: node footer flag * cp_ver

[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
If curseg is not the first segment in its zone, the zone is not empty, and it should not be reset. This issue could be reproduced by: modprobe null_blk nr_devices=1 zoned=1 zone_max_open=6 zone_max_active=6 zone_size=1024 gb=30 # /dev/vda is 4G mkfs.f2fs -m -c /dev/nullb0

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

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 dif

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 not that necessar

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

2024-04-08 Thread Sheng Yong via Linux-f2fs-devel
The "hot file extensions" list does not print properly. **Before** extension_count [0x 23 : 35] cold file extentsions [mp wm og jp ] [avi m4v m4p mkv ]

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

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

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

2023-06-12 Thread Sheng Yong via Linux-f2fs-devel
On 2023/6/13 6:14, Jaegeuk Kim wrote: Could you please check this version? https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/commit/?h=dev-test&id=9c84aad379019a0d86655bb50bd7b4bc92683c4b Hi, Jaegeuk, Thanks for cleaning it up. This version looks good to me. I tested it with

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 de

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

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

2023-06-11 Thread Sheng Yong via Linux-f2fs-devel
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. The argument of these two ioctls is `struct f2fs_extra_attr', which has three members: * field: indicates which field in extra attribute area is

[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..f8aa842b5d

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

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

[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/compr

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

[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 --- a/tool

[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
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 ioctls is `struct f2fs_extra_attr', which has three members: * field: indicates which field in extra attribute area is handled *

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-29 Thread Sheng Yong via Linux-f2fs-devel
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 ioctls is `struct f2fs_extra_attr', which has three members: * field: indicates which field in extra attribute area is handled *

[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 --- a/

[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/tool

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

2023-05-28 Thread Sheng Yong via Linux-f2fs-devel
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 ioctls is `struct f2fs_extra_attr', which has three members: * field: indicates which field in extra attribute area is handled *

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, Yangta

[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
This patch adds `level` in `struct f2fs_compr_option` to allow ioctl setting compression level. The first byte of original f2fs_compr_option indicates which algorithm is used. While the new f2fs_compr_option splits the first byte into two parts: * the MBS 4 bits indicate the version * the LBS

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

  1   2   >