[f2fs-dev] [PATCH v2] f2fs: Return the errno to the caller to avoid using a wrong page

2016-05-30 Thread Yunlong Song
2FS_CHECK_FS is off when "sometimes it was reported that its contents was missing" happens. This patch restores to check node page contents all the time, and returns the errno to make the caller known something is wrong and avoid to use the page. This patch also moves f2fs_bug_on to its

Re: [f2fs-dev] [PATCH] f2fs: Return the errno to the caller to avoid using a wrong page

2016-05-30 Thread Yunlong Song
f2fs_put_page(page, 1); return ERR_PTR(-EIO); } @@ -967,7 +967,6 @@ repeat: goto repeat; } got_it: - f2fs_bug_on(nid != nid_of_node(page)); mark_page_accessed(page); return pa

[f2fs-dev] [PATCH v3] f2fs: Return the errno to the caller to avoid using a wrong page

2016-05-30 Thread Yunlong Song
2FS_CHECK_FS is off when "sometimes it was reported that its contents was missing" happens. This patch restores to check node page contents all the time, and returns the errno to make the caller known something is wrong and avoid to use the page. This patch also moves f2fs_bug_on to its

Re: [f2fs-dev] [PATCH] f2fs: Return the errno to the caller to avoid using a wrong page

2016-05-30 Thread Yunlong Song
Forget this wrong version, I have re-sent a patch v2 version. -- Thanks, Yunlong Song -- What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users

Re: [f2fs-dev] [PATCH v2] f2fs: Return the errno to the caller to avoid using a wrong page

2016-05-30 Thread Yunlong Song
f2fs_put_page(page, 1); > + return ERR_PTR(-EIO); > + } > return page; > } > > -- Thanks, Yunlong Song -- What NetFlow Analyzer can do for you? Monitors network bandwidth an

[f2fs-dev] [PATCH] f2fs: Return the errno to the caller to avoid using a wrong page

2016-05-30 Thread Yunlong Song
2FS_CHECK_FS is off when "sometimes it was reported that its contents was missing" happens. This patch restores to check node page contents all the time, and returns the errno to make the caller known something is wrong and avoid to use the page. This patch also moves f2fs_bug_on to its

[f2fs-dev] [PATCH] f2fs: fix to return 0 if err == -ENOENT in f2fs_readdir

2016-04-27 Thread Yunlong Song
t err to 0. This will cause getdents64 incorretly return -ENOENT when lastdirent is NULL in getdents64. This will lead to a wrong return value for syscall caller. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/f2fs/dir.c

[f2fs-dev] [PATCH] f2fs: Return the errno to the caller to avoid using a wrong page

2016-05-25 Thread Yunlong Song
2FS_CHECK_FS is off when "sometimes it was reported that its contents was missing" happens. This patch restores to check node page contents all the time, and returns the errno to make the caller known something is wrong and avoid to use the page. This patch also moves f2fs_bug_on to its

[f2fs-dev] [PATCH 1/2] mkfs.f2fs: add option to set the value of reserved segments and overprovision segments

2017-02-17 Thread Yunlong Song
Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- include/f2fs_fs.h | 3 +++ lib/libf2fs.c | 3 +++ mkfs/f2fs_format.c | 21 ++--- mkfs/f2fs_format_main.c | 10 +- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/i

[f2fs-dev] [PATCH 2/2] f2fs: fix the case when there is no free segment to allocate for CURSEG_WARM_NODE

2017-02-17 Thread Yunlong Song
If the free segments are used up, then new_curseg will fail for CURSEG_WARM_NODE, in this case, we should use change_curseg instead of new_curseg. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/segment.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/f2fs/segme

[f2fs-dev] [PATCH 0/2] Reduce the overprovision size a lot in f2fs

2017-02-17 Thread Yunlong Song
he overprovision segments at all for this consideration. Yunlong Song (2): mkfs.f2fs: add option to set the value of reserved segments and overprovision segments f2fs: fix the case when there is no free segment to allocate for CURSEG_WARM_NODE fs/f2fs/segment.c | 2 -- 1

[f2fs-dev] [PATCH 1/3] f2fs: clean up codes in get_ssr_segment

2017-02-22 Thread Yunlong Song
Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index df2ff5c..80997f5 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1541,7 +1541,7 @@ stat

[f2fs-dev] [PATCH] f2fs: put allocate_segment after refresh_sit_entry

2017-02-22 Thread Yunlong Song
dirty segments inside refresh_sit_entry") puts it into wrong location. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/segment.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index df2ff5c..89052df 1006

Re: [f2fs-dev] [PATCH 3/3] f2fs: provide more chance for node and data to get ssr segment

