From: Nikolay Borisov Date: Tue, 1 Jun 2021 06:08:15 +0000 (+0300) Subject: btrfs: eliminate insert label in add_falloc_range X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=77d255348bb2ce9a174cca020aa38f2ce82cb2bc;p=linux.git 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 Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index d0081b2d47ab6..28a05ba47060e 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;