diff options
author | Nikolay Borisov <nborisov@suse.com> | 2020-06-17 12:10:44 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-07-27 12:55:27 +0200 |
commit | 4e9d0d0109d6b7ababf4d121168b0e97e4ae2f9d (patch) | |
tree | 5b2e1352664766051be2ac584c883585a0107f04 /fs/btrfs | |
parent | 214e61d07e1ab9e497c081d1bad78d05f7c33abf (diff) | |
download | linux-4e9d0d0109d6b7ababf4d121168b0e97e4ae2f9d.tar.bz2 |
btrfs: use for loop in prealloc_file_extent_cluster
This function iterates all extents in the extent cluster, make this
intention obvious by using a for loop. No functional chanes.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
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/relocation.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index f7feada38d19..e3f3e2e70212 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -2580,7 +2580,7 @@ int prealloc_file_extent_cluster(struct inode *inode, u64 end; u64 offset = BTRFS_I(inode)->index_cnt; u64 num_bytes; - int nr = 0; + int nr; int ret = 0; u64 prealloc_start = cluster->start - offset; u64 prealloc_end = cluster->end - offset; @@ -2593,7 +2593,7 @@ int prealloc_file_extent_cluster(struct inode *inode, return ret; inode_lock(inode); - while (nr < cluster->nr) { + for (nr = 0; nr < cluster->nr; nr++) { start = cluster->boundary[nr] - offset; if (nr + 1 < cluster->nr) end = cluster->boundary[nr + 1] - 1 - offset; @@ -2609,7 +2609,6 @@ int prealloc_file_extent_cluster(struct inode *inode, unlock_extent(&BTRFS_I(inode)->io_tree, start, end); if (ret) break; - nr++; } inode_unlock(inode); |