public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: cmm@us.ibm.com, tytso@mit.edu, sandeen@redhat.com
Cc: linux-ext4@vger.kernel.org,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Subject: [RFC PATCH 2/2] ext[34]: Make sure we initialize the b_bdev field of dummy buffer_heads
Date: Thu, 12 Nov 2009 00:01:00 +0530	[thread overview]
Message-ID: <1257964260-14020-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com> (raw)
In-Reply-To: <1257964260-14020-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>

buffer_head flag update trace point look at the b_bdev field to track
the backing device. For dummy buffer_heads used we expect this to be
NULL.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 fs/buffer.c       |    1 +
 fs/ext3/inode.c   |    1 +
 fs/ext4/inode.c   |    1 +
 fs/jbd/journal.c  |    1 +
 fs/jbd2/journal.c |    2 ++
 fs/mpage.c        |    1 +
 6 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 6f441aa..5c60fa3 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2923,6 +2923,7 @@ sector_t generic_block_bmap(struct address_space *mapping, sector_t block,
 	struct inode *inode = mapping->host;
 	tmp.b_state = 0;
 	tmp.b_blocknr = 0;
+	tmp.b_bdev = NULL;
 	tmp.b_size = 1 << inode->i_blkbits;
 	get_block(inode, block, &tmp, 0);
 	return tmp.b_blocknr;
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index acf1b14..c7508aa 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -1007,6 +1007,7 @@ struct buffer_head *ext3_getblk(handle_t *handle, struct inode *inode,
 
 	dummy.b_state = 0;
 	dummy.b_blocknr = -1000;
+	dummy.b_bdev = NULL;
 	buffer_trace_init(&dummy.b_history);
 	err = ext3_get_blocks_handle(handle, inode, block, 1,
 					&dummy, create);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 5c5bc5d..dcb362d 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1392,6 +1392,7 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode,
 
 	dummy.b_state = 0;
 	dummy.b_blocknr = -1000;
+	dummy.b_bdev = NULL;
 	buffer_trace_init(&dummy.b_history);
 	if (create)
 		flags |= EXT4_GET_BLOCKS_CREATE;
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index bd3c073..1572a08 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -303,6 +303,7 @@ int journal_write_metadata_buffer(transaction_t *transaction,
 	new_bh = alloc_buffer_head(GFP_NOFS|__GFP_NOFAIL);
 	/* keep subsequent assertions sane */
 	new_bh->b_state = 0;
+	new_bh->b_bdev = NULL;
 	init_buffer(new_bh, NULL, NULL);
 	atomic_set(&new_bh->b_count, 1);
 	new_jh = journal_add_journal_head(new_bh);	/* This sleeps */
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index b0ab521..f18af08 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -2250,6 +2250,8 @@ const char *jbd2_dev_to_name(dev_t device)
 	struct block_device *bd;
 	static struct devname_cache *new_dev;
 
+	if (!device)
+		return "NULL";
 	rcu_read_lock();
 	if (devcache[i] && devcache[i]->device == device) {
 		ret = devcache[i]->devname;
diff --git a/fs/mpage.c b/fs/mpage.c
index 42381bd..eb72426 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -381,6 +381,7 @@ mpage_readpages(struct address_space *mapping, struct list_head *pages,
 
 	map_bh.b_state = 0;
 	map_bh.b_size = 0;
+	map_bh.b_bdev = NULL;
 	for (page_idx = 0; page_idx < nr_pages; page_idx++) {
 		struct page *page = list_entry(pages->prev, struct page, lru);
 
-- 
1.6.5.2.74.g610f9


  reply	other threads:[~2009-11-11 18:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-11 18:30 [RFC PATCH 1/2] vfs: tracepoints for buffer flag updates Aneesh Kumar K.V
2009-11-11 18:31 ` Aneesh Kumar K.V [this message]
2009-11-11 18:39 ` Aneesh Kumar K.V

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=1257964260-14020-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=cmm@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --cc=tytso@mit.edu \
    /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