Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757598AbbGQKDZ (ORCPT ); Fri, 17 Jul 2015 06:03:25 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:58757 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751706AbbGQKDX (ORCPT ); Fri, 17 Jul 2015 06:03:23 -0400 X-AuditID: cbfee61a-f79516d000006302-9b-55a8d2e93132 From: Chao Yu To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] f2fs: skip writing in ->writepages when no dirty pages exist Date: Fri, 17 Jul 2015 18:02:39 +0800 Message-id: <01a301d0c077$d111a4a0$7334ede0$@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: AdDAd4jE0RNyvvC2TviiW0o3acXO6A== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrBLMWRmVeSWpSXmKPExsVy+t9jAd1Xl1aEGlwytniyfhazxaVF7haX d81hc2D22LSqk81j94LPTB6fN8kFMEdx2aSk5mSWpRbp2yVwZazceoe54CVbRcu3B8wNjKdY uxg5OSQETCRObZ3KCGGLSVy4t56ti5GLQ0hgEaPEzY132SGcV4wSTza3M4FUsQmoSCzv+A9m iwDZhxZdZgexmQU8JBo7voNNFRYIlrh0+hALiM0ioCpxbMcBsHpeAUuJLxs2Q9mCEj8m32OB 6NWSWL/zOBOELS+xec1bZoiLFCR2nH3NCLFLT2LVhQdsEDXiEhuP3GKZwCgwC8moWUhGzUIy ahaSlgWMLKsYRVMLkguKk9JzDfWKE3OLS/PS9ZLzczcxgsP3mdQOxpUNFocYBTgYlXh4G1xX hAqxJpYVV+YeYpTgYFYS4a3cCRTiTUmsrEotyo8vKs1JLT7EKM3BoiTOezLfJ1RIID2xJDU7 NbUgtQgmy8TBKdXAWJzmZKBxJfh054626HTGBVu9+sIZqrnCcuWfvX5+7sqSC+FvjZLC/hmv fPwnMODQ140LEzIF9fReXmN9VbE4Q4fhld3Jb20puSmf1kd75v51SmiYs17kwYndfPxKfilb X71WyJB6+7vJ/eKN7x0zLzNV7BT/uID7o8X6u001EYzy1oEHN4keUGIpzkg01GIuKk4EAMFu XSVbAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1090 Lines: 33 When flushing comes from background, if there is no dirty page in the mapping of inode, we'd better to skip seeking dirty page from mapping for writebacking. Signed-off-by: Chao Yu --- fs/f2fs/data.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index b621c08..5370a74 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1284,6 +1284,10 @@ static int f2fs_write_data_pages(struct address_space *mapping, if (!mapping->a_ops->writepage) return 0; + /* skip writing if there is no dirty page in this inode */ + if (!get_dirty_pages(inode) && wbc->sync_mode == WB_SYNC_NONE) + return 0; + if (S_ISDIR(inode->i_mode) && wbc->sync_mode == WB_SYNC_NONE && get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) && available_free_memory(sbi, DIRTY_DENTS)) -- 2.4.2 -- 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/