From: Christoph Hellwig <hch@infradead.org>
To: Nick Piggin <npiggin@suse.de>
Cc: Linux Memory Management List <linux-mm@kvack.org>,
linux-fsdevel@vger.kernel.org
Subject: Re: [patch][rfc] mm: new address space calls
Date: Sat, 28 Feb 2009 18:24:21 -0500 [thread overview]
Message-ID: <20090228232421.GB11191@infradead.org> (raw)
In-Reply-To: <20090225104839.GG22785@wotan.suse.de>
On Wed, Feb 25, 2009 at 11:48:39AM +0100, Nick Piggin wrote:
> This is about the last change to generic code I need for fsblock.
> Comments?
>
> Introduce new address space operations sync and release, which can be used
> by a filesystem to synchronize and release per-address_space private metadata.
> They generalise sync_mapping_buffers, invalidate_inode_buffers, and
> remove_inode_buffers calls, and get another step closer to divorcing
> buffer heads from core mm/fs code.
> void invalidate_inode_buffers(struct inode *inode)
> {
> - if (inode_has_buffers(inode)) {
> - struct address_space *mapping = &inode->i_data;
> + struct address_space *mapping = &inode->i_data;
> +
> + if (mapping_has_private(mapping)) {
> struct list_head *list = &mapping->private_list;
> struct address_space *buffer_mapping = mapping->assoc_mapping;
I'ts not really helping much here as we still directly poke into the
buffer_head list.
> --- linux-2.6.orig/fs/fs-writeback.c
> +++ linux-2.6/fs/fs-writeback.c
> @@ -782,9 +782,15 @@ int generic_osync_inode(struct inode *in
> if (what & OSYNC_DATA)
> err = filemap_fdatawrite(mapping);
> if (what & (OSYNC_METADATA|OSYNC_DATA)) {
> - err2 = sync_mapping_buffers(mapping);
> - if (!err)
> - err = err2;
> + if (!mapping->a_ops->sync) {
> + err2 = sync_mapping_buffers(mapping);
> + if (!err)
> + err = err2;
> + } else {
> + err2 = mapping->a_ops->sync(mapping);
> + if (!err)
> + err = err2;
> + }
> }
> if (what & OSYNC_DATA) {
> err2 = filemap_fdatawait(mapping);
I'd really prefer not having the default fallbacks, these kinds
of implicit fallbacks make the code really hard to maintain over
long term.
I also wonder if moving the filemap_fdatawrite/filemap_fdatawait
into the method would help. In fact it's surprisingly similar
to ->fsync in many ways, that I wonder if these should be one
operation.
> */
> void clear_inode(struct inode *inode)
> {
> + struct address_space *mapping = &inode->i_data;
> +
> might_sleep();
> - invalidate_inode_buffers(inode);
> + if (!mapping->a_ops->release)
> + invalidate_inode_buffers(inode);
That's a weird one. The implict default shouldn't be in a different
place from the method.
next prev parent reply other threads:[~2009-02-28 23:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-25 10:48 [patch][rfc] mm: new address space calls Nick Piggin
2009-02-25 20:59 ` Chris Mason
2009-02-26 5:17 ` Nick Piggin
2009-02-26 13:21 ` Chris Mason
2009-02-27 11:26 ` Nick Piggin
2009-02-27 13:52 ` Chris Mason
2009-02-28 5:52 ` Nick Piggin
2009-02-28 23:19 ` Christoph Hellwig
2009-03-01 2:38 ` Nick Piggin
2009-02-28 23:24 ` Christoph Hellwig [this message]
2009-03-01 2:45 ` Nick Piggin
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=20090228232421.GB11191@infradead.org \
--to=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=npiggin@suse.de \
/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).