* [PATCH] Btrfs: change BUG_ON()'s to ASSERT()'s in backref_cache_cleanup()
@ 2016-07-12 1:52 Liu Bo
2016-07-12 16:17 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Liu Bo @ 2016-07-12 1:52 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Since it is just an in-memory building of the backrefs of several
btree blocks, nothing is fatal other than memory leaks, so this
changes BUG_ON()'s to ASSERT()'s.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
fs/btrfs/relocation.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 0477dca..9732919 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -235,12 +235,12 @@ static void backref_cache_cleanup(struct backref_cache *cache)
cache->last_trans = 0;
for (i = 0; i < BTRFS_MAX_LEVEL; i++)
- BUG_ON(!list_empty(&cache->pending[i]));
- BUG_ON(!list_empty(&cache->changed));
- BUG_ON(!list_empty(&cache->detached));
- BUG_ON(!RB_EMPTY_ROOT(&cache->rb_root));
- BUG_ON(cache->nr_nodes);
- BUG_ON(cache->nr_edges);
+ ASSERT(list_empty(&cache->pending[i]));
+ ASSERT(list_empty(&cache->changed));
+ ASSERT(list_empty(&cache->detached));
+ ASSERT(RB_EMPTY_ROOT(&cache->rb_root));
+ ASSERT(!cache->nr_nodes);
+ ASSERT(!cache->nr_edges);
}
static struct backref_node *alloc_backref_node(struct backref_cache *cache)
--
2.5.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Btrfs: change BUG_ON()'s to ASSERT()'s in backref_cache_cleanup()
2016-07-12 1:52 [PATCH] Btrfs: change BUG_ON()'s to ASSERT()'s in backref_cache_cleanup() Liu Bo
@ 2016-07-12 16:17 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2016-07-12 16:17 UTC (permalink / raw)
To: Liu Bo; +Cc: linux-btrfs, David Sterba
On Mon, Jul 11, 2016 at 06:52:57PM -0700, Liu Bo wrote:
> Since it is just an in-memory building of the backrefs of several
> btree blocks, nothing is fatal other than memory leaks, so this
> changes BUG_ON()'s to ASSERT()'s.
Agreed, this a good justification. Sometimes the BUG_ON serves as a
last-resort sanity check so it's not like changing all BUG_ON to ASSERT.
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-07-12 16:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-12 1:52 [PATCH] Btrfs: change BUG_ON()'s to ASSERT()'s in backref_cache_cleanup() Liu Bo
2016-07-12 16:17 ` David Sterba
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).