[PATCH 3/3] Btrfs: fix missing inline refs when walking backrefs

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

 



From: Wang Shilong <wangsl.fnst@xxxxxxxxxxxxxx>

If @slot=0, we may have an expected item in the previous leaf,
So we should handle that case, otherwise, we will miss inline refs
,fix it.

Signed-off-by: Wang Shilong <wangsl.fnst@xxxxxxxxxxxxxx>
---
 fs/btrfs/backref.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 964679c..4ccd726 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -893,14 +893,13 @@ again:
 		spin_unlock(&delayed_refs->lock);
 	}
 
-	if (path->slots[0]) {
-		struct extent_buffer *leaf;
-		int slot;
+	ret = btrfs_previous_extent_item(fs_info->extent_root, path,
+					 key.objectid);
+	if (ret < 0)
+		goto out;
 
-		path->slots[0]--;
-		leaf = path->nodes[0];
-		slot = path->slots[0];
-		btrfs_item_key_to_cpu(leaf, &key, slot);
+	if (ret == 0) {
+		btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
 		if (key.objectid == bytenr &&
 		    (key.type == BTRFS_EXTENT_ITEM_KEY ||
 		     key.type == BTRFS_METADATA_ITEM_KEY)) {
-- 
1.8.4

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux