From d90d8d2323cdee2bdb3b130236c801ceeb8ea875 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Fri, 10 Oct 2014 16:57:07 -0400 Subject: Btrfs-progs: pull back backref.c and fix it up This patch pulls back backref.c, adds a couple of helpers everywhere that it needs, and cleans up backref.c to fit in btrfs-progs. Thanks, Signed-off-by: Josef Bacik [removed free_some_buffers after "do not reclaim extent buffer"] Signed-off-by: David Sterba --- ulist.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ulist.h') diff --git a/ulist.h b/ulist.h index 2a0e9489..9e0e4e0d 100644 --- a/ulist.h +++ b/ulist.h @@ -58,6 +58,21 @@ void ulist_free(struct ulist *ulist); int ulist_add(struct ulist *ulist, u64 val, u64 aux, gfp_t gfp_mask); int ulist_add_merge(struct ulist *ulist, u64 val, u64 aux, u64 *old_aux, gfp_t gfp_mask); + +/* just like ulist_add_merge() but take a pointer for the aux data */ +static inline int ulist_add_merge_ptr(struct ulist *ulist, u64 val, void *aux, + void **old_aux, gfp_t gfp_mask) +{ +#if BITS_PER_LONG == 32 + u64 old64 = (uintptr_t)*old_aux; + int ret = ulist_add_merge(ulist, val, (uintptr_t)aux, &old64, gfp_mask); + *old_aux = (void *)((uintptr_t)old64); + return ret; +#else + return ulist_add_merge(ulist, val, (u64)aux, (u64 *)old_aux, gfp_mask); +#endif +} + struct ulist_node *ulist_next(struct ulist *ulist, struct ulist_iterator *uiter); -- cgit v1.2.3