From: Jan Kara <jack@suse.cz>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Jan Kara <jack@suse.cz>
Subject: [PATCH 1/3] bdi: Use parent filesystem BDI for inodes not capable of writeback
Date: Tue, 27 Jul 2010 19:04:59 +0200 [thread overview]
Message-ID: <1280250301-17603-2-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1280250301-17603-1-git-send-email-jack@suse.cz>
If inode->i_mapping->backing_dev_info is not capable of writeback
but the inode gets dirty (because inode itself has changed), use
inode lists of a bdi of a filesystem holding the device inode.
Forking the flusher thread just to do the writeout of a single
inode would be silly and generally bdi needn't be prepared to do
any writeback.
This is part of fixing a bug
https://bugzilla.kernel.org/show_bug.cgi?id=16312.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/fs-writeback.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index d5be169..00865aa 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -28,8 +28,6 @@
#include <linux/buffer_head.h>
#include "internal.h"
-#define inode_to_bdi(inode) ((inode)->i_mapping->backing_dev_info)
-
/*
* We don't actually have pdflush, but this one is exported though /proc...
*/
@@ -50,6 +48,21 @@ struct wb_writeback_work {
struct completion *done; /* set if the caller waits */
};
+static struct backing_dev_info *inode_to_bdi(struct inode *inode)
+{
+ struct backing_dev_info *bdi = inode->i_mapping->backing_dev_info;
+
+ /*
+ * This is a hack but it solves a problem with device inode
+ * for e.g. /dev/zero getting dirty (via touch or so) and confusing
+ * writeback code. In such cases we return the "parent" filesystem's
+ * bdi.
+ */
+ if (bdi_cap_writeback_dirty(bdi))
+ return bdi;
+ return inode->i_sb->s_bdi;
+}
+
/**
* writeback_in_progress - determine whether there is writeback in progress
* @bdi: the device's backing_dev_info structure.
--
1.6.4.2
next prev parent reply other threads:[~2010-07-27 17:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-27 17:04 [PATCH 0/3] Fix warnings in __mark_inode_dirty Jan Kara
2010-07-27 17:04 ` Jan Kara [this message]
2010-07-27 17:09 ` [PATCH 1/3] bdi: Use parent filesystem BDI for inodes not capable of writeback Christoph Hellwig
2010-07-27 17:24 ` Jan Kara
2010-07-27 17:27 ` Christoph Hellwig
2010-07-27 18:01 ` Jan Kara
2010-07-27 20:12 ` Christoph Hellwig
2010-07-27 20:21 ` Christoph Hellwig
2010-07-27 20:44 ` Jan Kara
2010-07-27 20:46 ` Christoph Hellwig
2010-07-29 8:12 ` Christoph Hellwig
2010-07-29 12:17 ` Jan Kara
2010-07-27 17:05 ` [PATCH 2/3] char: Mark /dev/zero and /dev/kmem as " Jan Kara
2010-07-27 17:05 ` [PATCH 3/3] bdi: Initialize noop_backing_dev_info properly Jan Kara
2010-07-27 17:09 ` Christoph Hellwig
2010-07-27 17:17 ` Jan Kara
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=1280250301-17603-2-git-send-email-jack@suse.cz \
--to=jack@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®