Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756893AbbBEKEp (ORCPT ); Thu, 5 Feb 2015 05:04:45 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:22226 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752311AbbBEKEn (ORCPT ); Thu, 5 Feb 2015 05:04:43 -0500 X-AuditID: cbfee61a-f79c06d000004e71-55-54d3403997f3 From: Chao Yu To: Jaegeuk Kim , Changman Lee Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] f2fs: use extent cache for dir Date: Thu, 05 Feb 2015 18:03:40 +0800 Message-id: <000a01d0412b$27eee070$77cca150$@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: AdBBFYoJbQwtwIubTxep7Anppyd5VQ== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrELMWRmVeSWpSXmKPExsVy+t9jQV0rh8shBrdlLK7ta2SyeLJ+FrPF pUXuFpd3zWFzYPHYtKqTzWP3gs9MHn1bVjF6fN4kF8ASxWWTkpqTWZZapG+XwJWx+sZOtoIt AhX/t05mamBs4+1i5OSQEDCR2HfiPDOELSZx4d56ti5GLg4hgemMErfPnmeHcH4wSjyd9YgJ pIpNQEViecd/MFtEwEti0v4TLCA2s4CHRGPHd1YQW1jAWKLn30awGhYBVYnlp2awgdi8ApYS T6YsY4awBSV+TL4H1aslsX7ncSYIW15i85q3UBcpSOw4+5oRYpeexKZ2iDnMAuISG4/cYpnA KDALyahZSEbNQjJqFpKWBYwsqxhFUwuSC4qT0nMN9YoTc4tL89L1kvNzNzGCQ/qZ1A7GlQ0W hxgFOBiVeHgt910KEWJNLCuuzD3EKMHBrCTCq8lxOUSINyWxsiq1KD++qDQntfgQozQHi5I4 r5J9W4iQQHpiSWp2ampBahFMlomDU6qBca6YdqH12wKB11qxzq7vtdVWRnDXage6T+9wEukq OjDnYJto8/N/759Zbaya3j+/ZTrHdmdmjZiq7PDPb7aePNCQfGFpfKfwxpblJ+9Z7Y9mENxo Z5s3S9baPSoyUW6NxoVzc19zdtlPPZZbJqkQflhx5qtnhacUxQ7u5TROyT59zcjIv+OBEktx RqKhFnNRcSIAH1sKc2UCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2272 Lines: 78 We update extent cache for all user inode of f2fs including dir inode, so this patch gives another chance to try to get physical address of page from extent cache for dir inode. Signed-off-by: Chao Yu --- fs/f2fs/data.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 45b97a5..f84c44a 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -806,6 +806,7 @@ struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync) struct address_space *mapping = inode->i_mapping; struct dnode_of_data dn; struct page *page; + struct extent_info ei; int err; struct f2fs_io_info fio = { .type = DATA, @@ -817,6 +818,11 @@ struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync) return page; f2fs_put_page(page, 0); + if (f2fs_lookup_extent_cache(inode, index, &ei)) { + dn.data_blkaddr = ei.blk + index - ei.fofs; + goto got_it; + } + set_new_dnode(&dn, inode, NULL, NULL, 0); err = get_dnode_of_data(&dn, index, LOOKUP_NODE); if (err) @@ -830,6 +836,7 @@ struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync) if (unlikely(dn.data_blkaddr == NEW_ADDR)) return ERR_PTR(-EINVAL); +got_it: page = grab_cache_page(mapping, index); if (!page) return ERR_PTR(-ENOMEM); @@ -864,6 +871,7 @@ struct page *get_lock_data_page(struct inode *inode, pgoff_t index) struct address_space *mapping = inode->i_mapping; struct dnode_of_data dn; struct page *page; + struct extent_info ei; int err; struct f2fs_io_info fio = { .type = DATA, @@ -874,6 +882,11 @@ repeat: if (!page) return ERR_PTR(-ENOMEM); + if (f2fs_lookup_extent_cache(inode, index, &ei)) { + dn.data_blkaddr = ei.blk + index - ei.fofs; + goto got_it; + } + set_new_dnode(&dn, inode, NULL, NULL, 0); err = get_dnode_of_data(&dn, index, LOOKUP_NODE); if (err) { @@ -887,6 +900,7 @@ repeat: return ERR_PTR(-ENOENT); } +got_it: if (PageUptodate(page)) return page; -- 2.2.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/