summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorDavid Sterba2017-06-19 16:55:35 +0200
committerDavid Sterba2018-01-22 16:08:12 +0100
commit08ffcae8c92e7154ba5fb78c926463a21cba6501 (patch)
treeb9b66a4f6c5347a23a3868bc4d36f977f36fbc3f /fs/btrfs/volumes.c
parentbtrfs: document device locking (diff)
downloadkernel-qcow2-linux-08ffcae8c92e7154ba5fb78c926463a21cba6501.tar.gz
kernel-qcow2-linux-08ffcae8c92e7154ba5fb78c926463a21cba6501.tar.xz
kernel-qcow2-linux-08ffcae8c92e7154ba5fb78c926463a21cba6501.zip
btrfs: simplify btrfs_close_bdev
Split the conditions a bit. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 372f515808d1..96c6c0fa1531 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -903,13 +903,15 @@ static void free_device_rcu(struct rcu_head *head)
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);
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)