On Mon, Nov 18, 2019 at 02:26:17PM -0800, Jason Thorpe wrote: > > On Nov 18, 2019, at 1:13 PM, Mouse <mo...@rodents-montreal.org> wrote: > > All you need is a second magic block number. Block number zero is > > already reserved for holes. Making, say, block number 1, or -1, or > > some such, reserved to represent "block-of-zeros semantics for which > > all backing data has been accounted as allocated", so that writing such > > a block is guaranteed to have space available? > > If you’re using a single magic block number for “allocated, > but uninitialized”, how are you supposed to know where to write
You don't have to know where to write. Strictly speaking you only need to know that the space is reserved. We do have enough magic block numbers that could serve as a marker. E.g. anything up to the end of the first super block isn't allocatable. And there are enough spare fields in the fs, cg and csum structs. However, we should look at how FreeBSD has implemented posix_fallocate and see if we can incorporate that code. Or at least come up with a compatable implementation so that there is a possibility of moving disks between these systems. --chris