]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/basic/fs-util.c
fs-util: add new unlinkat_deallocate() helper
authorLennart Poettering <lennart@poettering.net>
Fri, 9 Feb 2018 08:50:31 +0000 (09:50 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 12 Feb 2018 10:27:11 +0000 (11:27 +0100)
commit43767d9d5e0ce8923828aebf9154da7af83916f7
treeb1e17eefa35880935ded7306da18224b1287c23c
parent7b938dfb8de31d45a748a5af5822c41b2e31e63f
fs-util: add new unlinkat_deallocate() helper

This new helper not only removes a file from a directory but also
ensures its space on disk is deallocated, by either punching a hole over
the full file or truncating the file afterwards if the file's link
counter is 0. This is useful in "vacuuming" algorithms to ensure that
client's can't keep the disk space the vacuuming is supposed to recover
pinned simply by keeping an fd open to it.
src/basic/fs-util.c
src/basic/fs-util.h
src/basic/missing.h
src/test/test-fs-util.c