diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2017-04-09 20:11:10 -0800 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2017-04-09 20:12:37 -0800 |
commit | e783d814e83b2309930e1f6459212da6da8c8a54 (patch) | |
tree | 92c5b4b6e1c9e1e79db85470db934e34975e1c57 /include | |
parent | 2615d73a7428a08abdd058c875067847bf93d55c (diff) |
Update bcachefs sources to da037866e6
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/bitops.h | 25 | ||||
-rw-r--r-- | include/linux/log2.h | 25 |
2 files changed, 25 insertions, 25 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index a0c6508c..47fffb79 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -247,29 +247,4 @@ unsigned long rounddown_pow_of_two(unsigned long n) return 1UL << (fls_long(n) - 1); } -static inline __attribute_const__ -int __get_order(unsigned long size) -{ - int order; - - size--; - size >>= PAGE_SHIFT; -#if BITS_PER_LONG == 32 - order = fls(size); -#else - order = fls64(size); -#endif - return order; -} - -#define get_order(n) \ -( \ - __builtin_constant_p(n) ? ( \ - ((n) == 0UL) ? BITS_PER_LONG - PAGE_SHIFT : \ - (((n) < (1UL << PAGE_SHIFT)) ? 0 : \ - ilog2((n) - 1) - PAGE_SHIFT + 1) \ - ) : \ - __get_order(n) \ -) - #endif diff --git a/include/linux/log2.h b/include/linux/log2.h index 395cda29..6fecd393 100644 --- a/include/linux/log2.h +++ b/include/linux/log2.h @@ -184,4 +184,29 @@ unsigned long __rounddown_pow_of_two(unsigned long n) __rounddown_pow_of_two(n) \ ) +static inline __attribute_const__ +int __get_order(unsigned long size) +{ + int order; + + size--; + size >>= PAGE_SHIFT; +#if BITS_PER_LONG == 32 + order = fls(size); +#else + order = fls64(size); +#endif + return order; +} + +#define get_order(n) \ +( \ + __builtin_constant_p(n) ? ( \ + ((n) == 0UL) ? BITS_PER_LONG - PAGE_SHIFT : \ + (((n) < (1UL << PAGE_SHIFT)) ? 0 : \ + ilog2((n) - 1) - PAGE_SHIFT + 1) \ + ) : \ + __get_order(n) \ +) + #endif /* _TOOLS_LINUX_LOG2_H */ |