public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix corner case in btrfs_next_leaf
@ 2009-07-20 11:27 Yan Zheng
  0 siblings, 0 replies; only message in thread
From: Yan Zheng @ 2009-07-20 11:27 UTC (permalink / raw)
  To: chris Mason, linux-btrfs

if 1 is returned by btrfs_search_slot, the path already points to the
first item with 'key > searching key'. So increasing path->slots[0] by
one is superfluous in that case.

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>

---
diff -urp 1/fs/btrfs/ctree.c 2/fs/btrfs/ctree.c
--- 1/fs/btrfs/ctree.c	2009-07-17 16:05:20.583924545 +0800
+++ 2/fs/btrfs/ctree.c	2009-07-20 14:52:49.715697336 +0800
@@ -4146,7 +4175,8 @@ again:
 	 * advance the path if there are now more items available.
 	 */
 	if (nritems > 0 && path->slots[0] < nritems - 1) {
-		path->slots[0]++;
+		if (ret == 0)
+			path->slots[0]++;
 		ret = 0;
 		goto done;
 	}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-07-20 11:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-20 11:27 [PATCH] Fix corner case in btrfs_next_leaf Yan Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox