All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Nikolay Borisov <nborisov@suse.com>, WenRuo Qu <wqu@suse.com>,
	linux-btrfs@vger.kernel.org
Cc: Charles Wright <charles.v.wright@gmail.com>
Subject: Re: [PATCH 1/3] btrfs-progs: check/lowmem: Add check and repair for invalid inode generation
Date: Mon, 30 Sep 2019 22:05:00 +0800	[thread overview]
Message-ID: <652d4ab4-b3e8-8b0b-4ffe-f9f2756a418f@gmx.com> (raw)
In-Reply-To: <b7663ce0-d2e8-6da7-bbc7-df0152e56e21@suse.com>



On 2019/9/30 下午9:34, Nikolay Borisov wrote:
>
>
> On 30.09.19 г. 15:24 ч., Qu Wenruo wrote:
>> Yes, the ASSERT() doesn't make much sense by itself.
>>
>> However I still believe it won't be a problem.
>
> It won't be a problem but it feels wrong to have this assert this deep
> into the call chain. IMO It should be put where it can trigger at the
> earliest which seems to be in check_inode_item. That function assumes
> it's working with an inode item and goes to dereference inode members so
> if the type is wrong we'd crash there instead of in repair_inode_gen_lowmem.

This is going to be a preference thing.

To my taste, if possible, I would put ASSERT() in every function with
more than 24 lines, as an alternative to comment, to show the
prerequisite or the assumption.

Thanks,
Qu

>
>>
>> It's compiler's job to remove such dead ASSERT(), but for human reader,
>> I still believe this ASSERT() could still make sense, especially when
>> the caller or callee can get more and more complex.
>>
>> Thanks,

  reply	other threads:[~2019-09-30 14:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-24  8:11 [PATCH 0/3] btrfs-progs: Add check and repair for invalid inode generation Qu Wenruo
2019-09-24  8:11 ` [PATCH 1/3] btrfs-progs: check/lowmem: " Qu Wenruo
2019-09-30 11:36   ` Nikolay Borisov
2019-09-30 12:24     ` Qu Wenruo
2019-09-30 13:34       ` Nikolay Borisov
2019-09-30 14:05         ` Qu Wenruo [this message]
2019-09-24  8:11 ` [PATCH 2/3] btrfs-progs: check/original: " Qu Wenruo
2019-09-30  8:41   ` Nikolay Borisov
2019-09-30  9:00     ` Qu Wenruo
2019-09-24  8:11 ` [PATCH 3/3] btrfs-progs: fsck-tests: Add test image for invalid inode generation repair Qu Wenruo
2019-10-18 20:32 ` [PATCH 0/3] btrfs-progs: Add check and repair for invalid inode generation Ferry Toth
2019-10-18 23:50   ` Qu WenRuo
2019-10-19 16:24     ` Ferry Toth
2019-10-20  0:26       ` Qu Wenruo
2019-10-20  0:51         ` Qu Wenruo
2019-10-20 13:04           ` Ferry Toth
2019-10-20 13:15             ` Qu WenRuo
2019-10-20 13:29               ` Ferry Toth
2019-10-20 14:11                 ` Qu Wenruo
2019-10-20 14:24                   ` Ferry Toth
2019-10-21 16:01                     ` Ferry Toth
2019-10-20 11:50         ` Ferry Toth

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=652d4ab4-b3e8-8b0b-4ffe-f9f2756a418f@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=charles.v.wright@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    --cc=wqu@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.