[f2fs-dev] [PATCH 4/4] fsck.f2fs: support quota

2017-10-30 Thread Jaegeuk Kim
From: Hyojun Kim This patch let fsck to check and fix quota file contents. Signed-off-by: Hyojun Kim Signed-off-by: Jaegeuk Kim --- fsck/Makefile.am|3 +- fsck/common.h | 30 + fsck/dict.c | 1501

[f2fs-dev] [PATCH 2/4] f2fs-tools: f2fs_read() and f2fs_filesize_update() are added

2017-10-30 Thread Jaegeuk Kim
From: Hyojun Kim This patch adds f2fs_read() and f2fs_filesize_update(). It also refactors f2fs_write_block() and renamed as f2fs_write(). Signed-off-by: Hyojun Kim Signed-off-by: Jaegeuk Kim --- fsck/fsck.h| 6 ++

[f2fs-dev] [PATCH 3/4] mkfs.f2fs: support quota option in mkfs

2017-10-30 Thread Jaegeuk Kim
From: Hyojun Kim This patch let mkfs to handle quota option and create quota files. Signed-off-by: Hyojun Kim Signed-off-by: Jaegeuk Kim --- include/f2fs_fs.h | 21 +++- include/quota.h | 77 ++

[f2fs-dev] [PATCH 1/4] sload.f2fs: fix bugs in f2fs_write_block()

2017-10-30 Thread Jaegeuk Kim
From: Hyojun Kim Found and fixed following three bugs in f2fs_write_block() function. - Write (4096 - offset) bytes for the first block even for small count. - For overwriting, found blkaddr is not used for writing. - dn.idirty status can be lost by set_new_dnode(). -

[f2fs-dev] [PATCH 2/2] f2fs: support quota sys files

2017-10-30 Thread Jaegeuk Kim
This patch supports hidden quota files in the system, which will be used for Android. It requires up-to-date f2fs-tools later than v1.9.0. Signed-off-by: Jaegeuk Kim --- fs/f2fs/checkpoint.c | 9 +++- fs/f2fs/f2fs.h | 9 +++- fs/f2fs/recovery.c | 8 ++-

[f2fs-dev] [PATCH 1/2] f2fs: add quota_ino feature infra

2017-10-30 Thread Jaegeuk Kim
This patch adds quota_ino feature infra to be used for quota files. Signed-off-by: Jaegeuk Kim --- fs/f2fs/f2fs.h | 6 ++ fs/f2fs/sysfs.c | 7 +++ include/linux/f2fs_fs.h | 6 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git

Re: [f2fs-dev] [PATCH v2] f2fs: add bug_on when f2fs_gc even fails to get one victim

2017-10-30 Thread Yunlong Song
So it seems it is really useful to add this bug_on in gc. On 2017/10/31 11:17, Chao Yu wrote: On 2017/10/31 9:32, Yunlong Song wrote: I think there may be bugs somewhere, since no victim is selected but it really needs gc. What is the size of the data image? I have providered the testcase,

Re: [f2fs-dev] [PATCH v2] f2fs: add bug_on when f2fs_gc even fails to get one victim

2017-10-30 Thread Chao Yu
On 2017/10/31 9:32, Yunlong Song wrote: > I think there may be bugs somewhere, since no victim is selected but it > really needs gc. > What is the size of the data image? I have providered the testcase, could you check that? I can hit this bugon with generic/015 of fstest easily, could

Re: [f2fs-dev] [PATCH v2] f2fs: collect prefree segments to avoild write checkpoint fail

2017-10-30 Thread Chao Yu
On 2017/10/31 10:05, Yunlong Song wrote: > So I use CHECK_FS config to control it. When CHECK_FS is off, all the > other f2fs_bug_on also > only printk WARNING info rather than trigger BUG_ON. If this runing out-of-free-segments issue explicitly happens, IMO, its better to face and fix it. BTW,

Re: [f2fs-dev] [PATCH v2] f2fs: collect prefree segments to avoild write checkpoint fail

2017-10-30 Thread Yunlong Song
So I use CHECK_FS config to control it. When CHECK_FS is off, all the other f2fs_bug_on also only printk WARNING info rather than trigger BUG_ON. On 2017/10/31 9:59, Chao Yu wrote: On 2017/10/31 9:33, Yunlong Song wrote: ping... On 2017/9/1 20:00, Yunlong Song wrote: In come corner case,

Re: [f2fs-dev] [PATCH v2] f2fs: collect prefree segments to avoild write checkpoint fail

2017-10-30 Thread Chao Yu
On 2017/10/31 9:33, Yunlong Song wrote: > ping... > > On 2017/9/1 20:00, Yunlong Song wrote: >> In come corner case, the reserved segments are used to do gc, and there are >> not enough free segments for write checkpoint to finish its job, then the >> gc process will fail to change the prefree

[f2fs-dev] [RFC PATCH 4/8] dump.f2fs: introduce dump_xattr