2017-02-24 Thread Yunlong Song
> Thanks, > > On 2017/2/23 9:17, Jaegeuk Kim wrote: >> Hi Yunlong, >> >> I've been testing the similar patches as I attached. >> >> Thanks, >> >> On 02/22, Yunlong Song wrote: >>> Signed-off-by: Yunlong Song <yunlong.s...@huawei.com>

Re: [f2fs-dev] [PATCH 3/3] f2fs: provide more chance for node and data to get ssr segment

2017-02-24 Thread Yunlong Song
below. On 2017/2/24 18:47, Chao Yu wrote: > On 2017/2/24 17:19, Yunlong Song wrote: >> Hi Jaegeuk and Chao, >> >> How about the question I pointed out in last mail: >> Why not take "neighboring temperature" for ssr? For example, if type == >> CUR

Re: [f2fs-dev] [PATCH 3/3] f2fs: provide more chance for node and data to get ssr segment

2017-02-24 Thread Yunlong Song
, but if time goes by, warm segments will finally update their blocks like hot segments, but cold segments are something like which should and will never update, so I prefer to put hot and warm to one side, and put cold to the other side. On 2017/2/25 4:05, Jaegeuk Kim wrote: > On 02/25, Yunlong S

[f2fs-dev] [PATCH] f2fs: change the codes of checking CP_CRC_RECOVERY_FLAG to macro

2017-02-24 Thread Yunlong Song
No need to check the "if" condition each time, just change it to macro codes. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/node.h| 20 ++-- fs/f2fs/segment.c | 5 +++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/fs/

Re: [f2fs-dev] [PATCH] f2fs: clean up codes in f2fs_gc related with write_checkpoint

2017-02-24 Thread Yunlong Song
Ping... Since has_not_enough_free_secs(sbi, 0, 0) must be true if has_not_enough_free_secs(sbi, sec_freed, 0) is true, write_checkpoint is sure to execute in both conditions, and segno is NULL_SEGNO in both conditions. On 2017/2/21 20:43, Yunlong Song wrote: > Signed-off-by: Yunlong S

Re: [f2fs-dev] [PATCH] f2fs: change the codes of checking CP_CRC_RECOVERY_FLAG to macro

2017-02-24 Thread Yunlong Song
. The already-been-written node in the old image should not appear in the node chain of recovery process, right? On 2017/2/24 18:29, Chao Yu wrote: > On 2017/2/24 18:06, Yunlong Song wrote: >> No need to check the "if" condition each time, just change it to macro codes. > We're goi

Re: [f2fs-dev] [PATCH 1/3] f2fs: clean up codes in get_ssr_segment

2017-02-24 Thread Yunlong Song
wanted to do like this. > > >From 8d344ac45890dd95c5734fd29a19a7c19364c327 Mon Sep 17 00:00:00 2001 > From: Yunlong Song <yunlong.s...@huawei.com> > Date: Wed, 22 Feb 2017 20:50:49 +0800 > Subject: [PATCH] f2fs: do SSR for data when there is enough free space > > In allocate_segment_by_default(),

[f2fs-dev] [PATCH] f2fs: add F2FS_DIRTY_DATA to has_not_enough_free_secs and need_SSR

2017-02-24 Thread Yunlong Song
used anytime for gc when ssr segments are not enough. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/segment.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index f4020f1..44f2a46 100644 --- a/fs/f2fs/segment

Re: [f2fs-dev] [PATCH] f2fs: change the codes of checking CP_CRC_RECOVERY_FLAG to macro

2017-02-24 Thread Yunlong Song
On 2017/2/24 19:37, Chao Yu wrote: > On 2017/2/24 19:11, Yunlong Song wrote: >> I think we do not need to care about the CP_CRC_RECOVERY_FLAG status of old >> image, I mean we >> do not need to check the already-been-written node footer in the image, what >> we ca

Re: [f2fs-dev] [PATCH 3/3] f2fs: provide more chance for node and data to get ssr segment

2017-02-24 Thread Yunlong Song
milar patches as I attached. > > Thanks, > > On 02/22, Yunlong Song wrote: >> Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> >> --- >> fs/f2fs/segment.c | 9 + >> 1 file changed, 9 insertions(+) >> >> diff --git a/fs/f2fs/segment.c b/f

Re: [f2fs-dev] [PATCH 3/3] f2fs: provide more chance for node and data to get ssr segment

2017-02-24 Thread Yunlong Song
Hi Jay, I miss some codes from your mail, now I check all your patch codes and make clear with question 2 and 3, it's fine. But still, how about question 1? On 2017/2/23 10:13, Yunlong Song wrote: > Hi Jay, > But there are some differences: > 1 Why not take "neighbori

