summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@infradead.org>2018-11-05 10:53:09 -0500
committerMatthew Wilcox <willy@infradead.org>2018-11-16 16:27:28 -0500
commit44a4a66b619a0a83a52e707ebcd80182207bd50e (patch)
treebbeb75a86cf6ded31ba8a81db45fae19bbb34ad2
parent804dfaf01bcc9daa4298c608ba9018abf616ec48 (diff)
downloadlinux-44a4a66b619a0a83a52e707ebcd80182207bd50e.tar.gz
linux-44a4a66b619a0a83a52e707ebcd80182207bd50e.tar.bz2
linux-44a4a66b619a0a83a52e707ebcd80182207bd50e.zip
XArray: Correct xa_store_range
The explicit '64' should have been BITS_PER_LONG, but while looking at this code I realised I meant to use __ffs(), not ilog2(). Signed-off-by: Matthew Wilcox <willy@infradead.org>
-rw-r--r--lib/xarray.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/xarray.c b/lib/xarray.c
index 7946380cd6c9..bbacca576593 100644
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -1565,8 +1565,9 @@ void *xa_store_range(struct xarray *xa, unsigned long first,
do {
xas_lock(&xas);
if (entry) {
- unsigned int order = (last == ~0UL) ? 64 :
- ilog2(last + 1);
+ unsigned int order = BITS_PER_LONG;
+ if (last + 1)
+ order = __ffs(last + 1);
xas_set_order(&xas, last, order);
xas_create(&xas);
if (xas_error(&xas))