]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libblkid: prune unneeded buffers
authorThomas Weißschuh <thomas@t-8ch.de>
Sun, 10 Sep 2023 20:46:00 +0000 (22:46 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Tue, 12 Sep 2023 11:15:08 +0000 (13:15 +0200)
commit77b85278ff625779d86b924903453d9c54280642
tree31c5d64c0a9cf8e1a6853404fe1ed0de961fb80d
parent2dc39ee6b7fdd3a2a91cb4d1a7c48a08cf003ffa
libblkid: prune unneeded buffers

When a new buffer is cached that is a superset of another existing
buffer the old buffer can be removed as future requests can be satisfied
by the new one.

As probe functions can have local references to buffered data, delay the
cleanup until the probefunc is finished to avoid accessing freed data.

For the bcachefs.img testfile this reduces the final (maximal) cache
from 34338 bytes in 54 buffers
  to 24760 bytes in 40 buffers.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
libblkid/src/blkidP.h
libblkid/src/partitions/partitions.c
libblkid/src/probe.c
libblkid/src/superblocks/superblocks.c
libblkid/src/topology/topology.c