commit 6ff8e6e0cab7481dd72d3f42f20054da2aaa4b3f
Author: Erez Zadok <[EMAIL PROTECTED]>
Date:   Thu Oct 18 19:06:39 2007 -0400

    Unionfs: support lower filesystems without writeback capability
    
    Implement unionfs_writepages.  As per
    mm/filemap.c:__filemap_fdatawrite_range(), don't call our writepage if the
    lower mapping has BDI_CAP_NO_WRITEBACK capability set.
    
    Signed-off-by: Pekka J Enberg <[EMAIL PROTECTED]>
    Signed-off-by: Erez Zadok <[EMAIL PROTECTED]>

diff --git a/fs/unionfs/mmap.c b/fs/unionfs/mmap.c
index 4ac5a8a..35a1755 100644
--- a/fs/unionfs/mmap.c
+++ b/fs/unionfs/mmap.c
@@ -140,6 +140,28 @@ out:
        return err;
 }
 
+static int unionfs_writepages(struct address_space *mapping,
+                             struct writeback_control *wbc)
+{
+       int err = 0;
+       struct inode *lower_inode;
+       struct inode *inode;
+
+       inode = mapping->host;
+       lower_inode = unionfs_lower_inode(inode);
+       BUG_ON(!lower_inode);
+
+        if (mapping->backing_dev_info->memory_backed)
+               goto out;
+
+       /* Note: generic_writepages may return AOP_WRITEPAGE_ACTIVATE */
+       err = generic_writepages(mapping, wbc);
+       if (err == 0)
+               unionfs_copy_attr_times(inode);
+out:
+       return err;
+}
+
 /*
  * readpage is called from generic_page_read and the fault handler.
  * If your file system uses generic_page_read for the read op, it
@@ -372,6 +394,7 @@ out:
 
 struct address_space_operations unionfs_aops = {
        .writepage      = unionfs_writepage,
+       .writepages     = unionfs_writepages,
        .readpage       = unionfs_readpage,
        .prepare_write  = unionfs_prepare_write,
        .commit_write   = unionfs_commit_write,
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index 6548dd8..18c430d 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -42,6 +42,8 @@
 #include <linux/xattr.h>
 #include <linux/fs_stack.h>
 #include <linux/mman.h>
+#include <linux/backing-dev.h>
+#include <linux/mpage.h>
 
 #include <asm/system.h>
 
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to