2017-10-30 Thread Sheng Yong
This patch introduces dump_xattr to create xattrs for dumped files. Signed-off-by: Sheng Yong --- fsck/dump.c | 63 ++--- 1 file changed, 60 insertions(+), 3 deletions(-) diff --git a/fsck/dump.c b/fsck/dump.c index

[f2fs-dev] [RFC PATCH 2/8] fsck.f2fs: do not fix corrupted nat entries in build_nat_area_bitmap

2017-10-30 Thread Sheng Yong
Fixing corrupted data depends on c.fix_on. If it's not set, we should not force fixing corrupted data. So if nat entries are found invalid when building nat_area_bitmap, we should just set c.bug_on, and fix it later. Signed-off-by: Sheng Yong --- fsck/mount.c | 21

[f2fs-dev] [RFC PATCH 5/8] dump.f2fs: do not dump encrypted files

2017-10-30 Thread Sheng Yong
If a file is encrypted, its content is cipher text on the storage. So there is no need to dump an encrypted file. Signed-off-by: Sheng Yong --- fsck/dump.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/fsck/dump.c b/fsck/dump.c index

[f2fs-dev] [RFC PATCH 1/8] fsck.f2fs: do not set fix_on directly

2017-10-30 Thread Sheng Yong
Do not set fix_on if it is allowed by user. Signed-off-by: Sheng Yong --- fsck/main.c | 2 +- fsck/mount.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsck/main.c b/fsck/main.c index c9411eb..93037e1 100644 --- a/fsck/main.c +++ b/fsck/main.c

[f2fs-dev] [RFC PATCH 3/8] dump/fsck: introduce print_xattr_entry

2017-10-30 Thread Sheng Yong
This patch exports read_all_xattrs to allow dump/fsck to get all xattrs, and introduces print_xattr_entry which tries to parse an xattr entry accroding to its xattr index. Signed-off-by: Sheng Yong --- fsck/dump.c | 18 - fsck/fsck.h | 7 +++- fsck/mount.c |

[f2fs-dev] [RFC PATCH 7/8] fsck.f2fs: introduce sanity_check_inode

2017-10-30 Thread Sheng Yong
f2fs_iget checks if i_mode is valid. If it is not, the file cannot be accessed as well as deleted. To make sure such files can be removed, fsck adds the same check, and removes incorrect inode blocks. Signed-off-by: Sheng Yong --- fsck/fsck.c | 21 +

[f2fs-dev] [RFC PATCH 8/8] f2fs-tools: remove unused list.h

2017-10-30 Thread Sheng Yong
Commit 7d96d138a378 ("fsck.f2fs: remove list.h") has already the usage of list.h. So let's remove list.h itself. Signed-off-by: Sheng Yong --- include/list.h | 88 -- 1 file changed, 88 deletions(-) delete mode

[f2fs-dev] [RFC PATCH 6/8] fsck.f2fs: introduce new option --dry-run

2017-10-30 Thread Sheng Yong
With --dry-run enabled, fsck.f2fs will do all checks and "fixes" except that all fixes will not be written to storage at last. Signed-off-by: Sheng Yong --- fsck/main.c | 14 +- include/f2fs_fs.h | 1 + lib/libf2fs.c | 1 + lib/libf2fs_io.c | 3

Re: [f2fs-dev] [PATCH v2] f2fs: collect prefree segments to avoild write checkpoint fail

2017-10-30 Thread Yunlong Song
ping... On 2017/9/1 20:00, Yunlong Song wrote: In come corner case, the reserved segments are used to do gc, and there are not enough free segments for write checkpoint to finish its job, then the gc process will fail to change the prefree segments to free segments. Signed-off-by: Yunlong Song

Re: [f2fs-dev] [PATCH v2] f2fs: add bug_on when f2fs_gc even fails to get one victim

2017-10-30 Thread Yunlong Song
I think there may be bugs somewhere, since no victim is selected but it really needs gc. What is the size of the data image? On 2017/10/16 11:25, Chao Yu wrote: On 2017/10/14 20:34, Yunlong Song wrote: Do you mean check out-of-space test? I have tried that but no bugon. Yes, test recent f2fs

[f2fs-dev] [PATCH] f2fs: don't bother with inode->i_version

2017-10-30 Thread Jeff Layton
From: Jeff Layton f2fs does not set the SB_I_VERSION flag, so the i_version will never be incremented on write. It was recently changed to increment the i_version on a quota write, which isn't necessary here. Signed-off-by: Jeff Layton ---

[f2fs-dev] [PATCH v2] f2fs: fix out-of-free problem caused by atomic write

2017-10-30 Thread Yunlong Song
f2fs_balance_fs only actives once in the commit_inmem_pages, but there are more than one page to commit, so all the other pages will miss the check. This will lead to out-of-free problem when commit a very large file. However, we cannot do f2fs_balance_fs for each inmem page, since this will break

