提交 3fff3975 编写于 作者: J Johannes Thumshirn 提交者: David Sterba

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: NQu Wenruo <wqu@suse.com>
Signed-off-by: NJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: NDavid Sterba <dsterba@suse.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 6bb6b514
...@@ -1069,9 +1069,6 @@ static void btrfs_close_one_device(struct btrfs_device *device) ...@@ -1069,9 +1069,6 @@ static void btrfs_close_one_device(struct btrfs_device *device)
struct btrfs_device *new_device; struct btrfs_device *new_device;
struct rcu_string *name; struct rcu_string *name;
if (device->bdev)
fs_devices->open_devices--;
if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state) && if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state) &&
device->devid != BTRFS_DEV_REPLACE_DEVID) { device->devid != BTRFS_DEV_REPLACE_DEVID) {
list_del_init(&device->dev_alloc_list); list_del_init(&device->dev_alloc_list);
...@@ -1082,6 +1079,8 @@ static void btrfs_close_one_device(struct btrfs_device *device) ...@@ -1082,6 +1079,8 @@ static void btrfs_close_one_device(struct btrfs_device *device)
fs_devices->missing_devices--; fs_devices->missing_devices--;
btrfs_close_bdev(device); btrfs_close_bdev(device);
if (device->bdev)
fs_devices->open_devices--;
new_device = btrfs_alloc_device(NULL, &device->devid, new_device = btrfs_alloc_device(NULL, &device->devid,
device->uuid); device->uuid);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册