Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d4ef9ab authored by Eric Sesterhenn's avatar Eric Sesterhenn Committed by Adrian Bunk
Browse files

BUG_ON() Conversion in fs/hfs/



this changes if() BUG(); constructs to BUG_ON() which is
cleaner, contains unlikely() and can better optimized away.

Signed-off-by: default avatarEric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
parent 28133c7b
Loading
Loading
Loading
Loading
+3 −6
Original line number Original line Diff line number Diff line
@@ -306,8 +306,7 @@ void hfs_bnode_unhash(struct hfs_bnode *node)
	for (p = &node->tree->node_hash[hfs_bnode_hash(node->this)];
	for (p = &node->tree->node_hash[hfs_bnode_hash(node->this)];
	     *p && *p != node; p = &(*p)->next_hash)
	     *p && *p != node; p = &(*p)->next_hash)
		;
		;
	if (!*p)
	BUG_ON(!*p);
		BUG();
	*p = node->next_hash;
	*p = node->next_hash;
	node->tree->node_hash_cnt--;
	node->tree->node_hash_cnt--;
}
}
@@ -415,8 +414,7 @@ struct hfs_bnode *hfs_bnode_create(struct hfs_btree *tree, u32 num)
	spin_lock(&tree->hash_lock);
	spin_lock(&tree->hash_lock);
	node = hfs_bnode_findhash(tree, num);
	node = hfs_bnode_findhash(tree, num);
	spin_unlock(&tree->hash_lock);
	spin_unlock(&tree->hash_lock);
	if (node)
	BUG_ON(node);
		BUG();
	node = __hfs_bnode_create(tree, num);
	node = __hfs_bnode_create(tree, num);
	if (!node)
	if (!node)
		return ERR_PTR(-ENOMEM);
		return ERR_PTR(-ENOMEM);
@@ -459,8 +457,7 @@ void hfs_bnode_put(struct hfs_bnode *node)


		dprint(DBG_BNODE_REFS, "put_node(%d:%d): %d\n",
		dprint(DBG_BNODE_REFS, "put_node(%d:%d): %d\n",
		       node->tree->cnid, node->this, atomic_read(&node->refcnt));
		       node->tree->cnid, node->this, atomic_read(&node->refcnt));
		if (!atomic_read(&node->refcnt))
		BUG_ON(!atomic_read(&node->refcnt));
			BUG();
		if (!atomic_dec_and_lock(&node->refcnt, &tree->hash_lock))
		if (!atomic_dec_and_lock(&node->refcnt, &tree->hash_lock))
			return;
			return;
		for (i = 0; i < tree->pages_per_bnode; i++) {
		for (i = 0; i < tree->pages_per_bnode; i++) {
+1 −2
Original line number Original line Diff line number Diff line
@@ -36,8 +36,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
	tree->inode = iget_locked(sb, id);
	tree->inode = iget_locked(sb, id);
	if (!tree->inode)
	if (!tree->inode)
		goto free_tree;
		goto free_tree;
	if (!(tree->inode->i_state & I_NEW))
	BUG_ON(!(tree->inode->i_state & I_NEW));
		BUG();
	{
	{
	struct hfs_mdb *mdb = HFS_SB(sb)->mdb;
	struct hfs_mdb *mdb = HFS_SB(sb)->mdb;
	HFS_I(tree->inode)->flags = 0;
	HFS_I(tree->inode)->flags = 0;