[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7f2db85d-5090-8614-adae-d0ee64a26ec6@wdc.com>
Date: Thu, 20 Jul 2023 07:12:58 +0000
From: Johannes Thumshirn <Johannes.Thumshirn@....com>
To: Luís Henriques <lhenriques@...e.de>,
Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
David Sterba <dsterba@...e.com>
CC: "linux-btrfs@...r.kernel.org" <linux-btrfs@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] btrfs: turn unpin_extent_cache() into a void function
On 18.07.23 19:39, Luís Henriques wrote:
> The value of the 'ret' variable is never changed in function
> unpin_extent_cache(). And since the only caller of this function doesn't
> check the return value, it can simply be turned into a void function.
>
> Signed-off-by: Luís Henriques <lhenriques@...e.de>
Hmm but inside unpin_extent_cache() there is this:
/* [...] */
em = lookup_extent_mapping(tree, start, len);
WARN_ON(!em || em->start != start);
if (!em)
goto out;
/* [...] */
out:
write_unlock(&tree->lock);
return ret;
}
Wouldn't it be better to either actually handle the error, OR
change the WARN_ON() into an ASSERT()?
Given the fact, that if the lookup fails, we've passed wrong
parameters somehow, an ASSERT() would be a good way IMHO.
Thoughts?
Powered by blists - more mailing lists