GIT: unionfs2-2.6.27.y: Unionfs: reintroduce a bmap method

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


commit ea48fe11ce13c414af81a17c2f8224b44ba91fa9
Author: Erez Zadok <ezk at cs.sunysb.edu>
Date:   Sat Nov 24 16:43:36 2007 -0500

    Unionfs: reintroduce a bmap method
    
    This is needed for swapon(2) files in the union.
    
    Signed-off-by: Erez Zadok <ezk at cs.sunysb.edu>

diff --git a/fs/unionfs/mmap.c b/fs/unionfs/mmap.c
index 3f65e52..fa358ef 100644
--- a/fs/unionfs/mmap.c
+++ b/fs/unionfs/mmap.c
@@ -304,10 +304,33 @@ out:
 	return err;		/* assume all is ok */
 }
 
+/*
+ * Although unionfs isn't a block-based file system, it may stack on one.
+ * ->bmap is needed, for example, to swapon(2) files.
+ */
+sector_t unionfs_bmap(struct address_space *mapping, sector_t block)
+{
+	int err = -EINVAL;
+	struct inode *inode, *lower_inode;
+	sector_t (*bmap)(struct address_space *, sector_t);
+
+	inode = (struct inode *)mapping->host;
+	lower_inode = unionfs_lower_inode(inode);
+	if (!lower_inode)
+		goto out;
+	bmap = lower_inode->i_mapping->a_ops->bmap;
+	if (bmap)
+		err = bmap(lower_inode->i_mapping, block);
+out:
+	return err;
+}
+
+
 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,
+	.bmap		= unionfs_bmap,
 };


More information about the unionfs-cvs mailing list