Message ID | 1448054323-23921-1-git-send-email-idryomov@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Nov 20, 2015 at 10:18 PM, Ilya Dryomov <idryomov@gmail.com> wrote: > - bd_acquire() and bd_forget() open-code bdgrab() and bdput() > - raw driver uses igrab() but never checks its return value and always > holds another ref from bind_set() while calling it, so it's > equivalent to bdgrab() > > Signed-off-by: Ilya Dryomov <idryomov@gmail.com> > --- > drivers/char/raw.c | 2 +- > fs/block_dev.c | 6 +++--- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/char/raw.c b/drivers/char/raw.c > index 60316fbaf295..9b9809b709a5 100644 > --- a/drivers/char/raw.c > +++ b/drivers/char/raw.c > @@ -71,7 +71,7 @@ static int raw_open(struct inode *inode, struct file *filp) > err = -ENODEV; > if (!bdev) > goto out; > - igrab(bdev->bd_inode); > + bdgrab(bdev); > err = blkdev_get(bdev, filp->f_mode | FMODE_EXCL, raw_open); > if (err) > goto out; > diff --git a/fs/block_dev.c b/fs/block_dev.c > index 6f8dd407c533..42ebf7b675c0 100644 > --- a/fs/block_dev.c > +++ b/fs/block_dev.c > @@ -682,7 +682,7 @@ static struct block_device *bd_acquire(struct inode *inode) > spin_lock(&bdev_lock); > bdev = inode->i_bdev; > if (bdev) { > - ihold(bdev->bd_inode); > + bdgrab(bdev); > spin_unlock(&bdev_lock); > return bdev; > } > @@ -698,7 +698,7 @@ static struct block_device *bd_acquire(struct inode *inode) > * So, we can access it via ->i_mapping always > * without igrab(). > */ > - ihold(bdev->bd_inode); > + bdgrab(bdev); > inode->i_bdev = bdev; > inode->i_mapping = bdev->bd_inode->i_mapping; > list_add(&inode->i_devices, &bdev->bd_inodes); > @@ -721,7 +721,7 @@ void bd_forget(struct inode *inode) > spin_unlock(&bdev_lock); > > if (bdev) > - iput(bdev->bd_inode); > + bdput(bdev); > } > > /** > -- > 2.4.3 Hello, Jens, Al - could one of you pick this cleanup up for 4.5-rc1? Thanks, Ilya -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 01/12/2016 08:18 AM, Ilya Dryomov wrote: > On Fri, Nov 20, 2015 at 10:18 PM, Ilya Dryomov <idryomov@gmail.com> wrote: >> - bd_acquire() and bd_forget() open-code bdgrab() and bdput() >> - raw driver uses igrab() but never checks its return value and always >> holds another ref from bind_set() while calling it, so it's >> equivalent to bdgrab() >> >> Signed-off-by: Ilya Dryomov <idryomov@gmail.com> >> --- >> drivers/char/raw.c | 2 +- >> fs/block_dev.c | 6 +++--- >> 2 files changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/char/raw.c b/drivers/char/raw.c >> index 60316fbaf295..9b9809b709a5 100644 >> --- a/drivers/char/raw.c >> +++ b/drivers/char/raw.c >> @@ -71,7 +71,7 @@ static int raw_open(struct inode *inode, struct file *filp) >> err = -ENODEV; >> if (!bdev) >> goto out; >> - igrab(bdev->bd_inode); >> + bdgrab(bdev); >> err = blkdev_get(bdev, filp->f_mode | FMODE_EXCL, raw_open); >> if (err) >> goto out; >> diff --git a/fs/block_dev.c b/fs/block_dev.c >> index 6f8dd407c533..42ebf7b675c0 100644 >> --- a/fs/block_dev.c >> +++ b/fs/block_dev.c >> @@ -682,7 +682,7 @@ static struct block_device *bd_acquire(struct inode *inode) >> spin_lock(&bdev_lock); >> bdev = inode->i_bdev; >> if (bdev) { >> - ihold(bdev->bd_inode); >> + bdgrab(bdev); >> spin_unlock(&bdev_lock); >> return bdev; >> } >> @@ -698,7 +698,7 @@ static struct block_device *bd_acquire(struct inode *inode) >> * So, we can access it via ->i_mapping always >> * without igrab(). >> */ >> - ihold(bdev->bd_inode); >> + bdgrab(bdev); >> inode->i_bdev = bdev; >> inode->i_mapping = bdev->bd_inode->i_mapping; >> list_add(&inode->i_devices, &bdev->bd_inodes); >> @@ -721,7 +721,7 @@ void bd_forget(struct inode *inode) >> spin_unlock(&bdev_lock); >> >> if (bdev) >> - iput(bdev->bd_inode); >> + bdput(bdev); >> } >> >> /** >> -- >> 2.4.3 > > Hello, > > Jens, Al - could one of you pick this cleanup up for 4.5-rc1? Added, thanks.
diff --git a/drivers/char/raw.c b/drivers/char/raw.c index 60316fbaf295..9b9809b709a5 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c @@ -71,7 +71,7 @@ static int raw_open(struct inode *inode, struct file *filp) err = -ENODEV; if (!bdev) goto out; - igrab(bdev->bd_inode); + bdgrab(bdev); err = blkdev_get(bdev, filp->f_mode | FMODE_EXCL, raw_open); if (err) goto out; diff --git a/fs/block_dev.c b/fs/block_dev.c index 6f8dd407c533..42ebf7b675c0 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -682,7 +682,7 @@ static struct block_device *bd_acquire(struct inode *inode) spin_lock(&bdev_lock); bdev = inode->i_bdev; if (bdev) { - ihold(bdev->bd_inode); + bdgrab(bdev); spin_unlock(&bdev_lock); return bdev; } @@ -698,7 +698,7 @@ static struct block_device *bd_acquire(struct inode *inode) * So, we can access it via ->i_mapping always * without igrab(). */ - ihold(bdev->bd_inode); + bdgrab(bdev); inode->i_bdev = bdev; inode->i_mapping = bdev->bd_inode->i_mapping; list_add(&inode->i_devices, &bdev->bd_inodes); @@ -721,7 +721,7 @@ void bd_forget(struct inode *inode) spin_unlock(&bdev_lock); if (bdev) - iput(bdev->bd_inode); + bdput(bdev); } /**
- bd_acquire() and bd_forget() open-code bdgrab() and bdput() - raw driver uses igrab() but never checks its return value and always holds another ref from bind_set() while calling it, so it's equivalent to bdgrab() Signed-off-by: Ilya Dryomov <idryomov@gmail.com> --- drivers/char/raw.c | 2 +- fs/block_dev.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)