Commit 1538e6c5 authored by David Sterba's avatar David Sterba

btrfs: use non-RCU list traversal in write_all_supers callees

We take the fs_devices::device_list_mutex mutex in write_all_supers
which will prevent any add/del changes to the device list. Therefore we
don't need to use the RCU variant list_for_each_entry_rcu in any of the
called functions.
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent d03262c7
...@@ -3395,9 +3395,10 @@ static int barrier_all_devices(struct btrfs_fs_info *info) ...@@ -3395,9 +3395,10 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
int errors_wait = 0; int errors_wait = 0;
blk_status_t ret; blk_status_t ret;
lockdep_assert_held(&info->fs_devices->device_list_mutex);
/* send down all the barriers */ /* send down all the barriers */
head = &info->fs_devices->devices; head = &info->fs_devices->devices;
list_for_each_entry_rcu(dev, head, dev_list) { list_for_each_entry(dev, head, dev_list) {
if (dev->missing) if (dev->missing)
continue; continue;
if (!dev->bdev) if (!dev->bdev)
...@@ -3410,7 +3411,7 @@ static int barrier_all_devices(struct btrfs_fs_info *info) ...@@ -3410,7 +3411,7 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
} }
/* wait for all the barriers */ /* wait for all the barriers */
list_for_each_entry_rcu(dev, head, dev_list) { list_for_each_entry(dev, head, dev_list) {
if (dev->missing) if (dev->missing)
continue; continue;
if (!dev->bdev) { if (!dev->bdev) {
...@@ -3509,7 +3510,7 @@ int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors) ...@@ -3509,7 +3510,7 @@ int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors)
} }
} }
list_for_each_entry_rcu(dev, head, dev_list) { list_for_each_entry(dev, head, dev_list) {
if (!dev->bdev) { if (!dev->bdev) {
total_errors++; total_errors++;
continue; continue;
...@@ -3550,7 +3551,7 @@ int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors) ...@@ -3550,7 +3551,7 @@ int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors)
} }
total_errors = 0; total_errors = 0;
list_for_each_entry_rcu(dev, head, dev_list) { list_for_each_entry(dev, head, dev_list) {
if (!dev->bdev) if (!dev->bdev)
continue; continue;
if (!dev->in_fs_metadata || !dev->writeable) if (!dev->in_fs_metadata || !dev->writeable)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment