Btrfs: fix gcc warnings for 32bit compiles

Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
Jan Schmidt 2012-08-13 02:52:38 -06:00 committed by Chris Mason
parent 74dd17fbe3
commit 995e01b7af
4 changed files with 32 additions and 31 deletions

View File

@ -231,7 +231,7 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
} }
if (!ret) { if (!ret) {
ret = ulist_add(parents, eb->start, ret = ulist_add(parents, eb->start,
(u64)eie, GFP_NOFS); (uintptr_t)eie, GFP_NOFS);
if (ret < 0) if (ret < 0)
break; break;
if (!extent_item_pos) { if (!extent_item_pos) {
@ -363,8 +363,8 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info,
ULIST_ITER_INIT(&uiter); ULIST_ITER_INIT(&uiter);
node = ulist_next(parents, &uiter); node = ulist_next(parents, &uiter);
ref->parent = node ? node->val : 0; ref->parent = node ? node->val : 0;
ref->inode_list = ref->inode_list = node ?
node ? (struct extent_inode_elem *)node->aux : 0; (struct extent_inode_elem *)(uintptr_t)node->aux : 0;
/* additional parents require new refs being added here */ /* additional parents require new refs being added here */
while ((node = ulist_next(parents, &uiter))) { while ((node = ulist_next(parents, &uiter))) {
@ -375,8 +375,8 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info,
} }
memcpy(new_ref, ref, sizeof(*ref)); memcpy(new_ref, ref, sizeof(*ref));
new_ref->parent = node->val; new_ref->parent = node->val;
new_ref->inode_list = new_ref->inode_list = (struct extent_inode_elem *)
(struct extent_inode_elem *)node->aux; (uintptr_t)node->aux;
list_add(&new_ref->list, &ref->list); list_add(&new_ref->list, &ref->list);
} }
ulist_reinit(parents); ulist_reinit(parents);
@ -914,7 +914,7 @@ again:
free_extent_buffer(eb); free_extent_buffer(eb);
} }
ret = ulist_add_merge(refs, ref->parent, ret = ulist_add_merge(refs, ref->parent,
(u64)ref->inode_list, (uintptr_t)ref->inode_list,
(u64 *)&eie, GFP_NOFS); (u64 *)&eie, GFP_NOFS);
if (!ret && extent_item_pos) { if (!ret && extent_item_pos) {
/* /*
@ -959,7 +959,7 @@ static void free_leaf_list(struct ulist *blocks)
while ((node = ulist_next(blocks, &uiter))) { while ((node = ulist_next(blocks, &uiter))) {
if (!node->aux) if (!node->aux)
continue; continue;
eie = (struct extent_inode_elem *)node->aux; eie = (struct extent_inode_elem *)(uintptr_t)node->aux;
for (; eie; eie = eie_next) { for (; eie; eie = eie_next) {
eie_next = eie->next; eie_next = eie->next;
kfree(eie); kfree(eie);
@ -1405,11 +1405,12 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
while (!ret && (root_node = ulist_next(roots, &root_uiter))) { while (!ret && (root_node = ulist_next(roots, &root_uiter))) {
pr_debug("root %llu references leaf %llu, data list " pr_debug("root %llu references leaf %llu, data list "
"%#llx\n", root_node->val, ref_node->val, "%#llx\n", root_node->val, ref_node->val,
ref_node->aux); (long long)ref_node->aux);
ret = iterate_leaf_refs( ret = iterate_leaf_refs((struct extent_inode_elem *)
(struct extent_inode_elem *)ref_node->aux, (uintptr_t)ref_node->aux,
root_node->val, extent_item_objectid, root_node->val,
iterate, ctx); extent_item_objectid,
iterate, ctx);
} }
ulist_free(roots); ulist_free(roots);
roots = NULL; roots = NULL;

View File

@ -25,7 +25,7 @@
#include "transaction.h" #include "transaction.h"
#include "print-tree.h" #include "print-tree.h"
#define __MAX_CSUM_ITEMS(r, size) ((((BTRFS_LEAF_DATA_SIZE(r) - \ #define __MAX_CSUM_ITEMS(r, size) ((unsigned long)(((BTRFS_LEAF_DATA_SIZE(r) - \
sizeof(struct btrfs_item) * 2) / \ sizeof(struct btrfs_item) * 2) / \
size) - 1)) size) - 1))

View File

@ -1145,12 +1145,12 @@ int btrfs_qgroup_account_ref(struct btrfs_trans_handle *trans,
ulist_reinit(tmp); ulist_reinit(tmp);
/* XXX id not needed */ /* XXX id not needed */
ulist_add(tmp, qg->qgroupid, (u64)qg, GFP_ATOMIC); ulist_add(tmp, qg->qgroupid, (u64)(uintptr_t)qg, GFP_ATOMIC);
ULIST_ITER_INIT(&tmp_uiter); ULIST_ITER_INIT(&tmp_uiter);
while ((tmp_unode = ulist_next(tmp, &tmp_uiter))) { while ((tmp_unode = ulist_next(tmp, &tmp_uiter))) {
struct btrfs_qgroup_list *glist; struct btrfs_qgroup_list *glist;
qg = (struct btrfs_qgroup *)tmp_unode->aux; qg = (struct btrfs_qgroup *)(uintptr_t)tmp_unode->aux;
if (qg->refcnt < seq) if (qg->refcnt < seq)
qg->refcnt = seq + 1; qg->refcnt = seq + 1;
else else
@ -1158,7 +1158,7 @@ int btrfs_qgroup_account_ref(struct btrfs_trans_handle *trans,
list_for_each_entry(glist, &qg->groups, next_group) { list_for_each_entry(glist, &qg->groups, next_group) {
ulist_add(tmp, glist->group->qgroupid, ulist_add(tmp, glist->group->qgroupid,
(u64)glist->group, (u64)(uintptr_t)glist->group,
GFP_ATOMIC); GFP_ATOMIC);
} }
} }
@ -1168,13 +1168,13 @@ int btrfs_qgroup_account_ref(struct btrfs_trans_handle *trans,
* step 2: walk from the new root * step 2: walk from the new root
*/ */
ulist_reinit(tmp); ulist_reinit(tmp);
ulist_add(tmp, qgroup->qgroupid, (u64)qgroup, GFP_ATOMIC); ulist_add(tmp, qgroup->qgroupid, (uintptr_t)qgroup, GFP_ATOMIC);
ULIST_ITER_INIT(&uiter); ULIST_ITER_INIT(&uiter);
while ((unode = ulist_next(tmp, &uiter))) { while ((unode = ulist_next(tmp, &uiter))) {
struct btrfs_qgroup *qg; struct btrfs_qgroup *qg;
struct btrfs_qgroup_list *glist; struct btrfs_qgroup_list *glist;
qg = (struct btrfs_qgroup *)unode->aux; qg = (struct btrfs_qgroup *)(uintptr_t)unode->aux;
if (qg->refcnt < seq) { if (qg->refcnt < seq) {
/* not visited by step 1 */ /* not visited by step 1 */
qg->rfer += sgn * node->num_bytes; qg->rfer += sgn * node->num_bytes;
@ -1190,7 +1190,7 @@ int btrfs_qgroup_account_ref(struct btrfs_trans_handle *trans,
list_for_each_entry(glist, &qg->groups, next_group) { list_for_each_entry(glist, &qg->groups, next_group) {
ulist_add(tmp, glist->group->qgroupid, ulist_add(tmp, glist->group->qgroupid,
(u64)glist->group, GFP_ATOMIC); (uintptr_t)glist->group, GFP_ATOMIC);
} }
} }
@ -1208,12 +1208,12 @@ int btrfs_qgroup_account_ref(struct btrfs_trans_handle *trans,
continue; continue;
ulist_reinit(tmp); ulist_reinit(tmp);
ulist_add(tmp, qg->qgroupid, (u64)qg, GFP_ATOMIC); ulist_add(tmp, qg->qgroupid, (uintptr_t)qg, GFP_ATOMIC);
ULIST_ITER_INIT(&tmp_uiter); ULIST_ITER_INIT(&tmp_uiter);
while ((tmp_unode = ulist_next(tmp, &tmp_uiter))) { while ((tmp_unode = ulist_next(tmp, &tmp_uiter))) {
struct btrfs_qgroup_list *glist; struct btrfs_qgroup_list *glist;
qg = (struct btrfs_qgroup *)tmp_unode->aux; qg = (struct btrfs_qgroup *)(uintptr_t)tmp_unode->aux;
if (qg->tag == seq) if (qg->tag == seq)
continue; continue;
@ -1225,7 +1225,7 @@ int btrfs_qgroup_account_ref(struct btrfs_trans_handle *trans,
list_for_each_entry(glist, &qg->groups, next_group) { list_for_each_entry(glist, &qg->groups, next_group) {
ulist_add(tmp, glist->group->qgroupid, ulist_add(tmp, glist->group->qgroupid,
(u64)glist->group, (uintptr_t)glist->group,
GFP_ATOMIC); GFP_ATOMIC);
} }
} }
@ -1469,13 +1469,13 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
* be exceeded * be exceeded
*/ */
ulist = ulist_alloc(GFP_ATOMIC); ulist = ulist_alloc(GFP_ATOMIC);
ulist_add(ulist, qgroup->qgroupid, (u64)qgroup, GFP_ATOMIC); ulist_add(ulist, qgroup->qgroupid, (uintptr_t)qgroup, GFP_ATOMIC);
ULIST_ITER_INIT(&uiter); ULIST_ITER_INIT(&uiter);
while ((unode = ulist_next(ulist, &uiter))) { while ((unode = ulist_next(ulist, &uiter))) {
struct btrfs_qgroup *qg; struct btrfs_qgroup *qg;
struct btrfs_qgroup_list *glist; struct btrfs_qgroup_list *glist;
qg = (struct btrfs_qgroup *)unode->aux; qg = (struct btrfs_qgroup *)(uintptr_t)unode->aux;
if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) && if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) &&
qg->reserved + qg->rfer + num_bytes > qg->reserved + qg->rfer + num_bytes >
@ -1489,7 +1489,7 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
list_for_each_entry(glist, &qg->groups, next_group) { list_for_each_entry(glist, &qg->groups, next_group) {
ulist_add(ulist, glist->group->qgroupid, ulist_add(ulist, glist->group->qgroupid,
(u64)glist->group, GFP_ATOMIC); (uintptr_t)glist->group, GFP_ATOMIC);
} }
} }
if (ret) if (ret)
@ -1502,7 +1502,7 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
while ((unode = ulist_next(ulist, &uiter))) { while ((unode = ulist_next(ulist, &uiter))) {
struct btrfs_qgroup *qg; struct btrfs_qgroup *qg;
qg = (struct btrfs_qgroup *)unode->aux; qg = (struct btrfs_qgroup *)(uintptr_t)unode->aux;
qg->reserved += num_bytes; qg->reserved += num_bytes;
} }
@ -1541,19 +1541,19 @@ void btrfs_qgroup_free(struct btrfs_root *root, u64 num_bytes)
goto out; goto out;
ulist = ulist_alloc(GFP_ATOMIC); ulist = ulist_alloc(GFP_ATOMIC);
ulist_add(ulist, qgroup->qgroupid, (u64)qgroup, GFP_ATOMIC); ulist_add(ulist, qgroup->qgroupid, (uintptr_t)qgroup, GFP_ATOMIC);
ULIST_ITER_INIT(&uiter); ULIST_ITER_INIT(&uiter);
while ((unode = ulist_next(ulist, &uiter))) { while ((unode = ulist_next(ulist, &uiter))) {
struct btrfs_qgroup *qg; struct btrfs_qgroup *qg;
struct btrfs_qgroup_list *glist; struct btrfs_qgroup_list *glist;
qg = (struct btrfs_qgroup *)unode->aux; qg = (struct btrfs_qgroup *)(uintptr_t)unode->aux;
qg->reserved -= num_bytes; qg->reserved -= num_bytes;
list_for_each_entry(glist, &qg->groups, next_group) { list_for_each_entry(glist, &qg->groups, next_group) {
ulist_add(ulist, glist->group->qgroupid, ulist_add(ulist, glist->group->qgroupid,
(u64)glist->group, GFP_ATOMIC); (uintptr_t)glist->group, GFP_ATOMIC);
} }
} }

View File

@ -1035,7 +1035,7 @@ struct backref_ctx {
static int __clone_root_cmp_bsearch(const void *key, const void *elt) static int __clone_root_cmp_bsearch(const void *key, const void *elt)
{ {
u64 root = (u64)key; u64 root = (u64)(uintptr_t)key;
struct clone_root *cr = (struct clone_root *)elt; struct clone_root *cr = (struct clone_root *)elt;
if (root < cr->root->objectid) if (root < cr->root->objectid)
@ -1069,7 +1069,7 @@ static int __iterate_backrefs(u64 ino, u64 offset, u64 root, void *ctx_)
u64 i_size; u64 i_size;
/* First check if the root is in the list of accepted clone sources */ /* First check if the root is in the list of accepted clone sources */
found = bsearch((void *)root, bctx->sctx->clone_roots, found = bsearch((void *)(uintptr_t)root, bctx->sctx->clone_roots,
bctx->sctx->clone_roots_cnt, bctx->sctx->clone_roots_cnt,
sizeof(struct clone_root), sizeof(struct clone_root),
__clone_root_cmp_bsearch); __clone_root_cmp_bsearch);