rework csum and extent item ordering

master
Chris Mason 2007-04-17 15:40:34 -04:00 committed by David Woodhouse
parent 23218726a2
commit 8d1d13c786
3 changed files with 8 additions and 20 deletions

View File

@ -107,14 +107,14 @@ static int comp_keys(struct btrfs_disk_key *disk, struct btrfs_key *k2)
return 1;
if (k1.objectid < k2->objectid)
return -1;
if (k1.offset > k2->offset)
return 1;
if (k1.offset < k2->offset)
return -1;
if (k1.flags > k2->flags)
return 1;
if (k1.flags < k2->flags)
return -1;
if (k1.offset > k2->offset)
return 1;
if (k1.offset < k2->offset)
return -1;
return 0;
}

16
ctree.h
View File

@ -40,14 +40,14 @@ struct btrfs_trans_handle;
*/
struct btrfs_disk_key {
__le64 objectid;
__le64 offset;
__le32 flags;
__le64 offset;
} __attribute__ ((__packed__));
struct btrfs_key {
u64 objectid;
u64 offset;
u32 flags;
u64 offset;
} __attribute__ ((__packed__));
/*
@ -223,7 +223,6 @@ struct btrfs_file_extent_item {
} __attribute__ ((__packed__));
struct btrfs_csum_item {
__le64 extent_offset;
u8 csum[BTRFS_CSUM_SIZE];
} __attribute__ ((__packed__));
@ -912,17 +911,6 @@ static inline void btrfs_set_file_extent_num_blocks(struct
e->num_blocks = cpu_to_le64(val);
}
static inline u64 btrfs_csum_extent_offset(struct btrfs_csum_item *c)
{
return le64_to_cpu(c->extent_offset);
}
static inline void btrfs_set_csum_extent_offset(struct btrfs_csum_item *c,
u64 val)
{
c->extent_offset = cpu_to_le64(val);
}
static inline u16 btrfs_device_pathlen(struct btrfs_device_item *d)
{
return le16_to_cpu(d->pathlen);

View File

@ -28,11 +28,11 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l)
for (i = 0 ; i < nr ; i++) {
item = l->items + i;
type = btrfs_disk_key_type(&item->key);
printf("\titem %d key (%Lu %Lu %u) itemoff %d itemsize %d\n",
printf("\titem %d key (%Lu %u %Lu) itemoff %d itemsize %d\n",
i,
btrfs_disk_key_objectid(&item->key),
btrfs_disk_key_offset(&item->key),
btrfs_disk_key_flags(&item->key),
btrfs_disk_key_offset(&item->key),
btrfs_item_offset(item),
btrfs_item_size(item));
switch (type) {