Lines Matching refs:clt
145 struct z_erofs_collector clt; member
158 .inode = __i, .clt = COLLECTOR_INIT(), \
164 static void preload_compressed_pages(struct z_erofs_collector *clt, in preload_compressed_pages() argument
169 const struct z_erofs_pcluster *pcl = clt->pcl; in preload_compressed_pages()
171 struct page **pages = clt->compressedpages; in preload_compressed_pages()
175 if (clt->mode < COLLECT_PRIMARY_FOLLOWED) in preload_compressed_pages()
194 clt->compressedpages = pages; in preload_compressed_pages()
207 clt->mode = COLLECT_PRIMARY_FOLLOWED_NOINPLACE; in preload_compressed_pages()
276 static inline bool z_erofs_try_inplace_io(struct z_erofs_collector *clt, in z_erofs_try_inplace_io() argument
279 struct z_erofs_pcluster *const pcl = clt->pcl; in z_erofs_try_inplace_io()
282 while (clt->compressedpages < pcl->compressed_pages + clusterpages) { in z_erofs_try_inplace_io()
283 if (!cmpxchg(clt->compressedpages++, NULL, page)) in z_erofs_try_inplace_io()
290 static int z_erofs_attach_page(struct z_erofs_collector *clt, in z_erofs_attach_page() argument
298 if (clt->mode >= COLLECT_PRIMARY && in z_erofs_attach_page()
300 z_erofs_try_inplace_io(clt, page)) in z_erofs_attach_page()
303 ret = z_erofs_pagevec_enqueue(&clt->vector, in z_erofs_attach_page()
305 clt->cl->vcnt += (unsigned int)ret; in z_erofs_attach_page()
340 static struct z_erofs_collection *cllookup(struct z_erofs_collector *clt, in cllookup() argument
355 if (clt->owned_head == &pcl->next || pcl == clt->tailpcl) { in cllookup()
389 if (clt->owned_head == Z_EROFS_PCLUSTER_TAIL) in cllookup()
390 clt->tailpcl = pcl; in cllookup()
391 clt->mode = try_to_claim_pcluster(pcl, &clt->owned_head); in cllookup()
393 if (clt->owned_head == Z_EROFS_PCLUSTER_TAIL) in cllookup()
394 clt->tailpcl = NULL; in cllookup()
395 clt->pcl = pcl; in cllookup()
396 clt->cl = cl; in cllookup()
400 static struct z_erofs_collection *clregister(struct z_erofs_collector *clt, in clregister() argument
429 pcl->next = clt->owned_head; in clregister()
430 clt->mode = COLLECT_PRIMARY_FOLLOWED; in clregister()
448 if (clt->owned_head == Z_EROFS_PCLUSTER_TAIL) in clregister()
449 clt->tailpcl = pcl; in clregister()
450 clt->owned_head = &pcl->next; in clregister()
451 clt->pcl = pcl; in clregister()
452 clt->cl = cl; in clregister()
456 static int z_erofs_collector_begin(struct z_erofs_collector *clt, in z_erofs_collector_begin() argument
462 DBG_BUGON(clt->cl); in z_erofs_collector_begin()
465 DBG_BUGON(clt->owned_head == Z_EROFS_PCLUSTER_NIL); in z_erofs_collector_begin()
466 DBG_BUGON(clt->owned_head == Z_EROFS_PCLUSTER_TAIL_CLOSED); in z_erofs_collector_begin()
474 cl = cllookup(clt, inode, map); in z_erofs_collector_begin()
476 cl = clregister(clt, inode, map); in z_erofs_collector_begin()
485 z_erofs_pagevec_ctor_init(&clt->vector, Z_EROFS_NR_INLINE_PAGEVECS, in z_erofs_collector_begin()
488 clt->compressedpages = clt->pcl->compressed_pages; in z_erofs_collector_begin()
489 if (clt->mode <= COLLECT_PRIMARY) /* cannot do in-place I/O */ in z_erofs_collector_begin()
490 clt->compressedpages += Z_EROFS_CLUSTER_MAX_PAGES; in z_erofs_collector_begin()
525 static bool z_erofs_collector_end(struct z_erofs_collector *clt) in z_erofs_collector_end() argument
527 struct z_erofs_collection *cl = clt->cl; in z_erofs_collector_end()
532 z_erofs_pagevec_ctor_exit(&clt->vector, false); in z_erofs_collector_end()
539 if (clt->mode < COLLECT_PRIMARY_FOLLOWED_NOINPLACE) in z_erofs_collector_end()
542 clt->cl = NULL; in z_erofs_collector_end()
576 struct z_erofs_collector *const clt = &fe->clt; in z_erofs_do_read_page() local
597 if (!clt->cl) in z_erofs_do_read_page()
605 if (z_erofs_collector_end(clt)) in z_erofs_do_read_page()
618 err = z_erofs_collector_begin(clt, inode, map); in z_erofs_do_read_page()
628 preload_compressed_pages(clt, MNGD_MAPPING(sbi), in z_erofs_do_read_page()
638 tight &= (clt->mode >= COLLECT_PRIMARY_HOOKED && in z_erofs_do_read_page()
639 clt->mode != COLLECT_PRIMARY_FOLLOWED_NOINPLACE); in z_erofs_do_read_page()
654 tight &= (clt->mode >= COLLECT_PRIMARY_FOLLOWED); in z_erofs_do_read_page()
657 err = z_erofs_attach_page(clt, page, page_type); in z_erofs_do_read_page()
663 err = z_erofs_attach_page(clt, newpage, in z_erofs_do_read_page()
679 clt->cl->nr_pages = max_t(pgoff_t, clt->cl->nr_pages, index + 1); in z_erofs_do_read_page()
1308 struct z_erofs_collector *clt, in z_erofs_submit_and_unzip() argument
1314 if (!z_erofs_vle_submit_all(sb, clt->owned_head, in z_erofs_submit_and_unzip()
1345 (void)z_erofs_collector_end(&f.clt); in z_erofs_vle_normalaccess_readpage()
1348 z_erofs_submit_and_unzip(inode->i_sb, &f.clt, &pagepool, true); in z_erofs_vle_normalaccess_readpage()
1423 (void)z_erofs_collector_end(&f.clt); in z_erofs_vle_normalaccess_readpages()
1425 z_erofs_submit_and_unzip(inode->i_sb, &f.clt, &pagepool, sync); in z_erofs_vle_normalaccess_readpages()