Skip to content

Commit 13fd5cf

Browse files
Kemeng Shiakpm00
authored andcommitted
Xarray: use xa_mark_t in xas_squash_marks() to keep code consistent
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]>
1 parent 1988b31 commit 13fd5cf

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

lib/xarray.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,20 @@ static inline void node_mark_all(struct xa_node *node, xa_mark_t mark)
125125
*/
126126
static void xas_squash_marks(const struct xa_state *xas)
127127
{
128-
unsigned int mark = 0;
128+
xa_mark_t mark = 0;
129129
unsigned int limit = xas->xa_offset + xas->xa_sibs + 1;
130130

131-
do {
132-
unsigned long *marks = xas->xa_node->marks[mark];
133-
if (find_next_bit(marks, limit, xas->xa_offset + 1) == limit)
134-
continue;
135-
__set_bit(xas->xa_offset, marks);
136-
bitmap_clear(marks, xas->xa_offset + 1, xas->xa_sibs);
137-
} while (mark++ != (__force unsigned)XA_MARK_MAX);
131+
for (;;) {
132+
unsigned long *marks = node_marks(xas->xa_node, mark);
133+
134+
if (find_next_bit(marks, limit, xas->xa_offset + 1) != limit) {
135+
__set_bit(xas->xa_offset, marks);
136+
bitmap_clear(marks, xas->xa_offset + 1, xas->xa_sibs);
137+
}
138+
if (mark == XA_MARK_MAX)
139+
break;
140+
mark_inc(mark);
141+
}
138142
}
139143

140144
/* extracts the offset within this node from the index */

0 commit comments

Comments
 (0)