linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] md - 10 of 10 - Use bd_disk->private data instead of bd_inode->u.generic_ip
@ 2004-01-16  1:19 NeilBrown
  0 siblings, 0 replies; only message in thread
From: NeilBrown @ 2004-01-16  1:19 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-raid

### Comments for ChangeSet

..to access 'mddev' from the inode pointer.  This is already
set up for us.

 ----------- Diffstat output ------------
 ./drivers/md/md.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff ./drivers/md/md.c~current~ ./drivers/md/md.c
--- ./drivers/md/md.c~current~	2004-01-16 12:08:10.000000000 +1100
+++ ./drivers/md/md.c	2004-01-16 12:08:45.000000000 +1100
@@ -2406,7 +2406,7 @@ static int md_ioctl(struct inode *inode,
 	 * Commands creating/starting a new array:
 	 */
 
-	mddev = inode->i_bdev->bd_inode->u.generic_ip;
+	mddev = inode->i_bdev->bd_disk->private_data;
 
 	if (!mddev) {
 		BUG();
@@ -2598,29 +2598,26 @@ abort:
 static int md_open(struct inode *inode, struct file *file)
 {
 	/*
-	 * Succeed if we can find or allocate a mddev structure.
+	 * Succeed if we can lock the mddev, which confirms that
+	 * it isn't being stopped right now.
 	 */
-	mddev_t *mddev = mddev_find(iminor(inode));
-	int err = -ENOMEM;
-
-	if (!mddev)
-		goto out;
+	mddev_t *mddev = inode->i_bdev->bd_disk->private_data;
+	int err;
 
 	if ((err = mddev_lock(mddev)))
-		goto put;
+		goto out;
 
 	err = 0;
+	mddev_get(mddev);
 	mddev_unlock(mddev);
-	inode->i_bdev->bd_inode->u.generic_ip = mddev_get(mddev);
- put:
-	mddev_put(mddev);
+
  out:
 	return err;
 }
 
 static int md_release(struct inode *inode, struct file * file)
 {
- 	mddev_t *mddev = inode->i_bdev->bd_inode->u.generic_ip;
+ 	mddev_t *mddev = inode->i_bdev->bd_disk->private_data;
 
 	if (!mddev)
 		BUG();

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-01-16  1:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-16  1:19 [PATCH] md - 10 of 10 - Use bd_disk->private data instead of bd_inode->u.generic_ip NeilBrown

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).