Commit 66a6ef19 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] md: Use bd_disk->private data instead of bd_inode->u.generic_ip

From: NeilBrown <neilb@cse.unsw.edu.au>

..to access 'mddev' from the inode pointer.  This is already set up for us.
parent d45e66f8
...@@ -2410,7 +2410,7 @@ static int md_ioctl(struct inode *inode, struct file *file, ...@@ -2410,7 +2410,7 @@ static int md_ioctl(struct inode *inode, struct file *file,
* Commands creating/starting a new array: * 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) { if (!mddev) {
BUG(); BUG();
...@@ -2602,29 +2602,26 @@ static int md_ioctl(struct inode *inode, struct file *file, ...@@ -2602,29 +2602,26 @@ static int md_ioctl(struct inode *inode, struct file *file,
static int md_open(struct inode *inode, struct file *file) 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)); mddev_t *mddev = inode->i_bdev->bd_disk->private_data;
int err = -ENOMEM; int err;
if (!mddev)
goto out;
if ((err = mddev_lock(mddev))) if ((err = mddev_lock(mddev)))
goto put; goto out;
err = 0; err = 0;
mddev_get(mddev);
mddev_unlock(mddev); mddev_unlock(mddev);
inode->i_bdev->bd_inode->u.generic_ip = mddev_get(mddev);
put:
mddev_put(mddev);
out: out:
return err; return err;
} }
static int md_release(struct inode *inode, struct file * file) 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) if (!mddev)
BUG(); BUG();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment