Skip to content

Commit

Permalink
Xarray: use xa_mark_t in xas_squash_marks() to keep code consistent
Browse files Browse the repository at this point in the history
Besides xas_squash_marks(), all functions use xa_mark_t type to iterate
all possible marks.  Use xa_mark_t in xas_squash_marks() to keep code
consistent.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Kemeng Shi <[email protected]>
Cc: Mattew Wilcox <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
Kemeng Shi authored and akpm00 committed Jan 25, 2025
1 parent 1988b31 commit 13fd5cf
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions lib/xarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,20 @@ static inline void node_mark_all(struct xa_node *node, xa_mark_t mark)
*/
static void xas_squash_marks(const struct xa_state *xas)
{
unsigned int mark = 0;
xa_mark_t mark = 0;
unsigned int limit = xas->xa_offset + xas->xa_sibs + 1;

do {
unsigned long *marks = xas->xa_node->marks[mark];
if (find_next_bit(marks, limit, xas->xa_offset + 1) == limit)
continue;
__set_bit(xas->xa_offset, marks);
bitmap_clear(marks, xas->xa_offset + 1, xas->xa_sibs);
} while (mark++ != (__force unsigned)XA_MARK_MAX);
for (;;) {
unsigned long *marks = node_marks(xas->xa_node, mark);

if (find_next_bit(marks, limit, xas->xa_offset + 1) != limit) {
__set_bit(xas->xa_offset, marks);
bitmap_clear(marks, xas->xa_offset + 1, xas->xa_sibs);
}
if (mark == XA_MARK_MAX)
break;
mark_inc(mark);
}
}

/* extracts the offset within this node from the index */
Expand Down

0 comments on commit 13fd5cf

Please sign in to comment.