mirror of https://gitee.com/openkylin/linux.git
Btrfs: u64 cleanups
Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
parent
c673024aba
commit
7cf75962ac
|
@ -17,6 +17,6 @@ tester: $(objects) random-test.o
|
|||
$(objects) : $(headers)
|
||||
|
||||
clean :
|
||||
rm ctree *.o
|
||||
rm debug-tree tester *.o
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ static int del_pending_extents(struct ctree_root *extent_root)
|
|||
ret = search_slot(extent_root, &key, &path, 0);
|
||||
if (ret) {
|
||||
print_tree(extent_root, extent_root->node);
|
||||
printf("unable to find %lu\n", key.objectid);
|
||||
printf("unable to find %Lu\n", key.objectid);
|
||||
BUG();
|
||||
// FIXME undo it and return sane
|
||||
return ret;
|
||||
|
@ -86,7 +86,7 @@ int free_extent(struct ctree_root *root, u64 blocknr, u64 num_blocks)
|
|||
ret = search_slot(extent_root, &key, &path, 0);
|
||||
if (ret) {
|
||||
print_tree(extent_root, extent_root->node);
|
||||
printf("failed to find %lu\n", key.objectid);
|
||||
printf("failed to find %Lu\n", key.objectid);
|
||||
BUG();
|
||||
}
|
||||
ret = del_item(extent_root, &path);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#define BUG() abort()
|
||||
|
||||
typedef unsigned int u32;
|
||||
typedef unsigned long u64;
|
||||
typedef unsigned long long u64;
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
|
||||
|
|
|
@ -11,19 +11,19 @@ void print_leaf(struct leaf *l)
|
|||
int nr = l->header.nritems;
|
||||
struct item *item;
|
||||
struct extent_item *ei;
|
||||
printf("leaf %lu total ptrs %d free space %d\n", l->header.blocknr, nr,
|
||||
printf("leaf %Lu total ptrs %d free space %d\n", l->header.blocknr, nr,
|
||||
leaf_free_space(l));
|
||||
fflush(stdout);
|
||||
for (i = 0 ; i < nr ; i++) {
|
||||
item = l->items + i;
|
||||
printf("\titem %d key (%lu %u %lu) itemoff %d itemsize %d\n",
|
||||
printf("\titem %d key (%Lu %u %Lu) itemoff %d itemsize %d\n",
|
||||
i,
|
||||
item->key.objectid, item->key.flags, item->key.offset,
|
||||
item->offset, item->size);
|
||||
fflush(stdout);
|
||||
printf("\t\titem data %.*s\n", item->size, l->data+item->offset);
|
||||
ei = (struct extent_item *)(l->data + item->offset);
|
||||
printf("\t\textent data %u %lu\n", ei->refs, ei->owner);
|
||||
printf("\t\textent data %u %Lu\n", ei->refs, ei->owner);
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
@ -43,12 +43,12 @@ void print_tree(struct ctree_root *root, struct tree_buffer *t)
|
|||
print_leaf((struct leaf *)c);
|
||||
return;
|
||||
}
|
||||
printf("node %lu level %d total ptrs %d free spc %lu\n", t->blocknr,
|
||||
printf("node %Lu level %d total ptrs %d free spc %lu\n", t->blocknr,
|
||||
node_level(c->header.flags), c->header.nritems,
|
||||
NODEPTRS_PER_BLOCK - c->header.nritems);
|
||||
fflush(stdout);
|
||||
for (i = 0; i < nr; i++) {
|
||||
printf("\tkey %d (%lu %u %lu) block %lu\n",
|
||||
printf("\tkey %d (%Lu %u %Lu) block %Lu\n",
|
||||
i,
|
||||
c->keys[i].objectid, c->keys[i].flags, c->keys[i].offset,
|
||||
c->blockptrs[i]);
|
||||
|
|
|
@ -42,7 +42,7 @@ static int ins_one(struct ctree_root *root, struct radix_tree_root *radix)
|
|||
char buf[128];
|
||||
init_path(&path);
|
||||
ret = setup_key(radix, &key, 0);
|
||||
sprintf(buf, "str-%lu\n", key.objectid);
|
||||
sprintf(buf, "str-%Lu\n", key.objectid);
|
||||
ret = insert_item(root, &key, buf, strlen(buf));
|
||||
if (ret)
|
||||
goto error;
|
||||
|
@ -54,7 +54,7 @@ static int ins_one(struct ctree_root *root, struct radix_tree_root *radix)
|
|||
goto error;
|
||||
return ret;
|
||||
error:
|
||||
printf("failed to insert %lu\n", key.objectid);
|
||||
printf("failed to insert %Lu\n", key.objectid);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -68,10 +68,10 @@ static int insert_dup(struct ctree_root *root, struct radix_tree_root *radix)
|
|||
ret = setup_key(radix, &key, 1);
|
||||
if (ret < 0)
|
||||
return 0;
|
||||
sprintf(buf, "str-%lu\n", key.objectid);
|
||||
sprintf(buf, "str-%Lu\n", key.objectid);
|
||||
ret = insert_item(root, &key, buf, strlen(buf));
|
||||
if (ret != -EEXIST) {
|
||||
printf("insert on %lu gave us %d\n", key.objectid, ret);
|
||||
printf("insert on %Lu gave us %d\n", key.objectid, ret);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -99,7 +99,7 @@ static int del_one(struct ctree_root *root, struct radix_tree_root *radix)
|
|||
goto error;
|
||||
return 0;
|
||||
error:
|
||||
printf("failed to delete %lu\n", key.objectid);
|
||||
printf("failed to delete %Lu\n", key.objectid);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ static int lookup_item(struct ctree_root *root, struct radix_tree_root *radix)
|
|||
goto error;
|
||||
return 0;
|
||||
error:
|
||||
printf("unable to find key %lu\n", key.objectid);
|
||||
printf("unable to find key %Lu\n", key.objectid);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ static int lookup_enoent(struct ctree_root *root, struct radix_tree_root *radix)
|
|||
goto error;
|
||||
return 0;
|
||||
error:
|
||||
printf("able to find key that should not exist %lu\n", key.objectid);
|
||||
printf("able to find key that should not exist %Lu\n", key.objectid);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ static int fill_radix(struct ctree_root *root, struct radix_tree_root *radix)
|
|||
{
|
||||
struct ctree_path path;
|
||||
struct key key;
|
||||
u64 found;
|
||||
unsigned long found;
|
||||
int ret;
|
||||
int slot;
|
||||
int i;
|
||||
|
|
Loading…
Reference in New Issue