mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-23 00:00:02 +03:00
Shim layer updates
This commit is contained in:
parent
fa36882a73
commit
f2feceddae
@ -25,6 +25,17 @@ int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
|
|||||||
#define small_const_nbits(nbits) \
|
#define small_const_nbits(nbits) \
|
||||||
(__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
|
(__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
|
||||||
|
|
||||||
|
static inline void bitmap_complement(unsigned long *dst, const unsigned long *src,
|
||||||
|
unsigned int bits)
|
||||||
|
{
|
||||||
|
unsigned int k, lim = bits/BITS_PER_LONG;
|
||||||
|
for (k = 0; k < lim; ++k)
|
||||||
|
dst[k] = ~src[k];
|
||||||
|
|
||||||
|
if (bits % BITS_PER_LONG)
|
||||||
|
dst[k] = ~src[k];
|
||||||
|
}
|
||||||
|
|
||||||
static inline void bitmap_zero(unsigned long *dst, int nbits)
|
static inline void bitmap_zero(unsigned long *dst, int nbits)
|
||||||
{
|
{
|
||||||
memset(dst, 0, BITS_TO_LONGS(nbits) * sizeof(unsigned long));
|
memset(dst, 0, BITS_TO_LONGS(nbits) * sizeof(unsigned long));
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#define BUG_ON(cond) assert(!(cond))
|
#define BUG_ON(cond) assert(!(cond))
|
||||||
|
|
||||||
#define WARN_ON_ONCE(cond) assert(!(cond))
|
#define WARN_ON_ONCE(cond) assert(!(cond))
|
||||||
#define WARN_ONCE(cond, msg) assert(!(cond))
|
#define WARN_ONCE(cond, msg) ({ bool _r = (cond); if (_r) assert(0); _r; })
|
||||||
|
|
||||||
#define __WARN() assert(0)
|
#define __WARN() assert(0)
|
||||||
#define __WARN_printf(arg...) assert(0)
|
#define __WARN_printf(arg...) assert(0)
|
||||||
|
@ -382,4 +382,26 @@ static inline void closure_call(struct closure *cl, closure_fn fn,
|
|||||||
continue_at_nobarrier(cl, fn, wq);
|
continue_at_nobarrier(cl, fn, wq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define __closure_wait_event(waitlist, _cond) \
|
||||||
|
do { \
|
||||||
|
struct closure cl; \
|
||||||
|
\
|
||||||
|
closure_init_stack(&cl); \
|
||||||
|
\
|
||||||
|
while (1) { \
|
||||||
|
closure_wait(waitlist, &cl); \
|
||||||
|
if (_cond) \
|
||||||
|
break; \
|
||||||
|
closure_sync(&cl); \
|
||||||
|
} \
|
||||||
|
closure_wake_up(waitlist); \
|
||||||
|
closure_sync(&cl); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define closure_wait_event(waitlist, _cond) \
|
||||||
|
do { \
|
||||||
|
if (!(_cond)) \
|
||||||
|
__closure_wait_event(waitlist, _cond); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#endif /* _LINUX_CLOSURE_H */
|
#endif /* _LINUX_CLOSURE_H */
|
||||||
|
@ -37,4 +37,12 @@ static inline int get_random_int(void)
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline long get_random_long(void)
|
||||||
|
{
|
||||||
|
long v;
|
||||||
|
|
||||||
|
get_random_bytes(&v, sizeof(v));
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* _LINUX_RANDOM_H */
|
#endif /* _LINUX_RANDOM_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user