summaryrefslogtreecommitdiff
path: root/kerncompat.h
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2018-06-08 17:53:29 +0300
committerDavid Sterba <dsterba@suse.com>2018-10-23 14:48:41 +0200
commitc6039704c580aeac32d26d858f402be537cbe819 (patch)
tree8cc6f67fc01c51172ac29244586fa9a9378b4fed /kerncompat.h
parent3c8faad5cffdc78c12d318bf4ecd422b9d8f1ab2 (diff)
btrfs-progs: Add delayed refs infrastructure
This commit pulls those portions of the kernel implementation of delayed refs which are necessary to have them working in user-space. I've done the following modifications: 1. Replaced all kmem_cache_alloc calls to kmalloc. 2. Removed all locking-related code, since we are single threaded in userspace. 3. Removed code which deals with data refs - delayed refs in user space are going to be used only for cowonly trees. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'kerncompat.h')
-rw-r--r--kerncompat.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/kerncompat.h b/kerncompat.h
index fa96715f..1a2bc18c 100644
--- a/kerncompat.h
+++ b/kerncompat.h
@@ -263,6 +263,14 @@ static inline int IS_ERR_OR_NULL(const void *ptr)
return !ptr || IS_ERR(ptr);
}
+/**
+ * swap - swap values of @a and @b
+ * @a: first value
+ * @b: second value
+ */
+#define swap(a, b) \
+ do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
+
/*
* This looks more complex than it should be. But we need to
* get the type for the ~ right in round_down (it needs to be