From: Erez Zadok <ezk@cs.sunysb.edu>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
viro@ftp.linux.org.uk, hch@infradead.org,
Erez Zadok <ezk@cs.sunysb.edu>,
Pekka J Enberg <penberg@cs.helsinki.fi>
Subject: [PATCH 3/9] Unionfs: support lower filesystems without writeback capability
Date: Sun, 21 Oct 2007 19:51:16 -0400 [thread overview]
Message-ID: <11930106842801-git-send-email-ezk@cs.sunysb.edu> (raw)
In-Reply-To: <11930106823372-git-send-email-ezk@cs.sunysb.edu>
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@cs.helsinki.fi>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
fs/unionfs/mmap.c | 23 +++++++++++++++++++++++
fs/unionfs/union.h | 1 +
2 files changed, 24 insertions(+), 0 deletions(-)
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 8eb2ee4..6333488 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>
--
1.5.2.2
next prev parent reply other threads:[~2007-10-21 23:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-21 23:51 [GIT PULL -mm] 0/9 Unionfs updates/cleanups/fixes Erez Zadok
2007-10-21 23:51 ` [PATCH 1/9] Unionfs: security convert lsm into a static interface fix Erez Zadok
2007-10-22 8:22 ` Christoph Hellwig
2007-10-23 0:48 ` Erez Zadok
2007-10-23 9:07 ` Christoph Hellwig
2007-10-27 23:01 ` Erez Zadok
2007-10-21 23:51 ` [PATCH 2/9] Unionfs: slab api remove useless ctor parameter and reorder parameters Erez Zadok
2007-10-21 23:51 ` Erez Zadok [this message]
2007-10-21 23:51 ` [PATCH 4/9] Unionfs: don't printk trivial message upon normal rename-copyup Erez Zadok
2007-10-21 23:51 ` [PATCH 5/9] Unionfs: don't bother validating dentry if it has no lower branches Erez Zadok
2007-10-21 23:51 ` [PATCH 6/9] Unionfs: convert a printk to pr_debug in release Erez Zadok
2007-10-21 23:51 ` [PATCH 7/9] Unionfs: remove for_writepages nfs workaround Erez Zadok
2007-10-21 23:51 ` [PATCH 8/9] Unionfs: fix unionfs_setattr to handle ATTR_KILL_S*ID Erez Zadok
2007-10-21 23:51 ` [PATCH 9/9] Unionfs: remove obsolete #define and comment Erez Zadok
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11930106842801-git-send-email-ezk@cs.sunysb.edu \
--to=ezk@cs.sunysb.edu \
--cc=akpm@linux-foundation.org \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@cs.helsinki.fi \
--cc=viro@ftp.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).