[PATCH 2/2] bcache: remove ptr_available check in btree_ptr_bad_expensive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



btree_ptr_bad_expensive() is called by bch_btree_ptr_bad() only.
Before the invocation, ptr_available() check already done in
bch_btree_ptr_bad():
'''
	...
	for (i = 0; i < KEY_PTRS(k); i++)
		if (!ptr_available(b->c, k, i) ||
		    ptr_stale(b->c, k, i))
			return true;

	if (expensive_debug_checks(b->c) &&
	    btree_ptr_bad_expensive(b, k))
		return true;
	...
'''
Remove redundant ptr_available() check in btree_ptr_bad_expensive().

Signed-off-by: Shenghui Wang <shhuiw@xxxxxxxxxxx>
---
 drivers/md/bcache/extents.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/md/bcache/extents.c b/drivers/md/bcache/extents.c
index 5a05407a8126..abcf783839c8 100644
--- a/drivers/md/bcache/extents.c
+++ b/drivers/md/bcache/extents.c
@@ -177,16 +177,15 @@ static bool btree_ptr_bad_expensive(struct btree *b, const struct bkey *k)
 	struct bucket *g;
 
 	if (mutex_trylock(&b->c->bucket_lock)) {
-		for (i = 0; i < KEY_PTRS(k); i++)
-			if (ptr_available(b->c, k, i)) {
-				g = PTR_BUCKET(b->c, k, i);
-
-				if (KEY_DIRTY(k) ||
-				    g->prio != BTREE_PRIO ||
-				    (b->c->gc_mark_valid &&
-				     GC_MARK(g) != GC_MARK_METADATA))
-					goto err;
-			}
+		for (i = 0; i < KEY_PTRS(k); i++) {
+			g = PTR_BUCKET(b->c, k, i);
+
+			if (KEY_DIRTY(k) ||
+			    g->prio != BTREE_PRIO ||
+			    (b->c->gc_mark_valid &&
+			     GC_MARK(g) != GC_MARK_METADATA))
+				goto err;
+		}
 
 		mutex_unlock(&b->c->bucket_lock);
 	}
-- 
2.20.1




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux