Re: On Removing BUG_ON macros

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Josef Bacik
Date: Sunday, November 7, 2010 - 7:51 am

On Sun, Nov 07, 2010 at 04:16:47PM +0900, Yoshinori Sano wrote:

No we're just lazy ;).  Tho making sure the caller can recover from getting
-ENOMEM is very important, which is why in some of these paths we just do BUG_ON
since fixing the callers is tricky.  A good strategy for things like this is to
do something like

static int foo = 1;

path = btrfs_alloc_path();
if (!path || !(foo % 1000))
	return -ENOMEM;
foo++;

that way you can catch all the callers and make sure we're handling the error
all the way up the chain properly.  Thanks,

Josef
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
On Removing BUG_ON macros, Yoshinori Sano, (Sun Nov 7, 12:16 am)
Re: On Removing BUG_ON macros, Josef Bacik, (Sun Nov 7, 7:51 am)
Re: On Removing BUG_ON macros, Ian Kent, (Sun Nov 7, 7:36 pm)
Re: On Removing BUG_ON macros, Ian Kent, (Sun Nov 7, 7:54 pm)
Re: On Removing BUG_ON macros, Josef Bacik, (Mon Nov 8, 5:42 am)
Re: On Removing BUG_ON macros, Yoshinori Sano, (Mon Nov 8, 6:17 am)
Re: On Removing BUG_ON macros, Josef Bacik, (Mon Nov 8, 6:28 am)
Re: On Removing BUG_ON macros, Ian Kent, (Mon Nov 8, 7:06 am)
Re: On Removing BUG_ON macros, Josef Bacik, (Mon Nov 8, 7:15 am)
Re: On Removing BUG_ON macros, Ian Kent, (Mon Nov 8, 8:02 am)
Re: On Removing BUG_ON macros, Yoshinori Sano, (Mon Nov 8, 4:02 pm)
Re: On Removing BUG_ON macros, Yoshinori Sano, (Mon Nov 8, 11:13 pm)
Re: On Removing BUG_ON macros, Ian Kent, (Wed Nov 10, 9:32 pm)
Re: On Removing BUG_ON macros, Josef Bacik, (Wed Dec 1, 11:31 am)