Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752088AbbB1JYX (ORCPT ); Sat, 28 Feb 2015 04:24:23 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:26822 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751261AbbB1JYU (ORCPT ); Sat, 28 Feb 2015 04:24:20 -0500 X-AuditID: cbfee61b-f79d76d0000024d6-7b-54f18942f126 From: Chao Yu To: Jaegeuk Kim , Changman Lee Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH] f2fs: fix to issue small discard in real-time mode discard Date: Sat, 28 Feb 2015 17:23:30 +0800 Message-id: <019801d05338$52aae5b0$f800b110$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AdBTAfhV/EBxhZBHRAKMDrTtqrSd3w== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrMLMWRmVeSWpSXmKPExsVy+t9jQV2nzo8hBj+6xS2u7Wtksniyfhaz xaVF7haXd81hc2Dx2LSqk81j94LPTB59W1YxenzeJBfAEsVlk5Kak1mWWqRvl8CV0Xn2NmPB Q/aKp4d+sjYwrmPrYuTkkBAwkXi/9T8LhC0mceHeeqA4F4eQwHRGifmLfzJBOD8YJWZ0N4N1 sAmoSCzv+M8EYosIeElM2n8CrJtZwEOiseM7K4gtLOAt8f33A0YQm0VAVeLSio1gNq+ApcTH C7tZIGxBiR+T70H1akms33mcCcKWl9i85i0zxEUKEjvOvmaE2KUnMfH6Zah6cYmNR26xTGAU mIVk1Cwko2YhGTULScsCRpZVjKKpBckFxUnpuUZ6xYm5xaV56XrJ+bmbGMFB/Ux6B+OqBotD jAIcjEo8vAl8H0OEWBPLiitzDzFKcDArifA2BgOFeFMSK6tSi/Lji0pzUosPMUpzsCiJ8yrZ t4UICaQnlqRmp6YWpBbBZJk4OKUaGAXnszXrClw9d8XRLSyoLdHZsfmuo5mLdtnd1Vbb50sL fzYT69uSk5mv5rf//XSL6zadKn1nGW81Mmu+0ZhVlpHHwR3sGfRo2wKBmbasfgqr9L2UtjHu zv6efobn1aI/8eEuLF4c87PMD/x+oe3FcfqzX3rbN42Q02H3pDIWz6ovdlmkFmmsxFKckWio xVxUnAgAirWpjmYCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1210 Lines: 33 Now in f2fs, we share functions and structures for batch mode and real-time mode discard. For real-time mode discard, in shared function add_discard_addrs, we will use uninitialized trim_minlen in struct cp_control to compare with length of contiguous free blocks to decide whether skipping discard fragmented freespace or not, this makes us ignore small discard sometimes. Fix it. Signed-off-by: Chao Yu --- 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 daee4ab..fcc1cc2 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -549,7 +549,7 @@ static void add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc) end = __find_rev_next_zero_bit(dmap, max_blocks, start + 1); - if (end - start < cpc->trim_minlen) + if (force && end - start < cpc->trim_minlen) continue; __add_discard_entry(sbi, cpc, start, end); -- 2.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/