Lines Matching refs:dctx
374 int z_erofs_stream_switch_bufs(struct z_erofs_stream_dctx *dctx, void **dst, in z_erofs_stream_switch_bufs() argument
377 struct z_erofs_decompress_req *rq = dctx->rq; in z_erofs_stream_switch_bufs()
382 if (!dctx->avail_out) { in z_erofs_stream_switch_bufs()
383 if (++dctx->no >= dctx->outpages || !rq->outputsize) { in z_erofs_stream_switch_bufs()
388 if (dctx->kout) in z_erofs_stream_switch_bufs()
389 kunmap_local(dctx->kout); in z_erofs_stream_switch_bufs()
390 dctx->avail_out = min(rq->outputsize, PAGE_SIZE - rq->pageofs_out); in z_erofs_stream_switch_bufs()
391 rq->outputsize -= dctx->avail_out; in z_erofs_stream_switch_bufs()
392 pgo = &rq->out[dctx->no]; in z_erofs_stream_switch_bufs()
396 dctx->kout = NULL; in z_erofs_stream_switch_bufs()
402 dctx->kout = kmap_local_page(*pgo); in z_erofs_stream_switch_bufs()
403 *dst = dctx->kout + rq->pageofs_out; in z_erofs_stream_switch_bufs()
405 *dst = dctx->kout = NULL; in z_erofs_stream_switch_bufs()
410 if (dctx->inbuf_pos == dctx->inbuf_sz && rq->inputsize) { in z_erofs_stream_switch_bufs()
411 if (++dctx->ni >= dctx->inpages) { in z_erofs_stream_switch_bufs()
415 if (dctx->kout) /* unlike kmap(), take care of the orders */ in z_erofs_stream_switch_bufs()
416 kunmap_local(dctx->kout); in z_erofs_stream_switch_bufs()
417 kunmap_local(dctx->kin); in z_erofs_stream_switch_bufs()
419 dctx->inbuf_sz = min_t(u32, rq->inputsize, PAGE_SIZE); in z_erofs_stream_switch_bufs()
420 rq->inputsize -= dctx->inbuf_sz; in z_erofs_stream_switch_bufs()
421 dctx->kin = kmap_local_page(rq->in[dctx->ni]); in z_erofs_stream_switch_bufs()
422 *src = dctx->kin; in z_erofs_stream_switch_bufs()
423 dctx->bounced = false; in z_erofs_stream_switch_bufs()
424 if (dctx->kout) { in z_erofs_stream_switch_bufs()
425 j = (u8 *)*dst - dctx->kout; in z_erofs_stream_switch_bufs()
426 dctx->kout = kmap_local_page(rq->out[dctx->no]); in z_erofs_stream_switch_bufs()
427 *dst = dctx->kout + j; in z_erofs_stream_switch_bufs()
429 dctx->inbuf_pos = 0; in z_erofs_stream_switch_bufs()
438 if (!dctx->bounced && rq->out[dctx->no] == rq->in[dctx->ni]) { in z_erofs_stream_switch_bufs()
439 memcpy(dctx->bounce, *src, dctx->inbuf_sz); in z_erofs_stream_switch_bufs()
440 *src = dctx->bounce; in z_erofs_stream_switch_bufs()
441 dctx->bounced = true; in z_erofs_stream_switch_bufs()
444 for (j = dctx->ni + 1; j < dctx->inpages; ++j) { in z_erofs_stream_switch_bufs()
445 if (rq->out[dctx->no] != rq->in[j]) in z_erofs_stream_switch_bufs()