提交 08ffcae8 编写于 作者: D David Sterba

btrfs: simplify btrfs_close_bdev

Split the conditions a bit.
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 9c6b1c4d
...@@ -903,13 +903,15 @@ static void free_device_rcu(struct rcu_head *head) ...@@ -903,13 +903,15 @@ static void free_device_rcu(struct rcu_head *head)
static void btrfs_close_bdev(struct btrfs_device *device) static void btrfs_close_bdev(struct btrfs_device *device)
{ {
if (device->bdev && device->writeable) { if (!device->bdev)
return;
if (device->writeable) {
sync_blockdev(device->bdev); sync_blockdev(device->bdev);
invalidate_bdev(device->bdev); invalidate_bdev(device->bdev);
} }
if (device->bdev) blkdev_put(device->bdev, device->mode);
blkdev_put(device->bdev, device->mode);
} }
static void btrfs_prepare_close_one_device(struct btrfs_device *device) static void btrfs_prepare_close_one_device(struct btrfs_device *device)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册