diff options
-rw-r--r-- | fs/btrfs/backref.c | 11 | ||||
-rw-r--r-- | fs/btrfs/ulist.h | 15 |
2 files changed, 20 insertions, 6 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index a1efd39ca28a..54a201dac7f9 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c | |||
@@ -276,9 +276,8 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path, | |||
276 | } | 276 | } |
277 | if (ret > 0) | 277 | if (ret > 0) |
278 | goto next; | 278 | goto next; |
279 | ret = ulist_add_merge(parents, eb->start, | 279 | ret = ulist_add_merge_ptr(parents, eb->start, |
280 | (uintptr_t)eie, | 280 | eie, (void **)&old, GFP_NOFS); |
281 | (u64 *)&old, GFP_NOFS); | ||
282 | if (ret < 0) | 281 | if (ret < 0) |
283 | break; | 282 | break; |
284 | if (!ret && extent_item_pos) { | 283 | if (!ret && extent_item_pos) { |
@@ -1011,9 +1010,9 @@ again: | |||
1011 | goto out; | 1010 | goto out; |
1012 | ref->inode_list = eie; | 1011 | ref->inode_list = eie; |
1013 | } | 1012 | } |
1014 | ret = ulist_add_merge(refs, ref->parent, | 1013 | ret = ulist_add_merge_ptr(refs, ref->parent, |
1015 | (uintptr_t)ref->inode_list, | 1014 | ref->inode_list, |
1016 | (u64 *)&eie, GFP_NOFS); | 1015 | (void **)&eie, GFP_NOFS); |
1017 | if (ret < 0) | 1016 | if (ret < 0) |
1018 | goto out; | 1017 | goto out; |
1019 | if (!ret && extent_item_pos) { | 1018 | if (!ret && extent_item_pos) { |
diff --git a/fs/btrfs/ulist.h b/fs/btrfs/ulist.h index 7f78cbf5cf41..4c29db604bbe 100644 --- a/fs/btrfs/ulist.h +++ b/fs/btrfs/ulist.h | |||
@@ -57,6 +57,21 @@ void ulist_free(struct ulist *ulist); | |||
57 | int ulist_add(struct ulist *ulist, u64 val, u64 aux, gfp_t gfp_mask); | 57 | int ulist_add(struct ulist *ulist, u64 val, u64 aux, gfp_t gfp_mask); |
58 | int ulist_add_merge(struct ulist *ulist, u64 val, u64 aux, | 58 | int ulist_add_merge(struct ulist *ulist, u64 val, u64 aux, |
59 | u64 *old_aux, gfp_t gfp_mask); | 59 | u64 *old_aux, gfp_t gfp_mask); |
60 | |||
61 | /* just like ulist_add_merge() but take a pointer for the aux data */ | ||
62 | static inline int ulist_add_merge_ptr(struct ulist *ulist, u64 val, void *aux, | ||
63 | void **old_aux, gfp_t gfp_mask) | ||
64 | { | ||
65 | #if BITS_PER_LONG == 32 | ||
66 | u64 old64 = (uintptr_t)*old_aux; | ||
67 | int ret = ulist_add_merge(ulist, val, (uintptr_t)aux, &old64, gfp_mask); | ||
68 | *old_aux = (void *)((uintptr_t)old64); | ||
69 | return ret; | ||
70 | #else | ||
71 | return ulist_add_merge(ulist, val, (u64)aux, (u64 *)old_aux, gfp_mask); | ||
72 | #endif | ||
73 | } | ||
74 | |||
60 | struct ulist_node *ulist_next(struct ulist *ulist, | 75 | struct ulist_node *ulist_next(struct ulist *ulist, |
61 | struct ulist_iterator *uiter); | 76 | struct ulist_iterator *uiter); |
62 | 77 | ||