Lines Matching refs:mark
25 * @mark is an xa_mark_t; a small number indicating one of the mark bits.
68 static inline void xa_mark_set(struct xarray *xa, xa_mark_t mark)
70 if (!(xa->xa_flags & XA_FLAGS_MARK(mark)))
71 xa->xa_flags |= XA_FLAGS_MARK(mark);
74 static inline void xa_mark_clear(struct xarray *xa, xa_mark_t mark)
76 if (xa->xa_flags & XA_FLAGS_MARK(mark))
77 xa->xa_flags &= ~(XA_FLAGS_MARK(mark));
80 static inline unsigned long *node_marks(struct xa_node *node, xa_mark_t mark)
82 return node->marks[(__force unsigned)mark];
86 unsigned int offset, xa_mark_t mark)
88 return test_bit(offset, node_marks(node, mark));
93 xa_mark_t mark)
95 return __test_and_set_bit(offset, node_marks(node, mark));
100 xa_mark_t mark)
102 return __test_and_clear_bit(offset, node_marks(node, mark));
105 static inline bool node_any_mark(struct xa_node *node, xa_mark_t mark)
107 return !bitmap_empty(node_marks(node, mark), XA_CHUNK_SIZE);
110 static inline void node_mark_all(struct xa_node *node, xa_mark_t mark)
112 bitmap_fill(node_marks(node, mark), XA_CHUNK_SIZE);
115 #define mark_inc(mark) do { \
116 mark = (__force xa_mark_t)((__force unsigned)(mark) + 1); \
123 * Set a mark on the first entry if any entry has it set. Clear marks on
128 xa_mark_t mark = 0;
132 unsigned long *marks = node_marks(xas->xa_node, mark);
138 if (mark == XA_MARK_MAX)
140 mark_inc(mark);
588 xa_mark_t mark = 0;
600 /* Propagate the aggregated mark info to the new child */
602 if (xa_track_free(xa) && mark == XA_FREE_MARK) {
608 } else if (xa_marked(xa, mark)) {
609 node_set_mark(node, 0, mark);
611 if (mark == XA_MARK_MAX)
613 mark_inc(mark);
825 * so the mark clearing will appear to happen before the
859 * xas_get_mark() - Returns the state of this mark.
861 * @mark: Mark number.
863 * Return: true if the mark is set, false if the mark is clear or @xas
866 bool xas_get_mark(const struct xa_state *xas, xa_mark_t mark)
871 return xa_marked(xas->xa, mark);
872 return node_get_mark(xas->xa_node, xas->xa_offset, mark);
877 * xas_set_mark() - Sets the mark on this entry and its parents.
879 * @mark: Mark number.
881 * Sets the specified mark on this entry, and walks up the tree setting it
885 void xas_set_mark(const struct xa_state *xas, xa_mark_t mark)
894 if (node_set_mark(node, offset, mark))
900 if (!xa_marked(xas->xa, mark))
901 xa_mark_set(xas->xa, mark);
906 * xas_clear_mark() - Clears the mark on this entry and its parents.
908 * @mark: Mark number.
910 * Clears the specified mark on this entry, and walks back to the head
914 void xas_clear_mark(const struct xa_state *xas, xa_mark_t mark)
923 if (!node_clear_mark(node, offset, mark))
925 if (node_any_mark(node, mark))
932 if (xa_marked(xas->xa, mark))
933 xa_mark_clear(xas->xa, mark);
942 * free entries with a mark, we need to set it on all entries. All other
950 xa_mark_t mark = 0;
953 if (xa_track_free(xas->xa) && mark == XA_FREE_MARK)
954 xas_set_mark(xas, mark);
956 xas_clear_mark(xas, mark);
957 if (mark == XA_MARK_MAX)
959 mark_inc(mark);
968 xa_mark_t mark = XA_MARK_0;
971 if (node_get_mark(node, offset, mark))
972 marks |= 1 << (__force unsigned int)mark;
973 if (mark == XA_MARK_MAX)
975 mark_inc(mark);
982 xa_mark_t mark)
987 node_mark_all(node, mark);
990 node_set_mark(node, i, mark);
998 xa_mark_t mark = XA_MARK_0;
1001 if (marks & (1 << (__force unsigned int)mark)) {
1002 node_set_mark(node, offset, mark);
1004 node_mark_slots(child, sibs, mark);
1006 if (mark == XA_MARK_MAX)
1008 mark_inc(mark);
1451 * @mark: Mark number to search for.
1468 void *xas_find_marked(struct xa_state *xas, unsigned long max, xa_mark_t mark)
1489 if (xa_marked(xas->xa, mark))
1516 offset = xas_find_chunk(xas, advance, mark);
1529 if (!entry && !(xa_track_free(xas->xa) && mark == XA_FREE_MARK))
2073 * __xa_set_mark() - Set this mark on this entry while locked.
2076 * @mark: Mark number.
2078 * Attempting to set a mark on a %NULL entry does not succeed.
2082 void __xa_set_mark(struct xarray *xa, unsigned long index, xa_mark_t mark)
2088 xas_set_mark(&xas, mark);
2093 * __xa_clear_mark() - Clear this mark on this entry while locked.
2096 * @mark: Mark number.
2100 void __xa_clear_mark(struct xarray *xa, unsigned long index, xa_mark_t mark)
2106 xas_clear_mark(&xas, mark);
2111 * xa_get_mark() - Inquire whether this mark is set on this entry.
2114 * @mark: Mark number.
2120 * Return: True if the entry at @index has this mark set, false if it doesn't.
2122 bool xa_get_mark(struct xarray *xa, unsigned long index, xa_mark_t mark)
2129 while (xas_get_mark(&xas, mark)) {
2143 * xa_set_mark() - Set this mark on this entry.
2146 * @mark: Mark number.
2148 * Attempting to set a mark on a %NULL entry does not succeed.
2152 void xa_set_mark(struct xarray *xa, unsigned long index, xa_mark_t mark)
2155 __xa_set_mark(xa, index, mark);
2161 * xa_clear_mark() - Clear this mark on this entry.
2164 * @mark: Mark number.
2166 * Clearing a mark always succeeds.
2170 void xa_clear_mark(struct xarray *xa, unsigned long index, xa_mark_t mark)
2173 __xa_clear_mark(xa, index, mark);
2296 unsigned long max, unsigned int n, xa_mark_t mark)
2302 xas_for_each_marked(xas, entry, max, mark) {
2326 * The @filter may be an XArray mark value, in which case entries which are
2327 * marked with that mark will be copied. It may also be %XA_PRESENT, in