aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/fs/btrfs
diff options
context:
space:
mode:
authorJohannes Thumshirn <jthumshirn@suse.de>2019-11-26 09:40:05 +0100
committerDavid Sterba <dsterba@suse.com>2020-01-20 16:40:53 +0100
commit3fff3975a7155c49b85736786c6bcb1dd9dcec18 (patch)
tree059bbadcaddd1effd9ce17a411d289d0ce55e82e /fs/btrfs
parentbtrfs: use simple_dir_inode_operations for placeholder subvolume directory (diff)
downloadwireguard-linux-3fff3975a7155c49b85736786c6bcb1dd9dcec18.tar.xz
wireguard-linux-3fff3975a7155c49b85736786c6bcb1dd9dcec18.zip
btrfs: decrement number of open devices after closing the device not before
In btrfs_close_one_device we're decrementing the number of open devices before we're calling btrfs_close_bdev(). As there is no intermediate exit between these points in this function it is technically OK to do so, but it makes the code a bit harder to understand. Move both operations closer together and move the decrement step after btrfs_close_bdev(). Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/volumes.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 07ef3d924aae..ac7b483754c4 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1069,9 +1069,6 @@ static void btrfs_close_one_device(struct btrfs_device *device)
struct btrfs_device *new_device;
struct rcu_string *name;
- if (device->bdev)
- fs_devices->open_devices--;
-
if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state) &&
device->devid != BTRFS_DEV_REPLACE_DEVID) {
list_del_init(&device->dev_alloc_list);
@@ -1082,6 +1079,8 @@ static void btrfs_close_one_device(struct btrfs_device *device)
fs_devices->missing_devices--;
btrfs_close_bdev(device);
+ if (device->bdev)
+ fs_devices->open_devices--;
new_device = btrfs_alloc_device(NULL, &device->devid,
device->uuid);