[f2fs-dev] [PATCH] f2fs: enable real-time discard by default

2018-07-04 Thread Chao Yu
f2fs is focused on flash based storage, so let's enable real-time discard by default, if user don't want to enable it, 'nodiscard' mount option should be used on mount. Signed-off-by: Chao Yu --- fs/f2fs/super.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/f2fs/s

[f2fs-dev] [PATCH v2] f2fs: give another chance to issue discard with current granularity

2018-07-04 Thread Chao Yu
If discard IOs are blocked by user IO, do not skip to select and issue discard with lower granularity, retry with current granularity. Signed-off-by: Chao Yu --- v2: - fix deadloop. fs/f2fs/segment.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/se

[f2fs-dev] [PATCH] f2fs: split discard command in prior to block layer

2018-07-04 Thread Chao Yu
From: Chao Yu Some devices has small max_{hw,}discard_sectors, so that in __blkdev_issue_discard(), one big size discard bio can be split into multiple small size discard bios, result in heavy load in IO scheduler and device, which can hang other sync IO for long time. Now, f2fs is trying to con

[f2fs-dev] [PATCH v2 1/2] f2fs: fix to skip GC if type in SSA and SIT is inconsistent

2018-07-04 Thread Chao Yu
From: Chao Yu If segment type in SSA and SIT is inconsistent, we will encounter below BUG_ON during GC, to avoid this panic, let's just skip doing GC on such segment. The bug is triggered with image reported in below link: https://bugzilla.kernel.org/show_bug.cgi?id=200223 [ 388.060262] -

[f2fs-dev] [PATCH v5] f2fs: fix to do sanity check with block address in main area

2018-07-04 Thread Chao Yu
From: Chao Yu This patch add to do sanity check with below field: - cp_pack_total_block_count - blkaddr of data/node - extent info - Overview BUG() in verify_block_addr() when writing to a corrupted f2fs image - Reproduce (4.18 upstream kernel) - POC (poc.c) static void activity(char *mpoint)

Re: [f2fs-dev] 答复: [PATCH 1/2] f2fs: fix to skip GC if type in SSA and SIT is inconsistent

2018-07-04 Thread Chao Yu
Hi Xue, On 2018/7/4 18:46, Liuxue (Alice, Euler Dept seven) wrote: > Subject: [f2fs-dev] [PATCH 1/2] f2fs: fix to skip GC if type in SSA and SIT > is inconsistent > Date: Thu, 28 Jun 2018 18:25:58 +0800 > From: Chao Yu > To: jaeg...@kernel.org > CC: linux-ker...@vger.kernel.org, linux-f2fs-devel

[f2fs-dev] 答复: [PATCH 1/2] f2fs: fix to skip GC if type in SSA and SIT is inconsistent

2018-07-04 Thread Liuxue (Alice, Euler Dept seven)
Subject: [f2fs-dev] [PATCH 1/2] f2fs: fix to skip GC if type in SSA and SIT is inconsistent Date: Thu, 28 Jun 2018 18:25:58 +0800 From: Chao Yu To: jaeg...@kernel.org CC: linux-ker...@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net If segment type in SSA and SIT is inconsistent, we will

[f2fs-dev] [PATCH] f2fs: try grabbing node page lock aggressively in sync scenario

2018-07-04 Thread Chao Yu
In synchronous scenario, like in checkpoint(), we are going to flush dirty node pages to device synchronously, we can easily failed writebacking node page due to trylock_page() failure, especially in condition of intensive lock competition, which can cause long latency of checkpoint(). So let's use

[f2fs-dev] [PATCH] f2fs-tools: avoid mounting f2fs if tools already open the device

2018-07-04 Thread Sheng Yong
If the block device is opened by tools, F2FS should not be mounted. Especially when fsck is running, errors unexpected may happen. So if tools open a block device, we give it the O_EXCL flag to make sure the block device is opened exclusivly. Signed-off-by: Sheng Yong --- lib/libf2fs.c | 27

[f2fs-dev] [PATCH v2 1/2] f2fs: fix to avoid broken of dnode block list

2018-07-04 Thread Chao Yu
f2fs recovery flow is relying on dnode block link list, it means fsynced file recovery depends on previous dnode's persistence in the list, so during fsync() we should wait on all regular inode's dnode writebacked before issuing flush. By this way, we can avoid dnode block list being broken by out