summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/data.c
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2016-01-18 18:24:59 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2016-02-22 16:07:23 -0800
commit0fd785eb931d254a4ea4abd42f1c0c5a17f7132a (patch)
treee50c1e5252a45fea1217c8cb52c703e4d02a0afc /fs/f2fs/data.c
parent4de8ebeff8ddefaceeb7fc6a9b1a514fc9624509 (diff)
downloadlinux-0fd785eb931d254a4ea4abd42f1c0c5a17f7132a.tar.gz
linux-0fd785eb931d254a4ea4abd42f1c0c5a17f7132a.tar.bz2
linux-0fd785eb931d254a4ea4abd42f1c0c5a17f7132a.zip
f2fs: relocate is_merged_page
Operations in is_merged_page is related to inner bio cache, move it to data.c. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r--fs/f2fs/data.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 5c06db17e41f..7fff6ac3d0cb 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)
{