tarfs: Use a separate debug bit for bounce buffer usage.

Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D38588
This commit is contained in:
Dag-Erling Smørgrav 2023-02-16 00:40:18 +00:00
parent 2894c8c96b
commit bf84156b24
3 changed files with 6 additions and 4 deletions

View file

@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd February 2, 2023
.Dd February 14, 2023
.Dt TARFS 5
.Os
.Sh NAME
@ -81,6 +81,7 @@ by adding together the relevant values from the table below.
.It 0x40 Ta Decompression
.It 0x80 Ta Decompression index
.It 0x100 Ta Sparse file mapping
.It 0x200 Ta Bounce buffer usage
.El
.Sh SEE ALSO
.Xr tar 1 ,

View file

@ -45,6 +45,7 @@ extern int tarfs_debug;
#define TARFS_DEBUG_ZIO 0x40
#define TARFS_DEBUG_ZIDX 0x80
#define TARFS_DEBUG_MAP 0x100
#define TARFS_DEBUG_BOUNCE 0x200
#define TARFS_DPF(category, fmt, ...) \
do { \

View file

@ -391,7 +391,7 @@ tarfs_zread_zstd(struct tarfs_zio *zio, struct uio *uiop)
if (uiop->uio_segflg == UIO_SYSSPACE) {
zob.dst = uiop->uio_iov->iov_base;
} else {
TARFS_DPF(ALLOC, "%s: allocating %zu-byte bounce buffer\n",
TARFS_DPF(BOUNCE, "%s: allocating %zu-byte bounce buffer\n",
__func__, len);
zob.dst = obuf = malloc(len, M_TEMP, M_WAITOK);
}
@ -488,7 +488,7 @@ tarfs_zread_zstd(struct tarfs_zio *zio, struct uio *uiop)
if (uiop->uio_segflg == UIO_SYSSPACE) {
uiop->uio_resid = resid;
} else if (len > resid) {
TARFS_DPF(ALLOC, "%s: bounced %zu bytes\n", __func__,
TARFS_DPF(BOUNCE, "%s: bounced %zu bytes\n", __func__,
len - resid);
error = uiomove(obuf, len - resid, uiop);
#ifdef TARFS_DEBUG
@ -497,7 +497,7 @@ tarfs_zread_zstd(struct tarfs_zio *zio, struct uio *uiop)
}
}
if (obuf != NULL) {
TARFS_DPF(ALLOC, "%s: freeing bounce buffer\n", __func__);
TARFS_DPF(BOUNCE, "%s: freeing bounce buffer\n", __func__);
free(obuf, M_TEMP);
}
if (rl != NULL)