[f2fs-dev] [PATCH v2] f2fs: change the codes of checking CP_CRC_RECOVERY_FLAG to macro

2017-02-25 Thread Yunlong Song
No need to check the "if" condition each time, just change it to macro codes. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/node.h| 10 +- fs/f2fs/segment.c | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/fs/f2fs/node.h

Re: [f2fs-dev] [PATCH] f2fs: change the codes of checking CP_CRC_RECOVERY_FLAG to macro

2017-02-25 Thread Yunlong Song
ing code in is_recoverable_dnode, this function is called only once after mount, it's OK. -- Thanks, Yunlong Song -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slash

Re: [f2fs-dev] [PATCH] f2fs: add F2FS_DIRTY_DATA to has_not_enough_free_secs and need_SSR

2017-02-25 Thread Yunlong Song
he amount of gc_more segments after the sync in my example, because you have to gc_more until free_sections equals to reserved_segments, so the smaller the reserved_segment is, the smaller times f2f2_gc will gc_more. Anyway, I will test the patch in device for stability. On 2017/2/24 20:46, Yun

[f2fs-dev] [PATCH 2/3] f2fs: provide more chance to get node ssr

2017-02-22 Thread Yunlong Song
Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/segment.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 80997f5..9d13743 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1541,9 +1

[f2fs-dev] [PATCH] fsck.f2fs: free node_blk to avoid memory leak

