Re: [PATCH] Btrfs: add support for asserts V2

2013-08-30 Thread David Sterba
On Thu, Aug 29, 2013 at 02:09:57PM -0400, Josef Bacik wrote: +#define ASSERT(expr) \ + (likely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__)) +#else +#define ASSERT(expr) ((void)0) +#endif + +#define btrfs_assert() This is unused and without any ifdef-ed alternatives, should go

[PATCH] Btrfs: add support for asserts V2

2013-08-29 Thread Josef Bacik
One of the complaints we get a lot is how many BUG_ON()'s we have. So to help with this I'm introducing a kconfig option to enable/disable a new ASSERT() mechanism much like what XFS does. This will allow us developers to still get our nice panics but allow users/distros to compile them out.

Re: [PATCH] Btrfs: add support for asserts

2013-08-28 Thread David Sterba
On Mon, Aug 26, 2013 at 04:56:06PM -0400, Josef Bacik wrote: +#ifdef BTRFS_ASSERT + +static inline void assfail(char *expr, char *file, int lin) typo: lin instead of line -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to

Re: [PATCH] Btrfs: add support for asserts

2013-08-27 Thread Josef Bacik
On Mon, Aug 26, 2013 at 02:53:26PM -0700, Zach Brown wrote: With this we can go through and convert any BUG_ON()'s that we have to catch actual programming mistakes to the new ASSERT() and then fix everybody else to return errors. I like the sound of that! --- a/fs/btrfs/ctree.h

Re: [PATCH] Btrfs: add support for asserts

2013-08-27 Thread Jeff Mahoney
On 8/27/13 9:47 AM, Josef Bacik wrote: On Mon, Aug 26, 2013 at 02:53:26PM -0700, Zach Brown wrote: With this we can go through and convert any BUG_ON()'s that we have to catch actual programming mistakes to the new ASSERT() and then fix everybody else to return errors. I like the sound of

Re: [PATCH] Btrfs: add support for asserts

2013-08-27 Thread Jeff Mahoney
On 8/26/13 4:56 PM, Josef Bacik wrote: One of the complaints we get a lot is how many BUG_ON()'s we have. So to help with this I'm introducing a kconfig option to enable/disable a new ASSERT() mechanism much like what XFS does. This will allow us developers to still get our nice panics but

Re: [PATCH] Btrfs: add support for asserts

2013-08-27 Thread Josef Bacik
On Tue, Aug 27, 2013 at 03:28:24PM -0400, Jeff Mahoney wrote: On 8/26/13 4:56 PM, Josef Bacik wrote: One of the complaints we get a lot is how many BUG_ON()'s we have. So to help with this I'm introducing a kconfig option to enable/disable a new ASSERT() mechanism much like what XFS

Re: [PATCH] Btrfs: add support for asserts

2013-08-27 Thread Jeff Mahoney
On 8/27/13 4:56 PM, Josef Bacik wrote: On Tue, Aug 27, 2013 at 03:28:24PM -0400, Jeff Mahoney wrote: On 8/26/13 4:56 PM, Josef Bacik wrote: One of the complaints we get a lot is how many BUG_ON()'s we have. So to help with this I'm introducing a kconfig option to enable/disable a new

Re: [PATCH] Btrfs: add support for asserts

2013-08-27 Thread Eric Sandeen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 8/27/13 4:07 PM, Jeff Mahoney wrote: On 8/27/13 4:56 PM, Josef Bacik wrote: On Tue, Aug 27, 2013 at 03:28:24PM -0400, Jeff Mahoney wrote: On 8/26/13 4:56 PM, Josef Bacik wrote: One of the complaints we get a lot is how many BUG_ON()'s we have.

Re: [PATCH] Btrfs: add support for asserts

2013-08-27 Thread Jeff Mahoney
On 8/27/13 5:21 PM, Eric Sandeen wrote: On 8/27/13 4:07 PM, Jeff Mahoney wrote: On 8/27/13 4:56 PM, Josef Bacik wrote: On Tue, Aug 27, 2013 at 03:28:24PM -0400, Jeff Mahoney wrote: On 8/26/13 4:56 PM, Josef Bacik wrote: One of the complaints we get a lot is how many BUG_ON()'s we have. So to

Re: [PATCH] Btrfs: add support for asserts

2013-08-27 Thread Eric Sandeen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 8/27/13 4:25 PM, Jeff Mahoney wrote: On 8/27/13 5:21 PM, Eric Sandeen wrote: On 8/27/13 4:07 PM, Jeff Mahoney wrote: On 8/27/13 4:56 PM, Josef Bacik wrote: On Tue, Aug 27, 2013 at 03:28:24PM -0400, Jeff Mahoney wrote: On 8/26/13 4:56 PM, Josef

Re: [PATCH] Btrfs: add support for asserts

2013-08-27 Thread Jeff Mahoney
On 8/27/13 5:28 PM, Eric Sandeen wrote: On 8/27/13 4:25 PM, Jeff Mahoney wrote: On 8/27/13 5:21 PM, Eric Sandeen wrote: On 8/27/13 4:07 PM, Jeff Mahoney wrote: On 8/27/13 4:56 PM, Josef Bacik wrote: On Tue, Aug 27, 2013 at 03:28:24PM -0400, Jeff Mahoney wrote: On 8/26/13 4:56 PM, Josef Bacik

[PATCH] Btrfs: add support for asserts

2013-08-26 Thread Josef Bacik
One of the complaints we get a lot is how many BUG_ON()'s we have. So to help with this I'm introducing a kconfig option to enable/disable a new ASSERT() mechanism much like what XFS does. This will allow us developers to still get our nice panics but allow users/distros to compile them out.

Re: [PATCH] Btrfs: add support for asserts

2013-08-26 Thread Eric Sandeen
On 8/26/13 3:56 PM, Josef Bacik wrote: One of the complaints we get a lot is how many BUG_ON()'s we have. So to help with this I'm introducing a kconfig option to enable/disable a new ASSERT() mechanism much like what XFS does. This will allow us developers to still get our nice panics but

Re: [PATCH] Btrfs: add support for asserts

2013-08-26 Thread Zach Brown
With this we can go through and convert any BUG_ON()'s that we have to catch actual programming mistakes to the new ASSERT() and then fix everybody else to return errors. I like the sound of that! --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -3814,6 +3814,22 @@ void btrfs_printk(const

Re: [PATCH] Btrfs: add support for asserts

2013-08-26 Thread Zach Brown
#ifdef BTRFS_ASSERT #define btrfs_assert(cond) BUG_ON(!(cond)) #else #define btrfs_assert(cond) do { if (cond) ; } while (0) #endif I think the only downside is that the BUG_ON() won't print the conditional that failed, IIRC. Sure, if you wanted to go the