From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754452AbcARKZ6 (ORCPT ); Mon, 18 Jan 2016 05:25:58 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:33717 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753977AbcARKZ5 (ORCPT ); Mon, 18 Jan 2016 05:25:57 -0500 X-AuditID: cbfee61a-f79266d000003652-40-569cbdb33680 From: Chao Yu To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/4] f2fs: relocate is_merged_page Date: Mon, 18 Jan 2016 18:24:59 +0800 Message-id: <01ab01d151da$9b9b1f50$d2d15df0$@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: AdFR2motYpezOKSUTtazJWTAmEkmHg== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsVy+t9jQd3Ne+eEGRyfKmrxZP0sZotLi9wt Lu+aw+bA7LFpVSebx+4Fn5k8Pm+SC2CO4rJJSc3JLEst0rdL4Mo4+2UzY8EZiYq5Jz8wNzDe E+5i5OSQEDCRWLnqDCuELSZx4d56ti5GLg4hgVmMEi/n7WaHcF4xSqz+9YsJpIpNQEViecd/ MFsEyD606DI7iM0s4CHR2PEdbJKwgKnE631X2UBsFgFVibMb/oLZvAKWErffnWWFsAUlfky+ xwLRqyWxfudxJghbXmLzmrfMEBcpSOw4+5oRYpeexOP109ggasQlNh65xTKBEehMhFGzkIya hWTULCQtCxhZVjFKpBYkFxQnpeca5qWW6xUn5haX5qXrJefnbmIEh/EzqR2MB3e5H2IU4GBU 4uF1ODs7TIg1say4MvcQowQHs5IIb/D6OWFCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeWsvRYYJ CaQnlqRmp6YWpBbBZJk4OKUaGGMD9z6pST595sMxnWMeKvO8+kJSXhjEJR1R5oz8f/Oa75q6 DWWBrBc3LdzvIlWZkHq06vzDnzfuHn/ouPj4nHDnqJ17Y3l+V003uHogyvnMRInQpIUzxTK0 7pb0cPpsaNe+t8nb48DnW12Xc7gvBnf5eT5xK1rdXRPn3vIrt6WjXOWqc07AIyWW4oxEQy3m ouJEAMHHVixfAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Operations in is_merged_page is related to inner bio cache, move it to data.c. Signed-off-by: Chao Yu --- fs/f2fs/data.c | 38 ++++++++++++++++++++++++++++++++++++++ fs/f2fs/f2fs.h | 1 + fs/f2fs/segment.c | 38 -------------------------------------- 3 files changed, 39 insertions(+), 38 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index ac9e7c6..b118055 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -116,6 +116,44 @@ static void __submit_merged_bio(struct f2fs_bio_info *io) io->bio = NULL; } +bool is_merged_page(struct f2fs_sb_info *sbi, struct page *page, + enum page_type type) +{ + enum page_type btype = PAGE_TYPE_OF_BIO(type); + struct f2fs_bio_info *io = &sbi->write_io[btype]; + struct bio_vec *bvec; + struct page *target; + int i; + + down_read(&io->io_rwsem); + if (!io->bio) { + up_read(&io->io_rwsem); + return false; + } + + bio_for_each_segment_all(bvec, io->bio, i) { + + if (bvec->bv_page->mapping) { + target = bvec->bv_page; + } else { + struct f2fs_crypto_ctx *ctx; + + /* encrypted page */ + ctx = (struct f2fs_crypto_ctx *)page_private( + bvec->bv_page); + target = ctx->w.control_page; + } + + if (page == target) { + up_read(&io->io_rwsem); + return true; + } + } + + up_read(&io->io_rwsem); + return false; +} + void f2fs_submit_merged_bio(struct f2fs_sb_info *sbi, enum page_type type, int rw) { diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 2c0e478..79cadd3 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1882,6 +1882,7 @@ void destroy_checkpoint_caches(void); /* * data.c */ +bool is_merged_page(struct f2fs_sb_info *, struct page *, enum page_type); void f2fs_submit_merged_bio(struct f2fs_sb_info *, enum page_type, int); int f2fs_submit_page_bio(struct f2fs_io_info *); void f2fs_submit_page_mbio(struct f2fs_io_info *); diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 5904a41..e16235b 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1415,44 +1415,6 @@ void f2fs_replace_block(struct f2fs_sb_info *sbi, struct dnode_of_data *dn, f2fs_update_extent_cache(dn); } -static inline bool is_merged_page(struct f2fs_sb_info *sbi, - struct page *page, enum page_type type) -{ - enum page_type btype = PAGE_TYPE_OF_BIO(type); - struct f2fs_bio_info *io = &sbi->write_io[btype]; - struct bio_vec *bvec; - struct page *target; - int i; - - down_read(&io->io_rwsem); - if (!io->bio) { - up_read(&io->io_rwsem); - return false; - } - - bio_for_each_segment_all(bvec, io->bio, i) { - - if (bvec->bv_page->mapping) { - target = bvec->bv_page; - } else { - struct f2fs_crypto_ctx *ctx; - - /* encrypted page */ - ctx = (struct f2fs_crypto_ctx *)page_private( - bvec->bv_page); - target = ctx->w.control_page; - } - - if (page == target) { - up_read(&io->io_rwsem); - return true; - } - } - - up_read(&io->io_rwsem); - return false; -} - void f2fs_wait_on_page_writeback(struct page *page, enum page_type type) { -- 2.6.3