4 ms·
I only have a very basic understanding of it, but skimming it makes me think that, in addition to leaving non-truncated files full of garbage around, that kind
by donmcronald 4y ago
I only have a very basic understanding of it, but skimming it makes me think that, in addition to leaving non-truncated files full of garbage around, that kind of open, overwrite, close pattern could be problematic on BTRFS. I wonder if that's one of the scenarios where BTRFS can end up with a bunch of extents that are full of mostly un-referenced blocks, but can't reclaim space because some of the blocks in the extent are (or BTRFS thinks they are) still in use.
- yencabulator 4y agoIf you truncate, write new data, and close fd, nothing (in that file) refers to the old extents, and btrfs will garbage collect them just fine. The thing that hurts all copy-on-write systems is something like SQLite/Postgres/etc that mutates the file here and there; explicitly not overwriting it. chattr +C is the standard convention to opt out of copy-on-write, for those.