ソースを参照

Btrfs: Hash in the offset and owner for file extent backref keys

This makes searches for backrefs and backref insertion much more efficient
when there are many backrefs for a single extent

Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason 17 年 前
コミット
21a4989d26
1 ファイル変更6 行追加7 行削除
  1. 6 7
      fs/btrfs/extent-tree.c

+ 6 - 7
fs/btrfs/extent-tree.c

@@ -397,13 +397,12 @@ static u64 hash_extent_ref(u64 root_objectid, u64 ref_generation,
 	high_crc = crc32c(high_crc, &lenum, sizeof(lenum));
 	lenum = cpu_to_le64(ref_generation);
 	low_crc = crc32c(low_crc, &lenum, sizeof(lenum));
-
-#if 0
-	lenum = cpu_to_le64(owner);
-	low_crc = crc32c(low_crc, &lenum, sizeof(lenum));
-	lenum = cpu_to_le64(owner_offset);
-	low_crc = crc32c(low_crc, &lenum, sizeof(lenum));
-#endif
+	if (owner >= BTRFS_FIRST_FREE_OBJECTID) {
+		lenum = cpu_to_le64(owner);
+		low_crc = crc32c(low_crc, &lenum, sizeof(lenum));
+		lenum = cpu_to_le64(owner_offset);
+		low_crc = crc32c(low_crc, &lenum, sizeof(lenum));
+	}
 	return ((u64)high_crc << 32) | (u64)low_crc;
 }