From: David Sterba <dsterba@suse.cz>
To: Nikolay Borisov <nborisov@suse.com>
Cc: linux-btrfs@vger.kernel.org, dsterba@suse.cz
Subject: Re: [PATCH] btrfs: Remove err variable from btrfs_get_extent
Date: Mon, 24 Aug 2020 18:59:37 +0200 [thread overview]
Message-ID: <20200824165937.GP2026@twin.jikos.cz> (raw)
In-Reply-To: <20200803095846.3623-1-nborisov@suse.com>
On Mon, Aug 03, 2020 at 12:58:46PM +0300, Nikolay Borisov wrote:
> @@ -6713,32 +6708,33 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
> goto insert;
> }
> not_found:
> + ret = 0;
> em->start = start;
> em->orig_start = start;
> em->len = len;
> em->block_start = EXTENT_MAP_HOLE;
> insert:
> + ret = 0;
It's not necessary to set ret = 0 in not_found, there's no conditional
until this line keeping it for 'insert' should be sufficient.
> btrfs_release_path(path);
> if (em->start > start || extent_map_end(em) <= start) {
> btrfs_err(fs_info,
> "bad extent! em: [%llu %llu] passed [%llu %llu]",
> em->start, em->len, start, len);
> - err = -EIO;
> + ret = -EIO;
> goto out;
> }
>
> - err = 0;
> write_lock(&em_tree->lock);
> - err = btrfs_add_extent_mapping(fs_info, em_tree, &em, start, len);
> + ret = btrfs_add_extent_mapping(fs_info, em_tree, &em, start, len);
> write_unlock(&em_tree->lock);
> out:
> btrfs_free_path(path);
>
> trace_btrfs_get_extent(root, inode, em);
>
> - if (err) {
> + if (ret) {
> free_extent_map(em);
> - return ERR_PTR(err);
> + return ERR_PTR(ret);
> }
> return em;
> }
> --
> 2.17.1
prev parent reply other threads:[~2020-08-24 17:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-03 9:58 [PATCH] btrfs: Remove err variable from btrfs_get_extent Nikolay Borisov
2020-08-24 16:59 ` David Sterba [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200824165937.GP2026@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=nborisov@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox