summaryrefslogtreecommitdiffstats
path: root/mm/swapfile.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-09-21 09:19:54 +0200
committerJens Axboe <axboe@kernel.dk>2020-09-23 10:43:19 -0600
commitef16e1d98c4e05338ab9c381ac0100a4ed0626ca (patch)
treeb8fa6f09eaf457182290dbd43a24ad2196fb0883 /mm/swapfile.c
parente455ed22906c02c7638e127dbf60634765db02cd (diff)
downloadlinux-stable-ef16e1d98c4e05338ab9c381ac0100a4ed0626ca.tar.gz
linux-stable-ef16e1d98c4e05338ab9c381ac0100a4ed0626ca.tar.bz2
linux-stable-ef16e1d98c4e05338ab9c381ac0100a4ed0626ca.zip
mm: cleanup claim_swapfile
Use blkdev_get_by_dev instead of bdgrab + blkdev_get. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r--mm/swapfile.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 12f59e641b5e..7438c4affc75 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2920,10 +2920,10 @@ static int claim_swapfile(struct swap_info_struct *p, struct inode *inode)
int error;
if (S_ISBLK(inode->i_mode)) {
- p->bdev = bdgrab(I_BDEV(inode));
- error = blkdev_get(p->bdev,
+ p->bdev = blkdev_get_by_dev(inode->i_rdev,
FMODE_READ | FMODE_WRITE | FMODE_EXCL, p);
- if (error < 0) {
+ if (IS_ERR(p->bdev)) {
+ error = PTR_ERR(p->bdev);
p->bdev = NULL;
return error;
}