Skip to contentSkip to conversation

Remove code duplication in comp_keys

PATCH In review Diego Calleja 2 participants 2 messages Jul 23, 2009 – Jul 24, 2009 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove code duplication in comp_keys

comp_keys is duplicating what is done in btrfs_comp_cpu_keys, so just call it.

---
 fs/btrfs/ctree.c |   14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
fs/btrfs/ctree.c +1 -13
Index: linux/fs/btrfs/ctree.c
===================================================================
@@ -557,19 +557,7 @@ static int comp_keys(struct btrfs_disk_k
 
 	btrfs_disk_key_to_cpu(&k1, disk);
 
-	if (k1.objectid > k2->objectid)
-		return 1;
-	if (k1.objectid < k2->objectid)
-		return -1;
-	if (k1.type > k2->type)
-		return 1;
-	if (k1.type < k2->type)
-		return -1;
-	if (k1.offset > k2->offset)
-		return 1;
-	if (k1.offset < k2->offset)
-		return -1;
-	return 0;
+	return btrfs_comp_cpu_keys(&k1, k2);
 }
 
 /*
#1 lore raw
Quoted 2 lines · Diego Calleja

comp_keys is duplicating what is done in btrfs_comp_cpu_keys, so just call it.

Ok, looks like gcc is doing the right thing and inlining properly so I've queued this one up.

-chris