summaryrefslogtreecommitdiff
path: root/ulist.h
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2014-10-10 16:57:07 -0400
committerDavid Sterba <dsterba@suse.cz>2014-10-14 10:39:38 +0200
commitd90d8d2323cdee2bdb3b130236c801ceeb8ea875 (patch)
tree7ad61eb1363ee1c6c940c55accf54ebac37662f1 /ulist.h
parent6863bcf74fa8bf335d73c04248fc25ac6ada3121 (diff)
downloadbtrfs-progs-d90d8d2323cdee2bdb3b130236c801ceeb8ea875.tar.gz
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 <jbacik@fb.com> [removed free_some_buffers after "do not reclaim extent buffer"] Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'ulist.h')
-rw-r--r--ulist.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/ulist.h b/ulist.h
index 2a0e948..9e0e4e0 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);