XArray: Fix xas_reload for multi-index entries
xas_reload() was only checking that the head entry was still at the head index. If the entry has been split, that's not enough as there may be a different entry at the specified index now. Solve this by checking the slot for the requested index instead of the head index. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
This commit is contained in:
parent
f82cd2f0b5
commit
ca7b639e86
@ -1524,10 +1524,21 @@ void xas_create_range(struct xa_state *);
|
|||||||
static inline void *xas_reload(struct xa_state *xas)
|
static inline void *xas_reload(struct xa_state *xas)
|
||||||
{
|
{
|
||||||
struct xa_node *node = xas->xa_node;
|
struct xa_node *node = xas->xa_node;
|
||||||
|
void *entry;
|
||||||
|
char offset;
|
||||||
|
|
||||||
if (node)
|
if (!node)
|
||||||
return xa_entry(xas->xa, node, xas->xa_offset);
|
return xa_head(xas->xa);
|
||||||
return xa_head(xas->xa);
|
if (IS_ENABLED(CONFIG_XARRAY_MULTI)) {
|
||||||
|
offset = (xas->xa_index >> node->shift) & XA_CHUNK_MASK;
|
||||||
|
entry = xa_entry(xas->xa, node, offset);
|
||||||
|
if (!xa_is_sibling(entry))
|
||||||
|
return entry;
|
||||||
|
offset = xa_to_sibling(entry);
|
||||||
|
} else {
|
||||||
|
offset = xas->xa_offset;
|
||||||
|
}
|
||||||
|
return xa_entry(xas->xa, node, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user