2016-09-21 Thread Yunlong Song
Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fsck/fsck.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fsck/fsck.c b/fsck/fsck.c index e2081c8..2a4df7b 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -1696,6 +1696,7 @@ static void fix_hard_links(struct f2fs_sb_inf

[f2fs-dev] [PATCH] fsck: clear useless "continue" in __chk_dentries

2016-09-20 Thread Yunlong Song
Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fsck/fsck.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index e2081c8..301685b 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -1240,7 +1240,6 @@ static int __chk_dentries(struct f2fs_sb_info *sbi,

Re: [f2fs-dev] [PATCH] f2fs: fix small discards when se->valid_blocks is zero

2017-01-04 Thread Yunlong Song
amp; !IS_CURSEG(sbi, cpc->trim_start)" is true, since the other blocks of that segment has already sent small discard when they got invalid before, and we just need to send the discard of that deleted file which is the last one taking up in the segment. On 2017/1/5 6:36, Jaegeuk Kim wrot

Re: [f2fs-dev] [PATCH] f2fs: fix small discards when se->valid_blocks is zero

2017-01-03 Thread Yunlong Song
invalidate blocks of that file can not be discarded in FTL layer on time. On 2017/1/4 9:55, Jaegeuk Kim wrote: > Hi Yunlong, > > On 01/03, Yunlong Song wrote: >> In the small discard case, when se->valid_blocks is zero, the >> add_discard_addrs >> will dir

Re: [f2fs-dev] [PATCH v2] f2fs: provide f2fs_balance_fs to __write_node_page

2017-07-29 Thread Yunlong Song
Hi Chao, Nice suggestion, I have sent out a new patch to implement it. On 2017/7/29 8:19, Chao Yu wrote: Hi Yunlong, On 2017/7/27 20:13, Yunlong Song wrote: v1->v2, fix some dead lock problems under some heavy load test On 2017/7/27 20:11, Yunlong Song wrote: Let node writeback also

[f2fs-dev] [PATCH] f2fs: provide f2fs_balance_fs to __write_data_page for dentry pages

2017-07-29 Thread Yunlong Song
ed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/checkpoint.c | 2 +- fs/f2fs/data.c | 67 +--- fs/f2fs/f2fs.h | 1 + 3 files changed, 61 insertions(+), 9 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c i

Re: [f2fs-dev] [PATCH v2] f2fs: provide f2fs_balance_fs to __write_node_page

2017-07-29 Thread Yunlong Song
ot;, which is reported by Chao. This is another corner case. On 2017/7/29 0:20, Jaegeuk Kim wrote: Hi Yunlong, On 07/27, Yunlong Song wrote: v1->v2, fix some dead lock problems under some heavy load test So, does this patch resolve the previous GC problem? Thanks, On 2017/7/27 20:11, Yunlo

[f2fs-dev] [PATCH] f2fs: update cur_valid_map_mir together with cur_valid_map

2017-08-01 Thread Yunlong Song
When cur_valid_map passes the f2fs_test_and_set(,clear)_bit test, cur_valid_map_mir update is skipped unlikely, so fix it. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/segment.c | 8 1 file changed, 8 insertions(+) diff --git a/fs/f2fs/segment.c b/fs/f2fs/seg

[f2fs-dev] [PATCH v2] f2fs: update cur_valid_map_mir together with cur_valid_map

2017-08-02 Thread Yunlong Song
When cur_valid_map passes the f2fs_test_and_set(,clear)_bit test, cur_valid_map_mir update is skipped unlikely, so fix it. The fix now changes the mirror check together with cur_valid_map all the time. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> Signed-off-by: Chao Yu

Re: [f2fs-dev] [PATCH] f2fs: provide f2fs_balance_fs to __write_data_page for dentry pages

2017-08-03 Thread Yunlong Song
wrote: On 08/02, Yunlong Song wrote: Hi Jay, The case is like this: write_checkpoint: normal dentry page writeback of inodeB: -block_operations -f2fs_write_data_pages -SBI_BLOCK_OPS is set -f2fs_write_cache_pages -sync_dirty_

Re: [f2fs-dev] [PATCH] f2fs: provide f2fs_balance_fs to __write_data_page for dentry pages

2017-08-03 Thread Yunlong Song
Chao has pointed out that, maybe writebacking dentry page can redirty dnode page which may be clean previously, so it is more safe to call f2fs_balance_fs to make sure dirty metadatas of filesystem will not exceed the threshold. On 2017/8/4 11:34, Jaegeuk Kim wrote: On 08/04, Yunlong Song

Re: [f2fs-dev] [PATCH] f2fs: provide f2fs_balance_fs to __write_data_page for dentry pages

2017-08-03 Thread Yunlong Song
ite to reserved segments inodeA <- list_first_entry(dirty_list) filemap_fdatawrite(inodeA) go to retry --SBI_BLOCK_OPS is clear On 2017/8/4 9:57, Jaegeuk Kim wrote: On 08/02, Yunlong Song wrote: Hi Jay, The case i

[f2fs-dev] [PATCH] f2fs: fix the size value in __check_sit_bitmap

2017-08-04 Thread Yunlong Song
The current size value is not correct and will miss bitmap check. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/segment.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index f336f8c..45fb534 100644 --

Re: [f2fs-dev] [PATCH] f2fs: free_user_blocks should use reserved_segments instead

2017-08-15 Thread Yunlong Song
free_use_blocks should use reserved_segments instead, rather than directly use overprovision_segments. BTW, we also add the constraint of sbi->reserved_blocks. On 2017/8/15 11:32, Jaegeuk Kim wrote: On 08/14, Yunlong Song wrote: The part (overprovision_segments - reserved_segments) can st

[f2fs-dev] [PATCH v2] f2fs: free_user_blocks should use reserved_segments instead

2017-08-15 Thread Yunlong Song
than directly use overprovision_segments. BTW, we also add the constraint of sbi->reserved_blocks. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/gc.h | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h inde

Re: [f2fs-dev] [PATCH v2] f2fs: introduce cur_reserved_blocks in sysfs

2017-08-14 Thread Yunlong Song
ping... On 2017/8/11 19:43, Yunlong Song wrote: In this patch, we add a new sysfs interface, we can use it to gradually achieve the reserved_blocks finally, even when reserved_blocks is initially set over user_block_count - total_valid_block_count. This is very useful, especially when we

[f2fs-dev] [PATCH v2] f2fs-tools: fix the usage message of overprovision option

2017-08-15 Thread Yunlong Song
The usage message shows a wrong message for ovp option, so fix it. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- mkfs/f2fs_format_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c index a3652a9..3279829

Re: [f2fs-dev] [PATCH] f2fs: introduce cur_reserved_blocks in sysfs

2017-08-09 Thread Yunlong Song
happens, android should change the value dynamically, it is fine, since we make reserved_blocks to a soft version. On 2017/8/10 11:15, Chao Yu wrote: On 2017/8/8 21:43, Yunlong Song wrote: In this patch, we add a new sysfs interface, we can use it to gradually achieve the reserved_blocks finally

[f2fs-dev] [PATCH] f2fs-tools: the overprovision should be 0 as default

2017-08-11 Thread Yunlong Song
The usage message gives a wrong number, so fix it. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- mkfs/f2fs_format_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c index a3652a9..6712b5c 100644 ---

Re: [f2fs-dev] [PATCH] f2fs: introduce cur_reserved_blocks in sysfs

2017-08-11 Thread Yunlong Song
v2 I resent. On 2017/8/11 18:18, Chao Yu wrote: On 2017/8/10 19:41, Yunlong Song wrote: It may block the system in such case, but so does the hard version design. In the hard version, We'd better not let soft/hard reserved_blocks to eat all left free space, at least needs to leave enough space

[f2fs-dev] [PATCH v2] f2fs: introduce cur_reserved_blocks in sysfs

2017-08-11 Thread Yunlong Song
there is enough space for supporting system's activation, we safely increase cur_reserved_blocks in dev_valid_block(,node)_count to only take up the blocks which are just obsoleted. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++ f

[f2fs-dev] [PATCH] f2fs: remove unused function overprovision_sections

2017-08-14 Thread Yunlong Song
Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/segment.h | 5 - 1 file changed, 5 deletions(-) diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 7f700e5..b9b4f85 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -492,11 +492,6 @@ static inli

[f2fs-dev] [PATCH] f2fs: free_user_blocks should use reserved_segments instead

2017-08-14 Thread Yunlong Song
The part (overprovision_segments - reserved_segments) can still be used for LFS, so free_use_blocks should use reserved_segments instead, rather than use overprovision_segments. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/gc.h | 4 ++-- 1 file changed, 2 insertions

Re: [f2fs-dev] [PATCH] f2fs: introduce cur_reserved_blocks in sysfs

2017-08-10 Thread Yunlong Song
this responsibility, it's android's responsibility. On 2017/8/10 19:26, Chao Yu wrote: On 2017/8/10 11:58, Yunlong Song wrote: I think the aim of reserved_blocks function is to leave space for f2fs and FTL, so I change it to a soft version so that it can be used to fit to the data image which does

[f2fs-dev] [PATCH] f2fs: let __get_victim successfully get a segno in corner case

2017-07-14 Thread Yunlong Song
all, and get_new_segment cannot get a free segment, filesystem will trap into a wrong status. To fix this, we record the segno which has a rough minimum cost and return it to __get_victim to continue f2fs_gc's job. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/gc.c

Re: [f2fs-dev] [PATCH] f2fs: let __get_victim successfully get a segno in corner case

2017-07-16 Thread Yunlong Song
Hi Jay, In fact,this is not "suppose" case yet, we have already met this problem several times in some test suits for corner case, or I cannot notice that this could happen. On 2017/7/16 9:09, Jaegeuk Kim wrote: > Hi Yunlong, > > On 07/14, Yunlong Song wrote: >&g

Re: [f2fs-dev] [PATCH] f2fs: let __get_victim successfully get a segno in corner case

2017-07-20 Thread Yunlong Song
hat >> this could happen. > So, have you taken a look at distribution of valid blocks in that case? > I'm wondering what distribution can cause this. > > Thanks, > >> >> >> >> 发自网易邮箱大师 >> On 07/16/2017 09:09, Jaegeuk Kim wrote: >> Hi Yunl

[f2fs-dev] [PATCH v2] f2fs: provide f2fs_balance_fs to __write_node_page

2017-07-27 Thread Yunlong Song
Let node writeback also do f2fs_balance_fs to ensure there are always enough free segments. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/checkpoint.c | 2 +- fs/f2fs/f2fs.h | 2 +- fs/f2fs/node.c | 14 -- 3 files changed, 10 insertions

Re: [f2fs-dev] [PATCH v2] f2fs: provide f2fs_balance_fs to __write_node_page

2017-07-27 Thread Yunlong Song
v1->v2, fix some dead lock problems under some heavy load test On 2017/7/27 20:11, Yunlong Song wrote: Let node writeback also do f2fs_balance_fs to ensure there are always enough free segments. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/checkpoint.c | 2 +-

[f2fs-dev] [PATCH] f2fs: provide f2fs_balance_fs to __write_node_page

2017-07-26 Thread Yunlong Song
Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/checkpoint.c | 2 +- fs/f2fs/f2fs.h | 2 +- fs/f2fs/node.c | 16 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 5b876f6..3

Re: [f2fs-dev] [PATCH] f2fs: let __get_victim successfully get a segno in corner case

2017-07-26 Thread Yunlong Song
have sent another patch to provide f2fs_balance_fs to __write_node_page, similar as that in __write_data_page, to avoid missing f2fs_balance_fs in node page writeback. Please check that. On 2017/7/26 2:55, Jaegeuk Kim wrote: On 07/14, Yunlong Song wrote: Suppose that the valid blocks of each

Re: [f2fs-dev] [PATCH] f2fs: let __get_victim successfully get a segno in corner case

2017-07-24 Thread Yunlong Song
Hi Jay, fggc_threshold is 507, reserved_segment is 462. On 2017/7/22 5:07, Jaegeuk Kim wrote: Hi Yunlong, On 07/20, Yunlong Song wrote: Hi, Jay, The distribution is like this, unit is segment counts: cnt_free: 0 (free blocks) cnt_full: 25182 (segment which has 512 blocks

[f2fs-dev] [PATCH] f2fs: no need to create issue_discard_thread if it exists

2017-07-06 Thread Yunlong Song
Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/segment.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 4c246e3..b48d004 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1417,6 +1417,8 @@ stat

Re: [f2fs-dev] [PATCH] f2fs: no need to create issue_discard_thread if it exists

2017-07-06 Thread Yunlong Song
It's fine unless create_discard_cmd_control is used in remount flow in the future. On 2017/7/6 21:16, Chao Yu wrote: > Hi Yunlong, > > It looks there is no way to create discard thread redundantly, > so here we don't need to check this? > > Thanks, > > On 2017/7/6 1

Re: [f2fs-dev] [PATCH] f2fs: fix some cases with reserved_blocks

2017-08-08 Thread Yunlong Song
/8/8 12:12, Yunlong Song wrote: Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/recovery.c | 3 ++- fs/f2fs/super.c| 9 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index a3d0261..e288319 100644 --

[f2fs-dev] [PATCH] f2fs: fix some cases with reserved_blocks

2017-08-07 Thread Yunlong Song
Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/recovery.c | 3 ++- fs/f2fs/super.c| 9 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index a3d0261..e288319 100644 --- a/fs/f2fs/recovery.c +++ b/f

Re: [f2fs-dev] [PATCH] f2fs: provide f2fs_balance_fs to __write_data_page for dentry pages

2017-08-01 Thread Yunlong Song
: Hi Yunlong, On 07/29, Yunlong Song wrote: f2fs_balance_fs of dentry pages is skipped in __write_data_page due to deadlock of gc_mutex in write_checkpoint flow. This patch enables f2fs_balance_fs for normal dentry page writeback to ensure there are always enough free segments. So, how about

[f2fs-dev] [PATCH] f2fs: introduce cur_reserved_blocks in sysfs

2017-08-08 Thread Yunlong Song
-by: Yunlong Song <yunlong.s...@huawei.com> --- Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++ fs/f2fs/f2fs.h | 9 +++-- fs/f2fs/super.c | 4 +++- fs/f2fs/sysfs.c | 15 ++- 4 files changed, 26 insertions

Re: [f2fs-dev] [PATCH v2] f2fs: free_user_blocks should use reserved_segments instead

2017-08-18 Thread Yunlong Song
ping... On 2017/8/15 15:14, Yunlong Song wrote: The part (overprovision_segments - reserved_segments) can still be used for LFS in some case, e.g., there are lots of invalid block from dirty segments, then the part (overprovision_segments - reserved_segments) can be safely used. So

Re: [f2fs-dev] [PATCH v2] f2fs: introduce cur_reserved_blocks in sysfs

2017-08-18 Thread Yunlong Song
ping... On 2017/8/15 12:08, Yunlong Song wrote: ping... On 2017/8/11 19:43, Yunlong Song wrote: In this patch, we add a new sysfs interface, we can use it to gradually achieve the reserved_blocks finally, even when reserved_blocks is initially set over user_block_count

[f2fs-dev] [PATCH v3] f2fs: add cur_reserved_blocks to support soft block reservation

2017-08-18 Thread Yunlong Song
to the configured reserved_blocks value at once, instead, it safely increase cur_reserved_blocks in dev_valid_block(,node)_count to only take up the blocks which are just obsoleted. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> Signed-off-by: Chao Yu <yuch...@huawei.com> --- Documentation

Re: [f2fs-dev] [PATCH v2] f2fs: introduce cur_reserved_blocks in sysfs

2017-08-18 Thread Yunlong Song
I send a v3 patch, please review, and the main difference is shown below. On 2017/8/18 18:20, Chao Yu wrote: Hi Yunlong, IMO, we don't need additional sysfs entry, how about changing a bit as below? >From 3fc8206871fe457859f1537c9dc8918b45f14601 Mon Sep 17 00:00:00 2001 From: Yunlong S

[f2fs-dev] [PATCH] f2fs: avoid redundant f2fs_flush after remount

2017-06-24 Thread Yunlong Song
create_flush_cmd_control will create redundant issue_flush_thread after each remount with flush_merge option. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/segment.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index a

[f2fs-dev] [PATCH] Revert "f2fs: node segment is prior to data segment selected victim"

2017-09-23 Thread Yunlong Song
This reverts commit b9cd20619e359d199b755543474c3d853c8e3415. That patch causes much fewer node segments (which can be used for SSR) than before, and in the corner case (e.g. create and delete *.txt files in one same directory, there will be very few node segments but many data segments), if the

Re: [f2fs-dev] [PATCH] f2fs: update dirty status for CURSEG as well

2017-10-13 Thread Yunlong Song
Correct, I will update the patch. On 2017/10/13 19:08, Chao Yu wrote: Hi Yunlong, On 2017/10/11 21:25, Yunlong Song wrote: Without this patch, it will cause all the free segments using up in some corner case. For example, there are 100 segments, and 20 of them are reserved for ovp. If 79

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

2017-10-13 Thread Yunlong Song
Yep, both are OK, since I do not care it is foreground or background. Here it just needs to do gc. On 2017/10/13 19:09, Chao Yu wrote: On 2017/10/11 21:51, Yunlong Song wrote: This can help us to debug on some corner case. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- f

[f2fs-dev] [PATCH v2] f2fs: update dirty status for CURSEG as well

2017-10-13 Thread Yunlong Song
segment, write 512 blocks and delete 511 blocks, the dirty_segments(sbi) is 0 and f2fs_gc fail again. This can finally use up all the free segments and cause panic. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/segment.c | 4 ++-- 1 file changed, 2 insertions(+), 2 del

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

2017-10-13 Thread Yunlong Song
This can help us to debug on some corner case. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> Signed-off-by: Chao Yu <yuch...@huawei.com> --- fs/f2fs/gc.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 197ebf4..2b

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

2017-10-14 Thread Yunlong Song
Do you mean check out-of-space test? I have tried that but no bugon. On 2017/10/14 8:17, Chao Yu wrote: On 2017/10/13 21:31, Yunlong Song wrote: This can help us to debug on some corner case. I can hit this bugon with generic/015 of fstest easily, could have a look at this? Thanks, Signed

Re: [f2fs-dev] [PATCH v2] f2fs: update dirty status for CURSEG as well

2017-10-14 Thread Yunlong Song
ds unnecessary check. On 2017/10/14 8:14, Chao Yu wrote: On 2017/10/13 21:21, Yunlong Song wrote: Without this patch, it will cause all the free segments using up in some corner case. For example, there are 100 segments, and 20 of them are reserved for ovp. If 79 segments are full of data, segme

[f2fs-dev] [PATCH] f2fs-tools: add cscope files to .gitignore

2017-09-07 Thread Yunlong Song
Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- .gitignore | 4 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index abe1336..d5ca55d 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,7 @@ stamp-h1 /tools/fibmap.f2fs /tools/parse.f2fs /tools/f2f

[f2fs-dev] [PATCH] f2fs-tools: support CP_CRC_RECOVERY_FLAG check

2017-09-07 Thread Yunlong Song
Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fsck/fsck.c | 3 +++ fsck/mount.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/fsck/fsck.c b/fsck/fsck.c index cb341ba..f63a609 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -1786,6 +1786,9 @@ static void fix_checkpoint(

[f2fs-dev] [PATCH] f2fs-tools: move_curseg_info only if check_curseg_offset fails

2017-09-10 Thread Yunlong Song
Current design will lose recovery process when check_curseg_offset is OK. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fsck/fsck.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index cb341ba..56a47be 100644 --- a/fsck/

[f2fs-dev] [PATCH] f2fs-tools: fix is_set_ckpt_flags for correct bool value

2017-09-10 Thread Yunlong Song
If flag bit to check is in 0xFF00, then the return value will be false, this is not correct, so fix it. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fsck/f2fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsck/f2fs.h b/fsck/f2fs.h index 871cffc..d

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

2017-08-26 Thread Yunlong Song
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 <yunlong.s...@huawei.com> --- fs/f2fs/gc

[f2fs-dev] [PATCH] f2fs: discard small invalid blocks in current active segments

2017-08-26 Thread Yunlong Song
as a candidate for small discards. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/segment.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 8375257..a2e7c8f 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/seg

Re: [f2fs-dev] [PATCH] f2fs: discard small invalid blocks in current active segments

2017-08-28 Thread Yunlong Song
How? Can the invalid blocks of file A be discarded, if file B is alive all the time and fggc_threshold is 507 ? On 2017/8/28 17:59, Chao Yu wrote: On 2017/8/26 20:49, Yunlong Song wrote: 1. write file A with 5 blocks to current empty active segment 2. remove file A 3. write checkpoint 4

[f2fs-dev] [PATCH] f2fs: clear get_ssr_cost

2017-09-01 Thread Yunlong Song
se->ckpt_valid_blocks is always larger than se->valid_blocks, so get_ssr_cost can be cleared. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/gc.c | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index cd14

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

2017-09-01 Thread Yunlong Song
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 <yunlong.s...@huawei.com> --- fs/f2fs/gc.

Re: [f2fs-dev] [PATCH] f2fs: clear get_ssr_cost

2017-09-03 Thread Yunlong Song
r than ckpt_valid_blocks? On 2017/9/4 9:17, Chao Yu wrote: On 2017/9/1 20:14, Yunlong Song wrote: se->ckpt_valid_blocks is always larger than se->valid_blocks, so get_ssr_cost can be cleared. I think this is not correct. Thanks, Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> ---

[f2fs-dev] [PATCH v2] Revert "f2fs: add a new function get_ssr_cost"

2017-09-03 Thread Yunlong Song
This reverts commit b7b7c4cf1c9ef0272a65f1480457cbfdadcda19d. se->ckpt_valid_blocks will never be smaller than se->valid_blocks, so just remove get_ssr_cost. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> Signed-off-by: Chao Yu <yuch...@huawei.com> --- fs/f2fs/gc.c |

[f2fs-dev] [PATCH] f2fs: update dirty status for CURSEG as well

2017-10-11 Thread Yunlong Song
segment, write 512 blocks and delete 511 blocks, the dirty_segments(sbi) is 0 and f2fs_gc fail again. This can finally use up all the free segments and cause panic. Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/segment.c | 4 1 file changed, 4 deletions(-) diff --git a/f

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

2017-10-12 Thread Yunlong Song
Hi, Jay, I think it should not happen when need_gc == true but total_freed ==0, so I add it as bug_on to let it panic at once. And even CHECK_FS is closed, this can also printk WARNING message for notice. On 2017/10/13 7:23, Jaegeuk Kim wrote: Hi Yunlong, On 10/11, Yunlong Song wrote

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

2017-11-12 Thread Yunlong Song
ping... On 2017/11/8 10:17, Yunlong Song wrote: 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

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

2017-11-29 Thread Yunlong Song
ping... On 2017/11/17 8:54, Yunlong Song wrote: 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

Re: [f2fs-dev] [PATCH] f2fs: avoid false positive of free secs check

2017-11-29 Thread Yunlong Song
SSR can make hot/warm/cold nodes written together, so why should we account them different? On 2017/11/29 19:56, Chao Yu wrote: On 2017/11/27 14:54, Yunlong Song wrote: Sometimes f2fs_gc is called with no target victim (e.g. xfstest generic/027, ndirty_node:545 ndiry_dent:1 ndirty_imeta:513

[f2fs-dev] [PATCH] f2fs: avoid false positive of free secs check

2017-11-26 Thread Yunlong Song
Sometimes f2fs_gc is called with no target victim (e.g. xfstest generic/027, ndirty_node:545 ndiry_dent:1 ndirty_imeta:513 rsvd_segs:21 free_segs:27, has_not_enough_free_secs will return true). This patch first merges pages and then converts into sections. Signed-off-by: Yunlong Song <yunlon

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

2017-11-25 Thread Yunlong Song
0b 41 8b 96 fc 03 00 00 41 8b be f4 03 00 00 4c 8b 21 45 8b [ 5250.628467] RIP: f2fs_gc+0x9da/0xa80 RSP: c9000acd3b48 [ 5250.685538] ---[ end trace 00b8c84c59632b32 ]--- Let me fix it one by one. On 2017/11/23 21:05, Chao Yu wrote: On 2017/11/22 11:50, Yunlong Song wrote: ping again... On 2

[f2fs-dev] [PATCH v2] fsck.f2fs: check nid range before use to avoid segmentation fault

2017-12-18 Thread Yunlong Song
Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fsck/fsck.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index 11b8b0b..faf0663 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -740,7 +740,7 @@ void fsck_chk_inode_blk(struct f2fs_s

[f2fs-dev] [PATCH v3] fsck.f2fs: check and fix i_namelen to avoid double free

2017-12-18 Thread Yunlong Song
Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fsck/fsck.c | 26 +- fsck/fsck.h | 3 ++- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index 2212aa3..b52b6e4 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -539,7

[f2fs-dev] [PATCH] fsck.f2fs: check nid range before use to avoid segmentation fault

2017-12-14 Thread Yunlong Song
Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fsck/fsck.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index 11b8b0b..2212aa3 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -14,6 +14,15 @@ char *tree_mark; ui

[f2fs-dev] [PATCH] fsck.f2fs: check and fix i_namelen to avoid double free

2017-12-14 Thread Yunlong Song
Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fsck/fsck.c | 19 --- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index 2212aa3..8ff4e4b 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -643,7 +643,7 @@ void fsck_chk_ino

  1   2   3   >