summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-02-01 14:51:59 -0500
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:00 -0400
commit21a4989d26d5ce43aac452fd67be592463a5996d (patch)
tree5e4c4829264dcae66917ead9625c64ef11646abe
parent47e4bb988c853d9af79d76fc5135aee9eeffed77 (diff)
downloadlinux-21a4989d26d5ce43aac452fd67be592463a5996d.tar.bz2
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>
-rw-r--r--fs/btrfs/extent-tree.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 0fc8dfd58da9..8761aec59e37 100644
--- a/fs/btrfs/extent-tree.c
+++ b/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;
}