summaryrefslogtreecommitdiff
path: root/fs/btrfs
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2021-06-01 09:08:15 +0300
committerDavid Sterba <dsterba@suse.com>2021-06-21 15:19:10 +0200
commit77d255348bb2ce9a174cca020aa38f2ce82cb2bc (patch)
treeb7439564dfce250e0c19915c189791f1e77709ba /fs/btrfs
parent3d078efae6f3854eadf9def9cbb4f30389c0c504 (diff)
btrfs: eliminate insert label in add_falloc_range
By way of inverting the list_empty conditional the insert label can be eliminated, making the function's flow entirely linear. 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/file.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index d0081b2d47ab..28a05ba47060 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -3050,19 +3050,18 @@ static int add_falloc_range(struct list_head *head, u64 start, u64 len)
{
struct falloc_range *range = NULL;
- if (list_empty(head))
- goto insert;
-
- /*
- * As fallocate iterate by bytenr order, we only need to check
- * the last range.
- */
- range = list_last_entry(head, struct falloc_range, list);
- if (range->start + range->len == start) {
- range->len += len;
- return 0;
+ if (!list_empty(head)) {
+ /*
+ * As fallocate iterates by bytenr order, we only need to check
+ * the last range.
+ */
+ range = list_last_entry(head, struct falloc_range, list);
+ if (range->start + range->len == start) {
+ range->len += len;
+ return 0;
+ }
}
-insert:
+
range = kmalloc(sizeof(*range), GFP_KERNEL);
if (!range)
return -ENOMEM;