]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/mpage.c
Merge branch 'akpm-current/current'
[karo-tx-linux.git] / fs / mpage.c
index 7d29c863c05214509afc5986a02820b719ab7e6e..1480d3a180370fe3922a7724e613d09b896f9d00 100644 (file)
@@ -485,6 +485,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
        struct buffer_head map_bh;
        loff_t i_size = i_size_read(inode);
        int ret = 0;
+       int wr = (wbc->sync_mode == WB_SYNC_ALL ?  WRITE_SYNC : WRITE);
 
        if (page_has_buffers(page)) {
                struct buffer_head *head = page_buffers(page);
@@ -593,7 +594,7 @@ page_is_mapped:
         * This page will go to BIO.  Do we need to send this BIO off first?
         */
        if (bio && mpd->last_block_in_bio != blocks[0] - 1)
-               bio = mpage_bio_submit(WRITE, bio);
+               bio = mpage_bio_submit(wr, bio);
 
 alloc_new:
        if (bio == NULL) {
@@ -620,7 +621,7 @@ alloc_new:
        wbc_account_io(wbc, page, PAGE_SIZE);
        length = first_unmapped << blkbits;
        if (bio_add_page(bio, page, length, 0) < length) {
-               bio = mpage_bio_submit(WRITE, bio);
+               bio = mpage_bio_submit(wr, bio);
                goto alloc_new;
        }
 
@@ -630,7 +631,7 @@ alloc_new:
        set_page_writeback(page);
        unlock_page(page);
        if (boundary || (first_unmapped != blocks_per_page)) {
-               bio = mpage_bio_submit(WRITE, bio);
+               bio = mpage_bio_submit(wr, bio);
                if (boundary_block) {
                        write_boundary_block(boundary_bdev,
                                        boundary_block, 1 << blkbits);
@@ -642,7 +643,7 @@ alloc_new:
 
 confused:
        if (bio)
-               bio = mpage_bio_submit(WRITE, bio);
+               bio = mpage_bio_submit(wr, bio);
 
        if (mpd->use_writepage) {
                ret = mapping->a_ops->writepage(page, wbc);
@@ -698,8 +699,11 @@ mpage_writepages(struct address_space *mapping,
                };
 
                ret = write_cache_pages(mapping, wbc, __mpage_writepage, &mpd);
-               if (mpd.bio)
-                       mpage_bio_submit(WRITE, mpd.bio);
+               if (mpd.bio) {
+                       int wr = (wbc->sync_mode == WB_SYNC_ALL ?
+                                 WRITE_SYNC : WRITE);
+                       mpage_bio_submit(wr, mpd.bio);
+               }
        }
        blk_finish_plug(&plug);
        return ret;
@@ -716,8 +720,11 @@ int mpage_writepage(struct page *page, get_block_t get_block,
                .use_writepage = 0,
        };
        int ret = __mpage_writepage(page, wbc, &mpd);
-       if (mpd.bio)
-               mpage_bio_submit(WRITE, mpd.bio);
+       if (mpd.bio) {
+               int wr = (wbc->sync_mode == WB_SYNC_ALL ?
+                         WRITE_SYNC : WRITE);
+               mpage_bio_submit(wr, mpd.bio);
+       }
        return ret;
 }
 EXPORT_SYMBOL(mpage_writepage);