On Tue, Sep 12, 2017 at 07:50:19PM +0200, Goffredo Baroncelli wrote: > On 09/12/2017 07:03 PM, David Sterba wrote: > > Say I want to prepare a minimal image but will provide a large file > ^^^^^^^^^^^^^^^^^^^^^^ > > I think that if the target is a file AND --minimize is passed, it is a > reasonable expectation that the file is created "on the fly" and grown > up to what needed. > > What I mean is that "--minimize" is passed (and a file is passed), mkfs.btrfs should > a) create the file if it doesn't exist, and avoid any check about its length > b) truncate the file at the end I think the farthest-offset write will extend the file size, so we should not truncate it, in the sense 'make it smaller than it is', but rather 'align it to the size where the filesystem expects live data". Eg. if we write a blockgroup header to the beginning of 256MB, but fill only a few kilobytes, effectively writing to some range, say, [0..32MB]. Then reads past the 32MB (eg. through loop device) would fail. As long as the file is zero, minimizing will be implicit. My example with the provided large file was wrong in retrospect. I'll think about that more. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
