diff options
author | Nikolay Borisov <nborisov@suse.com> | 2018-10-01 17:46:16 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-10-25 16:11:39 +0200 |
commit | 8c028efe4a31e15c0d106daf6218dedc373273c6 (patch) | |
tree | 58d6efe31920b5112e8b6c4ab5bdcaf334b09626 /kerncompat.h | |
parent | a9ce9286f24b299ea2a8465d89cee659c3f5dcf1 (diff) |
btrfs-progs: Pull free space tree related code from kernel
To help implement free space tree checker in user space some kernel
function are necessary, namely iterating/deleting/adding freespace
items, some internal search functions. Functions to populate a block
group based on the extent tree. The code is largely copy/paste from
the kernel with locking eliminated (i.e free_space_lock). It supports
reading/writing of both bitmap and extent based FST 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.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kerncompat.h b/kerncompat.h index 1a2bc18c..c33e485f 100644 --- a/kerncompat.h +++ b/kerncompat.h @@ -263,6 +263,8 @@ static inline int IS_ERR_OR_NULL(const void *ptr) return !ptr || IS_ERR(ptr); } +#define div_u64(x, y) ((x) / (y)) + /** * swap - swap values of @a and @b * @a: first value @@ -297,6 +299,10 @@ static inline int IS_ERR_OR_NULL(const void *ptr) #define kfree(x) free(x) #define vmalloc(x) malloc(x) #define vfree(x) free(x) +#define kvzalloc(x, y) kzalloc(x,y) +#define kvfree(x) free(x) +#define memalloc_nofs_save() (0) +#define memalloc_nofs_restore(x) ((void)(x)) #ifndef BTRFS_DISABLE_BACKTRACE static inline void assert_trace(const char *assertion, const char *filename, |