XArray: Correct xa_store_range
authorMatthew Wilcox <willy@infradead.org>
Mon, 5 Nov 2018 15:53:09 +0000 (10:53 -0500)
committerMatthew Wilcox <willy@infradead.org>
Fri, 16 Nov 2018 21:27:28 +0000 (16:27 -0500)
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>
lib/xarray.c

index 7946380..bbacca5 100644 (file)
@@ -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))