linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>
Cc: bo.li.liu@oracle.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v3 1/5] btrfs: scrub: Introduce full stripe lock for RAID56
Date: Thu, 30 Mar 2017 12:31:49 +0200	[thread overview]
Message-ID: <20170330103149.GF4781@suse.cz> (raw)
In-Reply-To: <1a67dcaf-f1b5-a9bf-673a-2a364bd94d89@cn.fujitsu.com>

On Thu, Mar 30, 2017 at 09:03:21AM +0800, Qu Wenruo wrote:
> >> +static int lock_full_stripe(struct btrfs_fs_info *fs_info, u64 bytenr)
> >> +{
> >> +	struct btrfs_block_group_cache *bg_cache;
> >> +	struct btrfs_full_stripe_locks_tree *locks_root;
> >> +	struct full_stripe_lock *existing;
> >> +	u64 fstripe_start;
> >> +	int ret = 0;
> >> +
> >> +	bg_cache = btrfs_lookup_block_group(fs_info, bytenr);
> >> +	if (!bg_cache)
> >> +		return -ENOENT;
> >> +
> >
> > When starting to scrub a chunk, we've already increased a ref for block group,
> > could you please put a ASSERT to catch it?
> 
> Personally I prefer WARN_ON() than ASSERT().
> 
> ASSERT() always panic the modules and forces us to reset the system. 
> Wiping out any possibility to check the system.

I think the sematnics of WARN_ON and ASSERT are different, so it should
be decided case by case which one to use. Assert is good for 'never
happens' or catch errors at development time (wrong API use, invariant
condition that must always match).

Also the asserts are gone if the config option is unset, while WARN_ON
will stay in some form (verbose or not). Both are suitable for catching
problems, but the warning is for less critical errors so we want to know
when it happens but still can continue.

The above case looks like a candidate for ASSERT as the refcounts must
be correct, continuing with the warning could lead to other unspecified
problems.

  reply	other threads:[~2017-03-30 10:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29  1:33 [PATCH v3 0/5] raid56: scrub related fixes Qu Wenruo
2017-03-29  1:33 ` [PATCH v3 1/5] btrfs: scrub: Introduce full stripe lock for RAID56 Qu Wenruo
2017-03-30  0:34   ` Liu Bo
2017-03-30  1:03     ` Qu Wenruo
2017-03-30 10:31       ` David Sterba [this message]
2017-03-31  2:03         ` Qu Wenruo
2017-03-31 17:26           ` David Sterba
2017-04-03  0:43             ` Qu Wenruo
2017-03-29  1:33 ` [PATCH v3 2/5] btrfs: scrub: Fix RAID56 recovery race condition Qu Wenruo
2017-03-30  0:51   ` Liu Bo
2017-03-30  3:24     ` Qu Wenruo
2017-03-29  1:33 ` [PATCH v3 3/5] btrfs: scrub: Don't append on-disk pages for raid56 scrub Qu Wenruo
2017-03-29 18:00   ` Liu Bo
2017-03-29  1:33 ` [PATCH v3 4/5] btrfs: Wait flighting bio before freeing target device for raid56 Qu Wenruo
2017-03-29 18:05   ` Liu Bo
2017-03-29  1:33 ` [PATCH v3 5/5] btrfs: Prevent scrub recheck from racing with dev replace Qu Wenruo
2017-03-29 18:08   ` Liu Bo
2017-03-30 16:52 ` [PATCH v3 0/5] raid56: scrub related fixes 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=20170330103149.GF4781@suse.cz \
    --to=dsterba@suse.cz \
    --cc=bo.li.liu@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo@cn.fujitsu.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;
as well as URLs for NNTP newsgroup(s).