GIT: unionfs2-2.6.27.y: Unionfs: support lower filesystems without writeback capability

Erez Zadok ezk at fsl.cs.sunysb.edu
Thu Aug 12 23:17:17 EDT 2010


commit 52a1432e4e7f64bc53e0da2273954a2ec765f160
Author: Erez Zadok <ezk at cs.sunysb.edu>
Date:   Tue Oct 16 10:50:16 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 <penberg at cs.helsinki.fi>
    Signed-off-by: Erez Zadok <ezk at cs.sunysb.edu>

diff --git a/fs/unionfs/mmap.c b/fs/unionfs/mmap.c
index 6440282..b43557e 100644
--- a/fs/unionfs/mmap.c
+++ b/fs/unionfs/mmap.c
@@ -144,6 +144,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_cap_writeback_dirty(lower_inode->i_mapping))
+		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
@@ -374,6 +396,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 22a4b91..36dddd4 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -45,6 +45,7 @@
 #include <linux/log2.h>
 #include <linux/poison.h>
 #include <linux/mman.h>
+#include <linux/backing-dev.h>
 
 #include <asm/system.h>
 


More information about the unionfs-cvs mailing list