]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/ext4/page-io.c
Merge branch 'akpm-current/current'
[karo-tx-linux.git] / fs / ext4 / page-io.c
index 1a64e7a52b841be24ddd3daa56cb47939f07656c..b24a2541a9baaa0d4c22e80a75050af2517a417d 100644 (file)
@@ -401,7 +401,8 @@ submit_and_retry:
 int ext4_bio_write_page(struct ext4_io_submit *io,
                        struct page *page,
                        int len,
-                       struct writeback_control *wbc)
+                       struct writeback_control *wbc,
+                       bool keep_towrite)
 {
        struct inode *inode = page->mapping->host;
        unsigned block_start, blocksize;
@@ -414,9 +415,23 @@ int ext4_bio_write_page(struct ext4_io_submit *io,
        BUG_ON(!PageLocked(page));
        BUG_ON(PageWriteback(page));
 
-       set_page_writeback(page);
+       if (keep_towrite)
+               set_page_writeback_keepwrite(page);
+       else
+               set_page_writeback(page);
        ClearPageError(page);
 
+       /*
+        * Comments copied from block_write_full_page:
+        *
+        * The page straddles i_size.  It must be zeroed out on each and every
+        * writepage invocation because it may be mmapped.  "A file is mapped
+        * in multiples of the page size.  For a file that is not a multiple of
+        * the page size, the remaining memory is zeroed when mapped, and
+        * writes to that region are not written out to the file."
+        */
+       if (len < PAGE_CACHE_SIZE)
+               zero_user_segment(page, len, PAGE_CACHE_SIZE);
        /*
         * In the first loop we prepare and mark buffers to submit. We have to
         * mark all buffers in the page before submitting so that
@@ -428,19 +443,6 @@ int ext4_bio_write_page(struct ext4_io_submit *io,
        do {
                block_start = bh_offset(bh);
                if (block_start >= len) {
-                       /*
-                        * Comments copied from block_write_full_page:
-                        *
-                        * The page straddles i_size.  It must be zeroed out on
-                        * each and every writepage invocation because it may
-                        * be mmapped.  "A file is mapped in multiples of the
-                        * page size.  For a file that is not a multiple of
-                        * the  page size, the remaining memory is zeroed when
-                        * mapped, and writes to that region are not written
-                        * out to the file."
-                        */
-                       zero_user_segment(page, block_start,
-                                         block_start + blocksize);
                        clear_buffer_dirty(bh);
                        set_buffer_uptodate(bh);
                        continue;