Lines Matching refs:clt
135 struct z_erofs_collector clt;
149 .inode = __i, .clt = COLLECTOR_INIT(), \
155 static void preload_compressed_pages(struct z_erofs_collector *clt,
159 const struct z_erofs_pcluster *pcl = clt->pcl;
161 struct page **pages = clt->compressedpages;
165 if (clt->mode < COLLECT_PRIMARY_FOLLOWED)
184 clt->compressedpages = pages;
197 clt->mode = COLLECT_PRIMARY_FOLLOWED_NOINPLACE;
266 static inline bool z_erofs_try_inplace_io(struct z_erofs_collector *clt,
269 struct z_erofs_pcluster *const pcl = clt->pcl;
272 while (clt->compressedpages < pcl->compressed_pages + clusterpages) {
273 if (!cmpxchg(clt->compressedpages++, NULL, page))
280 static int z_erofs_attach_page(struct z_erofs_collector *clt,
287 if (clt->mode >= COLLECT_PRIMARY &&
289 z_erofs_try_inplace_io(clt, page))
292 ret = z_erofs_pagevec_enqueue(&clt->vector, page, type,
294 clt->cl->vcnt += (unsigned int)ret;
328 static int z_erofs_lookup_collection(struct z_erofs_collector *clt,
332 struct z_erofs_pcluster *pcl = clt->pcl;
337 if (clt->owned_head == &pcl->next || pcl == clt->tailpcl) {
368 if (clt->owned_head == Z_EROFS_PCLUSTER_TAIL)
369 clt->tailpcl = pcl;
370 clt->mode = try_to_claim_pcluster(pcl, &clt->owned_head);
372 if (clt->owned_head == Z_EROFS_PCLUSTER_TAIL)
373 clt->tailpcl = NULL;
374 clt->cl = cl;
378 static int z_erofs_register_collection(struct z_erofs_collector *clt,
408 pcl->next = clt->owned_head;
409 clt->mode = COLLECT_PRIMARY_FOLLOWED;
432 clt->pcl = container_of(grp, struct z_erofs_pcluster, obj);
437 if (clt->owned_head == Z_EROFS_PCLUSTER_TAIL)
438 clt->tailpcl = pcl;
439 clt->owned_head = &pcl->next;
440 clt->pcl = pcl;
441 clt->cl = cl;
450 static int z_erofs_collector_begin(struct z_erofs_collector *clt,
457 DBG_BUGON(clt->cl);
460 DBG_BUGON(clt->owned_head == Z_EROFS_PCLUSTER_NIL);
461 DBG_BUGON(clt->owned_head == Z_EROFS_PCLUSTER_TAIL_CLOSED);
470 clt->pcl = container_of(grp, struct z_erofs_pcluster, obj);
472 ret = z_erofs_register_collection(clt, inode, map);
480 ret = z_erofs_lookup_collection(clt, inode, map);
482 erofs_workgroup_put(&clt->pcl->obj);
487 z_erofs_pagevec_ctor_init(&clt->vector, Z_EROFS_NR_INLINE_PAGEVECS,
488 clt->cl->pagevec, clt->cl->vcnt);
490 clt->compressedpages = clt->pcl->compressed_pages;
491 if (clt->mode <= COLLECT_PRIMARY) /* cannot do in-place I/O */
492 clt->compressedpages += Z_EROFS_CLUSTER_MAX_PAGES;
527 static bool z_erofs_collector_end(struct z_erofs_collector *clt)
529 struct z_erofs_collection *cl = clt->cl;
534 z_erofs_pagevec_ctor_exit(&clt->vector, false);
541 if (clt->mode < COLLECT_PRIMARY_FOLLOWED_NOINPLACE)
544 clt->cl = NULL;
568 struct z_erofs_collector *const clt = &fe->clt;
589 if (!clt->cl)
597 if (z_erofs_collector_end(clt))
610 err = z_erofs_collector_begin(clt, inode, map);
620 preload_compressed_pages(clt, MNGD_MAPPING(sbi), cache_strategy);
629 tight &= (clt->mode >= COLLECT_PRIMARY_HOOKED &&
630 clt->mode != COLLECT_PRIMARY_FOLLOWED_NOINPLACE);
647 tight &= (clt->mode >= COLLECT_PRIMARY_FOLLOWED);
650 err = z_erofs_attach_page(clt, page, page_type,
651 clt->mode >= COLLECT_PRIMARY_FOLLOWED);
658 err = z_erofs_attach_page(clt, newpage,
674 clt->cl->nr_pages = max_t(pgoff_t, clt->cl->nr_pages, index + 1);
1165 z_erofs_next_pcluster_t owned_head = f->clt.owned_head;
1259 if (f->clt.owned_head == Z_EROFS_PCLUSTER_TAIL)
1289 (void)z_erofs_collector_end(&f.clt);
1350 (void)z_erofs_collector_end(&f.clt);