chiark / gitweb /
fs-util: add new unlinkat_deallocate() helper
authorLennart Poettering <lennart@poettering.net>
Fri, 9 Feb 2018 08:50:31 +0000 (09:50 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 30 May 2018 05:58:53 +0000 (07:58 +0200)
commite62e5035921a829c2691795ec79953229200c530
treee8496ac377fed47aafe2ed05712f6a43338b7807
parent0e687e19d3fb5df5cafd35a3a268ea1c578ed970
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