f2fs: remove the blk_plug usage in f2fs_write_data_pages
[platform/adaptation/renesas_rcar/renesas_kernel.git] / fs / f2fs / data.c
index 444c2a6..b1347fc 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/backing-dev.h>
 #include <linux/blkdev.h>
 #include <linux/bio.h>
+#include <linux/prefetch.h>
 
 #include "f2fs.h"
 #include "node.h"
@@ -343,11 +344,12 @@ int f2fs_readpage(struct f2fs_sb_info *sbi, struct page *page,
        down_read(&sbi->bio_sem);
 
        /* Allocate a new bio */
-       bio = f2fs_bio_alloc(bdev, blk_addr << (sbi->log_blocksize - 9),
-                               1, GFP_NOFS | __GFP_HIGH);
+       bio = f2fs_bio_alloc(bdev, 1);
 
        /* Initialize the bio */
+       bio->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
        bio->bi_end_io = read_end_io;
+
        if (bio_add_page(bio, page, PAGE_CACHE_SIZE, 0) < PAGE_CACHE_SIZE) {
                kfree(bio->bi_private);
                bio_put(bio);
@@ -545,6 +547,15 @@ redirty_out:
 
 #define MAX_DESIRED_PAGES_WP   4096
 
+static int __f2fs_writepage(struct page *page, struct writeback_control *wbc,
+                       void *data)
+{
+       struct address_space *mapping = data;
+       int ret = mapping->a_ops->writepage(page, wbc);
+       mapping_set_error(mapping, ret);
+       return ret;
+}
+
 static int f2fs_write_data_pages(struct address_space *mapping,
                            struct writeback_control *wbc)
 {
@@ -561,7 +572,7 @@ static int f2fs_write_data_pages(struct address_space *mapping,
 
        if (!S_ISDIR(inode->i_mode))
                mutex_lock(&sbi->writepages);
-       ret = generic_writepages(mapping, wbc);
+       ret = write_cache_pages(mapping, wbc, __f2fs_writepage, mapping);
        if (!S_ISDIR(inode->i_mode))
                mutex_unlock(&sbi->writepages);
        f2fs_submit_bio(sbi, DATA, (wbc->sync_mode == WB_SYNC_ALL));