Re: [f2fs-dev] [PATCH] f2fs: add a function to move nid

2017-10-30 Thread Fan Li
> -Original Message- > From: Jaegeuk Kim [mailto:jaeg...@kernel.org] > Sent: Monday, October 30, 2017 5:30 PM > To: Chao Yu > Cc: Fan Li; 'Chao Yu'; linux-ker...@vger.kernel.org; > linux-f2fs-devel@lists.sourceforge.net > Subject: Re: [f2fs-dev] [PATCH] f2fs: add a function to move nid

[f2fs-dev] [PATCH 1/2] f2fs: use rw_semaphore to protect SIT cache

2017-10-30 Thread Chao Yu
There are some cases user didn't update SIT cache under this lock, so let's use rw_semaphore instead of mutex to enhance concurrently accessing. Signed-off-by: Chao Yu --- fs/f2fs/gc.c | 12 ++-- fs/f2fs/segment.c | 34 +++---

[f2fs-dev] [PATCH 2/2] f2fs: check curseg space before foreground GC

2017-10-30 Thread Chao Yu
When we are closing to trigger foreground GC, if there are only a few of dirty metas, we can log these dirty metas in left space of opened segments instead of triggering foreground GC. With this patch, total count of foreground GC triggered by test/generic/* of fstest suit reduce from 254 to 184.

Re: [f2fs-dev] [PATCH 2/2] f2fs: relax EIO injection for quota file

2017-10-30 Thread Chao Yu
On 2017/10/30 17:21, Jaegeuk Kim wrote: > On 10/28, Chao Yu wrote: >> Hi Jaegeuk, >> >> On 2017/10/23 0:51, Jaegeuk Kim wrote: >>> On 10/22, Chao Yu wrote: On 2017/10/20 0:56, Jaegeuk Kim wrote: > This case is not happening easily. Actually it can happen, so why not just keep

Re: [f2fs-dev] [PATCH] f2fs: optimize __update_nat_bits

2017-10-30 Thread Chao Yu
On 2017/10/30 15:19, Fan Li wrote: > Make three modification for __update_nat_bits: > 1. Take the codes of dealing the nat with nid 0 out of the loop > Such nat only needs to be dealt with once at beginning. > 2. Use " nat_index == 0" instead of " start_nid == 0" to decide if it's the > first

Re: [f2fs-dev] [PATCH v4] f2fs: modify for accurate fggc node io stat

2017-10-30 Thread Chao Yu
On 2017/10/30 14:18, Yunlei He wrote: > modify for accurate fggc node io stat > > Signed-off-by: Yunlei He Reviewed-by: Chao Yu Thanks, > --- > fs/f2fs/node.c | 62 > +- > 1 file changed, 31

Re: [f2fs-dev] [PATCH v2 RESEND] Revert "f2fs: handle dirty segments inside refresh_sit_entry"

2017-10-30 Thread Jaegeuk Kim
On 10/30, Chao Yu wrote: > On 2017/10/30 9:33, Yunlong Song wrote: > > This reverts commit 5e443818fa0b2a2845561ee25bec181424fb2889 > > > > The commit should be reverted because call sequence of below two parts > > of code must be kept: > > a. update sit information, it needs to be updated before

Re: [f2fs-dev] [PATCH] f2fs: add a function to move nid

2017-10-30 Thread Jaegeuk Kim
On 10/28, Chao Yu wrote: > On 2017/10/28 19:03, Fan Li wrote: > > This patch add a new function to move nid from one state to another. > > Move operation is heavily used, by adding a new function for it > > we can cut down some branches from several flow. > > > > > > Signed-off-by: Fan li

Re: [f2fs-dev] [PATCH 2/2] f2fs: relax EIO injection for quota file

2017-10-30 Thread Jaegeuk Kim
On 10/28, Chao Yu wrote: > Hi Jaegeuk, > > On 2017/10/23 0:51, Jaegeuk Kim wrote: > > On 10/22, Chao Yu wrote: > >> On 2017/10/20 0:56, Jaegeuk Kim wrote: > >>> This case is not happening easily. > >> > >> Actually it can happen, so why not just keep it? > > > > Okay, so let me keep this patch

[f2fs-dev] [PATCH] f2fs: optimize __update_nat_bits

2017-10-30 Thread Fan Li
Make three modification for __update_nat_bits: 1. Take the codes of dealing the nat with nid 0 out of the loop Such nat only needs to be dealt with once at beginning. 2. Use " nat_index == 0" instead of " start_nid == 0" to decide if it's the first nat block It's better that we don't

[f2fs-dev] [PATCH v4] f2fs: modify for accurate fggc node io stat

2017-10-30 Thread Yunlei He
modify for accurate fggc node io stat Signed-off-by: Yunlei He --- fs/f2fs/node.c | 62 +- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index f44d837..1552c6a 100644