From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: linux-kernel@vger.kernel.org
Cc: Neil Brown <neilb@cse.unsw.edu.au>, Ingo Molnar <mingo@elte.hu>,
Arjan van de Ven <arjan@linux.intel.com>,
Andrew Morton <akpm@osdl.org>, Jason Baron <jbaron@redhat.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [PATCH 2/2] new bd_mutex lockdep annotation
Date: Wed, 13 Sep 2006 19:43:14 +0200 [thread overview]
Message-ID: <20060913174650.432175000@chello.nl> (raw)
In-Reply-To: 20060913174312.528491000@chello.nl
[-- Attachment #1: new_block_annotation.patch --]
[-- Type: text/plain, Size: 1249 bytes --]
Use the gendisk partition number to set a lock class.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Andrew Morton <akpm@osdl.org>
Cc: Jason Baron <jbaron@redhat.com>
---
fs/block_dev.c | 9 +++++++++
1 file changed, 9 insertions(+)
Index: linux-2.6-mm/fs/block_dev.c
===================================================================
--- linux-2.6-mm.orig/fs/block_dev.c
+++ linux-2.6-mm/fs/block_dev.c
@@ -357,10 +357,14 @@ static int bdev_set(struct inode *inode,
static LIST_HEAD(all_bdevs);
+static struct lock_class_key bdev_part_lock_key;
+
struct block_device *bdget(dev_t dev)
{
struct block_device *bdev;
struct inode *inode;
+ struct gendisk *disk;
+ int part = 0;
inode = iget5_locked(bd_mnt->mnt_sb, hash(dev),
bdev_test, bdev_set, &dev);
@@ -386,6 +390,11 @@ struct block_device *bdget(dev_t dev)
list_add(&bdev->bd_list, &all_bdevs);
spin_unlock(&bdev_lock);
unlock_new_inode(inode);
+ mutex_init(&bdev->bd_mutex);
+ disk = get_gendisk(dev, &part);
+ if (part)
+ lockdep_set_class(&bdev->bd_mutex, &bdev_part_lock_key);
+ put_disk(disk);
}
return bdev;
}
--
next prev parent reply other threads:[~2006-09-13 17:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-13 17:43 [PATCH 0/2] new bd_mutex lockdep annotation Peter Zijlstra
2006-09-13 17:43 ` [PATCH 1/2] remove the old " Peter Zijlstra
2006-09-13 17:43 ` Peter Zijlstra [this message]
2006-09-13 18:15 ` [PATCH 2/2] new " Arjan van de Ven
2006-09-14 7:11 ` Neil Brown
2006-09-14 8:50 ` Peter Zijlstra
2006-09-29 18:30 ` Peter Zijlstra
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=20060913174650.432175000@chello.nl \
--to=a.p.zijlstra@chello.nl \
--cc=akpm@osdl.org \
--cc=arjan@linux.intel.com \
--cc=jbaron@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=neilb@cse.unsw.edu.au \
/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.