提交 ebcc9301 编写于 作者: N Nikolay Borisov 提交者: David Sterba

btrfs: convert while loop to list_for_each_entry

No functional changes, just make the loop a bit more readable
Signed-off-by: NNikolay Borisov <nborisov@suse.com>
Reviewed-by: NDavid Sterba <dsterba@suse.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 ef954844
...@@ -4629,7 +4629,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, ...@@ -4629,7 +4629,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
{ {
struct btrfs_fs_info *info = trans->fs_info; struct btrfs_fs_info *info = trans->fs_info;
struct btrfs_fs_devices *fs_devices = info->fs_devices; struct btrfs_fs_devices *fs_devices = info->fs_devices;
struct list_head *cur; struct btrfs_device *device;
struct map_lookup *map = NULL; struct map_lookup *map = NULL;
struct extent_map_tree *em_tree; struct extent_map_tree *em_tree;
struct extent_map *em; struct extent_map *em;
...@@ -4703,22 +4703,15 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, ...@@ -4703,22 +4703,15 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
if (!devices_info) if (!devices_info)
return -ENOMEM; return -ENOMEM;
cur = fs_devices->alloc_list.next;
/* /*
* in the first pass through the devices list, we gather information * in the first pass through the devices list, we gather information
* about the available holes on each device. * about the available holes on each device.
*/ */
ndevs = 0; ndevs = 0;
while (cur != &fs_devices->alloc_list) { list_for_each_entry(device, &fs_devices->alloc_list, dev_alloc_list) {
struct btrfs_device *device;
u64 max_avail; u64 max_avail;
u64 dev_offset; u64 dev_offset;
device = list_entry(cur, struct btrfs_device, dev_alloc_list);
cur = cur->next;
if (!device->writeable) { if (!device->writeable) {
WARN(1, KERN_ERR WARN(1, KERN_ERR
"BTRFS: read-only device in alloc_list\n"); "BTRFS: read-only device in alloc_list\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册