Commit b25f0d00 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Use while loop instead of labels in __endio_write_update_ordered

Currently __endio_write_update_ordered uses labels to implement
what is essentially a simple while loop. This makes the code more
cumbersome to follow than it actually has to be. No functional
changes. No xfstest regressions were found during testing.
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 89595e80
...@@ -8131,7 +8131,6 @@ static void __endio_write_update_ordered(struct inode *inode, ...@@ -8131,7 +8131,6 @@ static void __endio_write_update_ordered(struct inode *inode,
u64 ordered_offset = offset; u64 ordered_offset = offset;
u64 ordered_bytes = bytes; u64 ordered_bytes = bytes;
u64 last_offset; u64 last_offset;
int ret;
if (btrfs_is_free_space_inode(BTRFS_I(inode))) { if (btrfs_is_free_space_inode(BTRFS_I(inode))) {
wq = fs_info->endio_freespace_worker; wq = fs_info->endio_freespace_worker;
...@@ -8141,32 +8140,31 @@ static void __endio_write_update_ordered(struct inode *inode, ...@@ -8141,32 +8140,31 @@ static void __endio_write_update_ordered(struct inode *inode,
func = btrfs_endio_write_helper; func = btrfs_endio_write_helper;
} }
again: while (ordered_offset < offset + bytes) {
last_offset = ordered_offset; last_offset = ordered_offset;
ret = btrfs_dec_test_first_ordered_pending(inode, &ordered, if (btrfs_dec_test_first_ordered_pending(inode, &ordered,
&ordered_offset, &ordered_offset,
ordered_bytes, ordered_bytes,
uptodate); uptodate)) {
if (!ret) btrfs_init_work(&ordered->work, func,
goto out_test; finish_ordered_fn,
NULL, NULL);
btrfs_init_work(&ordered->work, func, finish_ordered_fn, NULL, NULL);
btrfs_queue_work(wq, &ordered->work); btrfs_queue_work(wq, &ordered->work);
out_test: }
/* /*
* If btrfs_dec_test_ordered_pending does not find any ordered extent * If btrfs_dec_test_ordered_pending does not find any ordered
* in the range, we can exit. * extent in the range, we can exit.
*/ */
if (ordered_offset == last_offset) if (ordered_offset == last_offset)
return; return;
/* /*
* our bio might span multiple ordered extents. If we haven't * Our bio might span multiple ordered extents. In this case
* completed the accounting for the whole dio, go back and try again * we keep goin until we have accounted the whole dio.
*/ */
if (ordered_offset < offset + bytes) { if (ordered_offset < offset + bytes) {
ordered_bytes = offset + bytes - ordered_offset; ordered_bytes = offset + bytes - ordered_offset;
ordered = NULL; ordered = NULL;
goto again; }
} }
} }
......
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