mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
To: "Luís Henriques" <lhenriques@suse.de>, "Chris Mason" <clm@fb.com>,
	"Josef Bacik" <josef@toxicpanda.com>,
	"David Sterba" <dsterba@suse.com>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] btrfs: turn unpin_extent_cache() into a void function
Date: Thu, 20 Jul 2023 07:12:58 +0000	[thread overview]
Message-ID: <7f2db85d-5090-8614-adae-d0ee64a26ec6@wdc.com> (raw)
In-Reply-To: <20230718173906.12568-1-lhenriques@suse.de>

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@suse.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?

  reply	other threads:[~2023-07-20  7:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-18 17:39 Luís Henriques
2023-07-20  7:12 ` Johannes Thumshirn [this message]
2023-07-20  9:13   ` Luís Henriques
2023-07-20 11:04 ` David Sterba

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=7f2db85d-5090-8614-adae-d0ee64a26ec6@wdc.com \
    --to=johannes.thumshirn@wdc.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=lhenriques@suse.de \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®