Lines Matching refs:ctor

36 static inline void z_erofs_pagevec_ctor_exit(struct z_erofs_pagevec_ctor *ctor,  in z_erofs_pagevec_ctor_exit()  argument
39 if (!ctor->curr) in z_erofs_pagevec_ctor_exit()
43 kunmap_atomic(ctor->pages); in z_erofs_pagevec_ctor_exit()
45 kunmap(ctor->curr); in z_erofs_pagevec_ctor_exit()
49 z_erofs_pagevec_ctor_next_page(struct z_erofs_pagevec_ctor *ctor, in z_erofs_pagevec_ctor_next_page() argument
55 if (ctor->next) in z_erofs_pagevec_ctor_next_page()
56 return ctor->next; in z_erofs_pagevec_ctor_next_page()
59 const erofs_vtptr_t t = ctor->pages[index]; in z_erofs_pagevec_ctor_next_page()
65 DBG_BUGON(nr >= ctor->nr); in z_erofs_pagevec_ctor_next_page()
70 z_erofs_pagevec_ctor_pagedown(struct z_erofs_pagevec_ctor *ctor, in z_erofs_pagevec_ctor_pagedown() argument
73 struct page *next = z_erofs_pagevec_ctor_next_page(ctor, ctor->nr); in z_erofs_pagevec_ctor_pagedown()
75 z_erofs_pagevec_ctor_exit(ctor, atomic); in z_erofs_pagevec_ctor_pagedown()
77 ctor->curr = next; in z_erofs_pagevec_ctor_pagedown()
78 ctor->next = NULL; in z_erofs_pagevec_ctor_pagedown()
79 ctor->pages = atomic ? in z_erofs_pagevec_ctor_pagedown()
80 kmap_atomic(ctor->curr) : kmap(ctor->curr); in z_erofs_pagevec_ctor_pagedown()
82 ctor->nr = PAGE_SIZE / sizeof(struct page *); in z_erofs_pagevec_ctor_pagedown()
83 ctor->index = 0; in z_erofs_pagevec_ctor_pagedown()
86 static inline void z_erofs_pagevec_ctor_init(struct z_erofs_pagevec_ctor *ctor, in z_erofs_pagevec_ctor_init() argument
91 ctor->nr = nr; in z_erofs_pagevec_ctor_init()
92 ctor->curr = ctor->next = NULL; in z_erofs_pagevec_ctor_init()
93 ctor->pages = pages; in z_erofs_pagevec_ctor_init()
97 z_erofs_pagevec_ctor_pagedown(ctor, false); in z_erofs_pagevec_ctor_init()
98 while (i > ctor->nr) { in z_erofs_pagevec_ctor_init()
99 i -= ctor->nr; in z_erofs_pagevec_ctor_init()
100 z_erofs_pagevec_ctor_pagedown(ctor, false); in z_erofs_pagevec_ctor_init()
103 ctor->next = z_erofs_pagevec_ctor_next_page(ctor, i); in z_erofs_pagevec_ctor_init()
104 ctor->index = i; in z_erofs_pagevec_ctor_init()
107 static inline bool z_erofs_pagevec_enqueue(struct z_erofs_pagevec_ctor *ctor, in z_erofs_pagevec_enqueue() argument
112 if (!ctor->next) { in z_erofs_pagevec_enqueue()
118 ctor->index + 1 == ctor->nr) in z_erofs_pagevec_enqueue()
122 if (ctor->index >= ctor->nr) in z_erofs_pagevec_enqueue()
123 z_erofs_pagevec_ctor_pagedown(ctor, false); in z_erofs_pagevec_enqueue()
130 if (type == (uintptr_t)ctor->next) { in z_erofs_pagevec_enqueue()
131 ctor->next = page; in z_erofs_pagevec_enqueue()
133 ctor->pages[ctor->index++] = tagptr_fold(erofs_vtptr_t, page, type); in z_erofs_pagevec_enqueue()
138 z_erofs_pagevec_dequeue(struct z_erofs_pagevec_ctor *ctor, in z_erofs_pagevec_dequeue() argument
143 if (ctor->index >= ctor->nr) { in z_erofs_pagevec_dequeue()
144 DBG_BUGON(!ctor->next); in z_erofs_pagevec_dequeue()
145 z_erofs_pagevec_ctor_pagedown(ctor, true); in z_erofs_pagevec_dequeue()
148 t = ctor->pages[ctor->index]; in z_erofs_pagevec_dequeue()
153 if (*type == (uintptr_t)ctor->next) in z_erofs_pagevec_dequeue()
154 ctor->next = tagptr_unfold_ptr(t); in z_erofs_pagevec_dequeue()
156 ctor->pages[ctor->index++] = tagptr_fold(erofs_vtptr_t, NULL, 0); in z_erofs_pagevec_dequeue()