Commit ef16e1d9 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

mm: cleanup claim_swapfile

Use blkdev_get_by_dev instead of bdgrab + blkdev_get.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e455ed22
...@@ -2920,10 +2920,10 @@ static int claim_swapfile(struct swap_info_struct *p, struct inode *inode) ...@@ -2920,10 +2920,10 @@ static int claim_swapfile(struct swap_info_struct *p, struct inode *inode)
int error; int error;
if (S_ISBLK(inode->i_mode)) { if (S_ISBLK(inode->i_mode)) {
p->bdev = bdgrab(I_BDEV(inode)); p->bdev = blkdev_get_by_dev(inode->i_rdev,
error = blkdev_get(p->bdev,
FMODE_READ | FMODE_WRITE | FMODE_EXCL, p); FMODE_READ | FMODE_WRITE | FMODE_EXCL, p);
if (error < 0) { if (IS_ERR(p->bdev)) {
error = PTR_ERR(p->bdev);
p->bdev = NULL; p->bdev = NULL;
return error; return error;
} }
......
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