From: Boaz Harrosh <bharrosh@panasas.com>
To: Jan Kara <jack@suse.cz>, Christoph Hellwig <hch@infradead.org>,
Al Viro <viro@ZenIV.linux.org.uk>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>,
Benny Halevy <bhalevy@panasas.com>
Subject: Re: [RFC] vfs/inode: For none-block-based filesystems default to sb->s_bdi
Date: Mon, 04 Oct 2010 18:02:13 -0400 [thread overview]
Message-ID: <4CAA4EE5.2070308@panasas.com> (raw)
In-Reply-To: <4CAA4B1D.1010904@panasas.com>
On 10/04/2010 05:46 PM, Boaz Harrosh wrote:
>
> In alloc_inode (inode_init_always) in the case that sb->s_bdev
> is NULL. Should we not use sb->s_bdi as the default
> mapping->backing_dev_info?
>
> This fixes my none-block-based filesystem recent WARN_ON
> at fs/fs-writeback.c:87 inode_to_bdi()
>
> If not done here I'll need to do this in 5 different cases
> in FS code. (OK the code could enjoy some re-factoring).
>
> It does look logical the question is how many FSs will now
> get broken?
>
> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
> ---
> fs/inode.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/fs/inode.c b/fs/inode.c
> index 8646433..200314f 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -181,6 +181,8 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
>
> bdi = sb->s_bdev->bd_inode->i_mapping->backing_dev_info;
> mapping->backing_dev_info = bdi;
> + } else {
> + mapping->backing_dev_info = sb->s_bdi;
> }
> inode->i_private = NULL;
> inode->i_mapping = mapping;
Sorry I've just seen Jan's patch:
From: Jan Kara <jack@suse.cz>
Date: Mon, 27 Sep 2010 23:56:48 +0200
Subject: [PATCH] bdi: Initialize inode->i_mapping.backing_dev_info to sb->s_bdi
Currently, we initialize inode->i_mapping.backing_dev_info to the bdi of device
sb->s_bdev points to. However there is quite a big number of filesystems that
do not set sb->s_bdev (because they do not have one) but do set sb->s_bdi.
These filesystems would generally benefit from setting
inode->i_mapping.backing_dev_info to their s_bdi because otherwise their inodes
would point to default_backing_dev_info and thus dirty inode tracking would
happen there. So change inode initialization code to use sb->s_bdi if it
is available.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/inode.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/fs/inode.c b/fs/inode.c
index 8646433..e415be4 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -172,15 +172,21 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
mapping->writeback_index = 0;
/*
- * If the block_device provides a backing_dev_info for client
- * inodes then use that. Otherwise the inode share the bdev's
- * backing_dev_info.
+ * If the filesystem provides a backing_dev_info for client inodes
+ * then use that. Otherwise inodes share default_backing_dev_info.
*/
- if (sb->s_bdev) {
- struct backing_dev_info *bdi;
-
- bdi = sb->s_bdev->bd_inode->i_mapping->backing_dev_info;
- mapping->backing_dev_info = bdi;
+ if (sb->s_bdi && sb->s_bdi != &noop_backing_dev_info) {
+ /*
+ * Catch cases where filesystem might be bitten by using s_bdi
+ * instead of sb->s_bdev. Can be removed in 2.6.38.
+ */
+ if (sb->s_bdev) {
+ struct backing_dev_info *bdi =
+ sb->s_bdev->bd_inode->i_mapping->backing_dev_info;
+ WARN(bdi != sb->s_bdi, "s_bdev bdi %s != s_bdi %s\n",
+ bdi->name, sb->s_bdi->name);
+ }
+ mapping->backing_dev_info = sb->s_bdi;
}
inode->i_private = NULL;
inode->i_mapping = mapping;
That works for me as well. Was it decided how to solve this? Other wise
I'll need to patch exofs, ASAP for this -rc
Thanks
Boaz
next prev parent reply other threads:[~2010-10-04 22:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-04 21:46 [RFC] vfs/inode: For none-block-based filesystems default to sb->s_bdi Boaz Harrosh
2010-10-04 22:02 ` Boaz Harrosh [this message]
2010-10-05 8:32 ` Jan Kara
2010-10-05 13:53 ` Boaz Harrosh
2010-10-05 13:54 ` Boaz Harrosh
2010-10-05 15:12 ` Jan Kara
2010-10-05 15:09 ` Jan Kara
2010-10-05 15:29 ` Boaz Harrosh
2010-10-05 15:50 ` Jan Kara
2010-10-06 8:55 ` Christoph Hellwig
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=4CAA4EE5.2070308@panasas.com \
--to=bharrosh@panasas.com \
--cc=Trond.Myklebust@netapp.com \
--cc=bhalevy@panasas.com \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@ZenIV.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.