/* considering the LZMA performance, no need to use a lockless list for now */ static DEFINE_SPINLOCK(z_erofs_lzma_lock); staticunsignedint z_erofs_lzma_max_dictsize; staticunsignedint z_erofs_lzma_nstrms, z_erofs_lzma_avail_strms; staticstruct z_erofs_lzma *z_erofs_lzma_head; static DECLARE_WAIT_QUEUE_HEAD(z_erofs_lzma_wq);
for (last = strm; last->next; last = last->next)
++i;
last->next = head;
head = strm;
}
err = 0; /* 2. walk each isolated stream and grow max dict_size if needed */ for (strm = head; strm; strm = strm->next) { if (strm->state)
xz_dec_microlzma_end(strm->state);
strm->state = xz_dec_microlzma_alloc(XZ_PREALLOC, dict_size); if (!strm->state)
err = -ENOMEM;
}
/* 3. push back all to the global list and update max dict_size */
spin_lock(&z_erofs_lzma_lock);
DBG_BUGON(z_erofs_lzma_head);
z_erofs_lzma_head = head;
spin_unlock(&z_erofs_lzma_lock);
wake_up_all(&z_erofs_lzma_wq);
if (xz_err != XZ_OK) { if (xz_err == XZ_STREAM_END && !rq->outputsize) break;
erofs_err(sb, "failed to decompress %d in[%u] out[%u]",
xz_err, rq->inputsize, rq->outputsize);
err = -EFSCORRUPTED; break;
}
} while (1);
if (dctx.kout)
kunmap_local(dctx.kout);
kunmap_local(dctx.kin); /* 4. push back LZMA stream context to the global list */
spin_lock(&z_erofs_lzma_lock);
strm->next = z_erofs_lzma_head;
z_erofs_lzma_head = strm;
spin_unlock(&z_erofs_lzma_lock);
wake_up(&z_erofs_lzma_wq); return err;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.