1 blockgroup_lock.h: simplify definition of NR_BG_LOCKS
3 From: Eric Biggers <ebiggers@google.com>
5 We can use ilog2() to more easily produce the desired NR_BG_LOCKS. This
6 works because ilog2() is evaluated at compile-time when its argument is
7 a compile-time constant.
9 I did not change the chosen NR_BG_LOCKS values.
11 Signed-off-by: Eric Biggers <ebiggers@google.com>
12 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 Reviewed-by: Andreas Dilger <adilger@dilger.ca>
14 diff --git a/include/linux/blockgroup_lock.h b/include/linux/blockgroup_lock.h
15 index 61b583d..225bdb7 100644
16 --- a/include/linux/blockgroup_lock.h
17 +++ b/include/linux/blockgroup_lock.h
19 #include <linux/cache.h>
24 - * We want a power-of-two. Is there a better way than this?
28 -#define NR_BG_LOCKS 128
30 -#define NR_BG_LOCKS 64
32 -#define NR_BG_LOCKS 32
34 -#define NR_BG_LOCKS 16
36 -#define NR_BG_LOCKS 8
37 +#define NR_BG_LOCKS (4 << ilog2(NR_CPUS < 32 ? NR_CPUS : 32))
39 -#define NR_BG_LOCKS 4
42 -#else /* CONFIG_SMP */
44 -#endif /* CONFIG_SMP */
50 2.8.0.rc3.226.g39d4020