]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Btrfs: Hash in the offset and owner for file extent backref keys
authorChris Mason <chris.mason@oracle.com>
Fri, 1 Feb 2008 19:51:59 +0000 (14:51 -0500)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:04:00 +0000 (11:04 -0400)
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>
fs/btrfs/extent-tree.c

index 0fc8dfd58da91da6a0617e0fec0723e842b24bff..8761aec59e3728f124fc70cc54c2056e548d2b5c 100644 (file)
@@ -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;
 }