Lines Matching +full:slot +full:- +full:size

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
9 * Documentation/core-api/folio_queue.rst
22 * iterator. The possibility exists of inserting non-folio elements into the
34 unsigned long marks; /* 1-bit mark per folio */
35 unsigned long marks2; /* Second 1-bit mark per folio */
36 unsigned long marks3; /* Third 1-bit mark per folio */
45 * folioq_init - Initialise a folio queue segment
55 folio_batch_init(&folioq->vec); in folioq_init()
56 folioq->next = NULL; in folioq_init()
57 folioq->prev = NULL; in folioq_init()
58 folioq->marks = 0; in folioq_init()
59 folioq->marks2 = 0; in folioq_init()
60 folioq->marks3 = 0; in folioq_init()
61 folioq->rreq_id = rreq_id; in folioq_init()
62 folioq->debug_id = 0; in folioq_init()
86 return folio_batch_count(&folioq->vec); in folioq_count()
98 //return !folio_batch_space(&folioq->vec); in folioq_full()
105 * @slot: The slot number of the folio to query
107 * Determine if the first mark is set for the folio in the specified slot in a
110 static inline bool folioq_is_marked(const struct folio_queue *folioq, unsigned int slot) in folioq_is_marked() argument
112 return test_bit(slot, &folioq->marks); in folioq_is_marked()
118 * @slot: The slot number of the folio to modify
120 * Set the first mark for the folio in the specified slot in a folio queue
123 static inline void folioq_mark(struct folio_queue *folioq, unsigned int slot) in folioq_mark() argument
125 set_bit(slot, &folioq->marks); in folioq_mark()
131 * @slot: The slot number of the folio to modify
133 * Clear the first mark for the folio in the specified slot in a folio queue
136 static inline void folioq_unmark(struct folio_queue *folioq, unsigned int slot) in folioq_unmark() argument
138 clear_bit(slot, &folioq->marks); in folioq_unmark()
144 * @slot: The slot number of the folio to query
146 * Determine if the second mark is set for the folio in the specified slot in a
149 static inline bool folioq_is_marked2(const struct folio_queue *folioq, unsigned int slot) in folioq_is_marked2() argument
151 return test_bit(slot, &folioq->marks2); in folioq_is_marked2()
157 * @slot: The slot number of the folio to modify
159 * Set the second mark for the folio in the specified slot in a folio queue
162 static inline void folioq_mark2(struct folio_queue *folioq, unsigned int slot) in folioq_mark2() argument
164 set_bit(slot, &folioq->marks2); in folioq_mark2()
170 * @slot: The slot number of the folio to modify
172 * Clear the second mark for the folio in the specified slot in a folio queue
175 static inline void folioq_unmark2(struct folio_queue *folioq, unsigned int slot) in folioq_unmark2() argument
177 clear_bit(slot, &folioq->marks2); in folioq_unmark2()
183 * @slot: The slot number of the folio to query
185 * Determine if the third mark is set for the folio in the specified slot in a
188 static inline bool folioq_is_marked3(const struct folio_queue *folioq, unsigned int slot) in folioq_is_marked3() argument
190 return test_bit(slot, &folioq->marks3); in folioq_is_marked3()
196 * @slot: The slot number of the folio to modify
198 * Set the third mark for the folio in the specified slot in a folio queue
201 static inline void folioq_mark3(struct folio_queue *folioq, unsigned int slot) in folioq_mark3() argument
203 set_bit(slot, &folioq->marks3); in folioq_mark3()
209 * @slot: The slot number of the folio to modify
211 * Clear the third mark for the folio in the specified slot in a folio queue
214 static inline void folioq_unmark3(struct folio_queue *folioq, unsigned int slot) in folioq_unmark3() argument
216 clear_bit(slot, &folioq->marks3); in folioq_unmark3()
223 return folio->_flags_1 & 0xff; in __folio_order()
232 * the occupancy count and returning the slot number for the folio just added.
233 * The folio size is extracted and stored in the queue and the marks are left
241 unsigned int slot = folioq->vec.nr++; in folioq_append() local
243 folioq->vec.folios[slot] = folio; in folioq_append()
244 folioq->orders[slot] = __folio_order(folio); in folioq_append()
245 return slot; in folioq_append()
254 * the occupancy count and returning the slot number for the folio just added.
255 * The folio size is extracted and stored in the queue, the first mark is set
263 unsigned int slot = folioq->vec.nr++; in folioq_append_mark() local
265 folioq->vec.folios[slot] = folio; in folioq_append_mark()
266 folioq->orders[slot] = __folio_order(folio); in folioq_append_mark()
267 folioq_mark(folioq, slot); in folioq_append_mark()
268 return slot; in folioq_append_mark()
274 * @slot: The folio slot to access
276 * Retrieve the folio in the specified slot from a folio queue segment. Note
277 * that no bounds check is made and if the slot hasn't been added into yet, the
278 * pointer will be undefined. If the slot has been cleared, NULL will be
281 static inline struct folio *folioq_folio(const struct folio_queue *folioq, unsigned int slot) in folioq_folio() argument
283 return folioq->vec.folios[slot]; in folioq_folio()
289 * @slot: The folio slot to access
291 * Retrieve the order of the folio in the specified slot from a folio queue
292 * segment. Note that no bounds check is made and if the slot hasn't been
295 static inline unsigned int folioq_folio_order(const struct folio_queue *folioq, unsigned int slot) in folioq_folio_order() argument
297 return folioq->orders[slot]; in folioq_folio_order()
301 * folioq_folio_size: Get the size of a folio from a folio queue segment
303 * @slot: The folio slot to access
305 * Retrieve the size of the folio in the specified slot from a folio queue
306 * segment. Note that no bounds check is made and if the slot hasn't been
307 * added into yet, the size returned will be PAGE_SIZE.
309 static inline size_t folioq_folio_size(const struct folio_queue *folioq, unsigned int slot) in folioq_folio_size() argument
311 return PAGE_SIZE << folioq_folio_order(folioq, slot); in folioq_folio_size()
317 * @slot: The folio slot to clear
322 static inline void folioq_clear(struct folio_queue *folioq, unsigned int slot) in folioq_clear() argument
324 folioq->vec.folios[slot] = NULL; in folioq_clear()
325 folioq_unmark(folioq, slot); in folioq_clear()
326 folioq_unmark2(folioq, slot); in folioq_clear()
327 folioq_unmark3(folioq, slot); in folioq_clear()