f2fs: relocate is_merged_page
authorChao Yu <chao2.yu@samsung.com>
Mon, 18 Jan 2016 10:24:59 +0000 (18:24 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 23 Feb 2016 00:07:23 +0000 (16:07 -0800)
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>
fs/f2fs/data.c
fs/f2fs/f2fs.h
fs/f2fs/segment.c

index 5c06db17e41fa267f5b270061d2959b2a36803e4..7fff6ac3d0cb90fce727e788bdee866c448eb7e4 100644 (file)
@@ -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)
 {
index ff79054c6cf6a5bfe254abaf203ae94acd44739b..e41ffc1f54d1b65d6e871c8657f72c64dec81d76 100644 (file)
@@ -1880,6 +1880,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 *);
index 5904a411c86fe8d4feb70f695809273b3a46bd6a..e16235bbdd7df002eb74a2f90fd0135989f5286a 100644 (file)
@@ -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)
 {