From: Ian Kent <raven@themaw.net>
To: Yoshinori Sano <yoshinori.sano@gmail.com>
Cc: chris.mason@oracle.com, josef@redhat.com, linux-btrfs@vger.kernel.org
Subject: Re: On Removing BUG_ON macros
Date: Mon, 08 Nov 2010 10:36:10 +0800 [thread overview]
Message-ID: <1289183770.3309.13.camel@localhost> (raw)
In-Reply-To: <AANLkTinQPUW3wRGU96mKA1DMHUoAQUrtKwqqQvvPoxB=@mail.gmail.com>
On Sun, 2010-11-07 at 16:16 +0900, Yoshinori Sano wrote:
> This is a question I've posted on the #btrfs IRC channel today.
> hyperair adviced me to contact with Josef Bacik or Chris Mason.
> So, I post my question to this maling list.
>
> Here are my post on the IRC:
>
> Actually, I want to remove BUG_ON(ret) around the Btrfs code.
> The motivation is to make the Btrfs code more robust.
> First of all, is this meaningless?
No, it isn't meaningless it's essential that it be fixed, although it is
quite difficult.
The main problem is that while this remains it makes it almost
impossible (at least much more difficult) for those implementing
improvements to avoid perpetuating the problem.
>
> For example, there are code like the following:
>
> struct btrfs_path *path;
> path = btrfs_alloc_path();
> BUG_ON(!path);
Yes, this is quite common but the fact is that there are many other
situations where errors are handled in the same way.
>
> This is a frequenty used pattern of current Btrfs code.
> A btrfs_alloc_path()'s caller has to deal with the allocation failure
> instead of using BUG_ON. However, (this is what most interesting
> thing for me) can the caller do any proper error handlings here?
> I mean, is this a critical situation where we cannot recover from?
If you work through the function call tree quite a good number of the
dead end BUG_ON()s can be handled (at least it looks like that to me).
But there are also quite a good number of cases where the recovery
needed isn't yet clear to me. I hope that as I study the code some of
these cases will become apparent to me, failing that I plan to post some
patches with specific questions to see what others have to say.
Ian
prev parent reply other threads:[~2010-11-08 2:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-07 7:16 On Removing BUG_ON macros Yoshinori Sano
2010-11-07 14:51 ` Josef Bacik
2010-11-08 2:54 ` Ian Kent
2010-11-08 12:42 ` Josef Bacik
2010-11-08 14:06 ` Ian Kent
2010-11-08 14:15 ` Josef Bacik
2010-11-08 15:02 ` Ian Kent
2010-11-11 4:32 ` Ian Kent
2010-12-01 18:31 ` Josef Bacik
2010-11-09 6:13 ` Yoshinori Sano
2010-11-08 13:17 ` Yoshinori Sano
2010-11-08 13:28 ` Josef Bacik
2010-11-08 23:02 ` Yoshinori Sano
2010-11-08 2:36 ` Ian Kent [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=1289183770.3309.13.camel@localhost \
--to=raven@themaw.net \
--cc=chris.mason@oracle.com \
--cc=josef@redhat.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=yoshinori.sano@gmail.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).