Skip to content

Commit

Permalink
XArray: Correct xa_store_range
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Matthew Wilcox committed Nov 16, 2018
1 parent 804dfaf commit 44a4a66
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/xarray.c
Original file line number Diff line number Diff line change
@@ -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))

0 comments on commit 44a4a66

Please sign in to comment.