Lines Matching refs:mark

23  * @mark is an xa_mark_t; a small number indicating one of the mark bits.
66 static inline void xa_mark_set(struct xarray *xa, xa_mark_t mark)
68 if (!(xa->xa_flags & XA_FLAGS_MARK(mark)))
69 xa->xa_flags |= XA_FLAGS_MARK(mark);
72 static inline void xa_mark_clear(struct xarray *xa, xa_mark_t mark)
74 if (xa->xa_flags & XA_FLAGS_MARK(mark))
75 xa->xa_flags &= ~(XA_FLAGS_MARK(mark));
78 static inline unsigned long *node_marks(struct xa_node *node, xa_mark_t mark)
80 return node->marks[(__force unsigned)mark];
84 unsigned int offset, xa_mark_t mark)
86 return test_bit(offset, node_marks(node, mark));
91 xa_mark_t mark)
93 return __test_and_set_bit(offset, node_marks(node, mark));
98 xa_mark_t mark)
100 return __test_and_clear_bit(offset, node_marks(node, mark));
103 static inline bool node_any_mark(struct xa_node *node, xa_mark_t mark)
105 return !bitmap_empty(node_marks(node, mark), XA_CHUNK_SIZE);
108 static inline void node_mark_all(struct xa_node *node, xa_mark_t mark)
110 bitmap_fill(node_marks(node, mark), XA_CHUNK_SIZE);
113 #define mark_inc(mark) do { \
114 mark = (__force xa_mark_t)((__force unsigned)(mark) + 1); \
121 * Set a mark on the first entry if any entry has it set. Clear marks on
126 unsigned int mark = 0;
133 unsigned long *marks = xas->xa_node->marks[mark];
138 } while (mark++ != (__force unsigned)XA_MARK_MAX);
578 xa_mark_t mark = 0;
590 /* Propagate the aggregated mark info to the new child */
592 if (xa_track_free(xa) && mark == XA_FREE_MARK) {
598 } else if (xa_marked(xa, mark)) {
599 node_set_mark(node, 0, mark);
601 if (mark == XA_MARK_MAX)
603 mark_inc(mark);
815 * so the mark clearing will appear to happen before the
849 * xas_get_mark() - Returns the state of this mark.
851 * @mark: Mark number.
853 * Return: true if the mark is set, false if the mark is clear or @xas
856 bool xas_get_mark(const struct xa_state *xas, xa_mark_t mark)
861 return xa_marked(xas->xa, mark);
862 return node_get_mark(xas->xa_node, xas->xa_offset, mark);
867 * xas_set_mark() - Sets the mark on this entry and its parents.
869 * @mark: Mark number.
871 * Sets the specified mark on this entry, and walks up the tree setting it
875 void xas_set_mark(const struct xa_state *xas, xa_mark_t mark)
884 if (node_set_mark(node, offset, mark))
890 if (!xa_marked(xas->xa, mark))
891 xa_mark_set(xas->xa, mark);
896 * xas_clear_mark() - Clears the mark on this entry and its parents.
898 * @mark: Mark number.
900 * Clears the specified mark on this entry, and walks back to the head
904 void xas_clear_mark(const struct xa_state *xas, xa_mark_t mark)
913 if (!node_clear_mark(node, offset, mark))
915 if (node_any_mark(node, mark))
922 if (xa_marked(xas->xa, mark))
923 xa_mark_clear(xas->xa, mark);
932 * free entries with a mark, we need to set it on all entries. All other
940 xa_mark_t mark = 0;
943 if (xa_track_free(xas->xa) && mark == XA_FREE_MARK)
944 xas_set_mark(xas, mark);
946 xas_clear_mark(xas, mark);
947 if (mark == XA_MARK_MAX)
949 mark_inc(mark);
958 xa_mark_t mark = XA_MARK_0;
961 if (node_get_mark(node, offset, mark))
962 marks |= 1 << (__force unsigned int)mark;
963 if (mark == XA_MARK_MAX)
965 mark_inc(mark);
974 xa_mark_t mark = XA_MARK_0;
977 if (marks & (1 << (__force unsigned int)mark)) {
978 node_set_mark(node, offset, mark);
980 node_mark_all(child, mark);
982 if (mark == XA_MARK_MAX)
984 mark_inc(mark);
1287 * @mark: Mark number to search for.
1304 void *xas_find_marked(struct xa_state *xas, unsigned long max, xa_mark_t mark)
1325 if (xa_marked(xas->xa, mark))
1352 offset = xas_find_chunk(xas, advance, mark);
1365 if (!entry && !(xa_track_free(xas->xa) && mark == XA_FREE_MARK))
1887 * __xa_set_mark() - Set this mark on this entry while locked.
1890 * @mark: Mark number.
1892 * Attempting to set a mark on a %NULL entry does not succeed.
1896 void __xa_set_mark(struct xarray *xa, unsigned long index, xa_mark_t mark)
1902 xas_set_mark(&xas, mark);
1907 * __xa_clear_mark() - Clear this mark on this entry while locked.
1910 * @mark: Mark number.
1914 void __xa_clear_mark(struct xarray *xa, unsigned long index, xa_mark_t mark)
1920 xas_clear_mark(&xas, mark);
1925 * xa_get_mark() - Inquire whether this mark is set on this entry.
1928 * @mark: Mark number.
1934 * Return: True if the entry at @index has this mark set, false if it doesn't.
1936 bool xa_get_mark(struct xarray *xa, unsigned long index, xa_mark_t mark)
1943 while (xas_get_mark(&xas, mark)) {
1957 * xa_set_mark() - Set this mark on this entry.
1960 * @mark: Mark number.
1962 * Attempting to set a mark on a %NULL entry does not succeed.
1966 void xa_set_mark(struct xarray *xa, unsigned long index, xa_mark_t mark)
1969 __xa_set_mark(xa, index, mark);
1975 * xa_clear_mark() - Clear this mark on this entry.
1978 * @mark: Mark number.
1980 * Clearing a mark always succeeds.
1984 void xa_clear_mark(struct xarray *xa, unsigned long index, xa_mark_t mark)
1987 __xa_clear_mark(xa, index, mark);
2110 unsigned long max, unsigned int n, xa_mark_t mark)
2116 xas_for_each_marked(xas, entry, max, mark) {
2140 * The @filter may be an XArray mark value, in which case entries which are
2141 * marked with that mark will be copied. It may also be %XA_PRESENT, in