[f2fs-dev] [PATCH RFC] fsck.f2fs: write checkpoint out of place first

2018-07-24 Thread Weichao Guo
We may encounter both checkpoints invalid in such a case: 1. write checkpoint A, B, C; 2. sudden power-cut during write checkpoint D; 3. fsck changes the total block count of checkpoint C; 4. sudden power-cut during fsck write checkpoint C in place - - | ver C |

[f2fs-dev] [PATCH] f2fs: add a new mount option "errors_mode"

2018-07-24 Thread Yunlei He
This patch add a new mount option "errors_mode" to adjust fs disposing cp error policy. Now supports "panic", "remount-ro", and "continue". Signed-off-by: Yunlei He --- Documentation/filesystems/f2fs.txt | 2 ++ fs/f2fs/checkpoint.c | 11 +++ fs/f2fs/f2fs.h

[f2fs-dev] [PATCH v2] f2fs: clear victim_secmap when section has full valid blocks

2018-07-24 Thread Yunlong Song
Without this patch, f2fs only clears victim_secmap when it finds out that the section has no valid blocks at all, but forgets to clear the victim_secmap when the whole section has full valid blocks. Signed-off-by: Yunlong Song --- fs/f2fs/segment.c | 3 ++- 1 file changed, 2 insertions(+), 1 del

[f2fs-dev] [PATCH] f2fs: fix 32-bit format string warning

2018-07-24 Thread Arnd Bergmann
On 32-bit targets, size_t is often 'unsigned int', so printing it as %lu causes a warning: fs/f2fs/inode.c: In function 'sanity_check_inode': fs/f2fs/inode.c:247:4: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'unsigned int' [-Werror=format=] The corr

Re: [f2fs-dev] [PATCH v2] f2fs: clear victim_secmap when section has full valid blocks

2018-07-24 Thread Chao Yu
On 2018/7/24 17:27, Yunlong Song wrote: > Without this patch, f2fs only clears victim_secmap when it finds out > that the section has no valid blocks at all, but forgets to clear the > victim_secmap when the whole section has full valid blocks. Look this patch again, I have a question, why bggc se

Re: [f2fs-dev] [PATCH v2] f2fs: clear victim_secmap when section has full valid blocks

2018-07-24 Thread Yunlong Song
Just in case, or maybe this patch should be put after [patch 2/5],which let BG_GC avoids skipping BG_GC victim, then SSR can also select the BG_GC victim to allocate data blocks, which can make bggc selected section get back to full state. On 2018/7/24 17:36, Chao Yu wrote: On 2018/7/24 17:27,

[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

[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 --- fs/f2fs/sup

Re: [f2fs-dev] [PATCH 2/5] f2fs: add cur_victim_sec for BG_GC to avoid skipping BG_GC victim

2018-07-24 Thread Chao Yu
On 2018/7/23 22:10, Yunlong Song wrote: > If f2fs aborts BG_GC, then the section bit of victim_secmap will be set, > which will cause the section skipped in the future get_victim of BG_GC. > In a worst case that each section in the victim_secmap is set and there > are enough free sections (so FG_GC

Re: [f2fs-dev] [PATCH 2/5] f2fs: add cur_victim_sec for BG_GC to avoid skipping BG_GC victim

2018-07-24 Thread Yunlong Song
On 2018/7/24 21:11, Chao Yu wrote: On 2018/7/23 22:10, Yunlong Song wrote: If f2fs aborts BG_GC, then the section bit of victim_secmap will be set, which will cause the section skipped in the future get_victim of BG_GC. In a worst case that each section in the victim_secmap is set and there a

Re: [f2fs-dev] [PATCH 2/5] f2fs: add cur_victim_sec for BG_GC to avoid skipping BG_GC victim

2018-07-24 Thread Chao Yu
On 2018/7/24 21:39, Yunlong Song wrote: > > > On 2018/7/24 21:11, Chao Yu wrote: >> On 2018/7/23 22:10, Yunlong Song wrote: >>> If f2fs aborts BG_GC, then the section bit of victim_secmap will be set, >>> which will cause the section skipped in the future get_victim of BG_GC. >>> In a worst case

Re: [f2fs-dev] [PATCH 4/5] f2fs: let BG_GC check every dirty segments and gc over a threshold

2018-07-24 Thread Chao Yu
On 2018/7/23 22:10, Yunlong Song wrote: > BG_GC is triggered in idle time, so it is better check every dirty > segment and finds the best victim to gc. Otherwise, BG_GC will be > limited to only 8G areas, and probably select a victim which has nearly If 8GB range is not enough and just hard code n

Re: [f2fs-dev] [PATCH 5/5] f2fs: add proc entry to show victim_secmap bitmap

2018-07-24 Thread Chao Yu
On 2018/7/23 22:10, Yunlong Song wrote: > This patch adds a new proc entry to show victim_secmap information in > more detail, which is very helpful to know the get_victim candidate > status clearly, and helpful to debug problems (e.g., some sections can > not gc all of its blocks, since some block

Re: [f2fs-dev] [PATCH 2/5] f2fs: add cur_victim_sec for BG_GC to avoid skipping BG_GC victim

2018-07-24 Thread Yunlong Song
On 2018/7/24 22:17, Chao Yu wrote: On 2018/7/24 21:39, Yunlong Song wrote: On 2018/7/24 21:11, Chao Yu wrote: On 2018/7/23 22:10, Yunlong Song wrote: If f2fs aborts BG_GC, then the section bit of victim_secmap will be set, which will cause the section skipped in the future get_victim of BG

Re: [f2fs-dev] [PATCH 4/5] f2fs: let BG_GC check every dirty segments and gc over a threshold

2018-07-24 Thread Yunlong Song
On 2018/7/24 22:52, Chao Yu wrote: On 2018/7/23 22:10, Yunlong Song wrote: BG_GC is triggered in idle time, so it is better check every dirty segment and finds the best victim to gc. Otherwise, BG_GC will be limited to only 8G areas, and probably select a victim which has nearly If 8GB range

[f2fs-dev] [PATCH] f2fs: avoid fi->i_gc_rwsem[WRITE] lock in f2fs_gc

2018-07-24 Thread Jaegeuk Kim
The f2fs_gc() called by f2fs_balance_fs() requires to be called outside of fi->i_gc_rwsem[WRITE], since f2fs_gc() can try to grab it in a loop. Signed-off-by: Jaegeuk Kim --- fs/f2fs/file.c| 2 ++ fs/f2fs/segment.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/