提交 47816282 编写于 作者: C Christoph Hellwig 提交者: Jens Axboe

block: cleanup blkdev_bszset

Use blkdev_get_by_dev instead of bdgrab + blkdev_get.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 9301fe73
...@@ -478,15 +478,14 @@ static int blkdev_bszset(struct block_device *bdev, fmode_t mode, ...@@ -478,15 +478,14 @@ static int blkdev_bszset(struct block_device *bdev, fmode_t mode,
if (get_user(n, argp)) if (get_user(n, argp))
return -EFAULT; return -EFAULT;
if (!(mode & FMODE_EXCL)) { if (mode & FMODE_EXCL)
bdgrab(bdev); return set_blocksize(bdev, n);
if (blkdev_get(bdev, mode | FMODE_EXCL, &bdev) < 0)
return -EBUSY;
}
if (IS_ERR(blkdev_get_by_dev(bdev->bd_dev, mode | FMODE_EXCL, &bdev)))
return -EBUSY;
ret = set_blocksize(bdev, n); ret = set_blocksize(bdev, n);
if (!(mode & FMODE_EXCL)) blkdev_put(bdev, mode | FMODE_EXCL);
blkdev_put(bdev, mode | FMODE_EXCL);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册