On Thu, May 21, 2020 at 11:56:50PM -0700, Christoph Hellwig wrote: > On Thu, May 21, 2020 at 07:53:09PM -0700, Darrick J. Wong wrote: > > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > > > When we're estimating a new speculative preallocation length for an > > extending write, we should walk backwards through the extent list to > > determine the number of number of blocks that are physically and > > logically contiguous with the write offset, and use that as an input to > > the preallocation size computation. > > > > This way, preallocation length is truly measured by the effectiveness of > > the allocator in giving us contiguous allocations without being > > influenced by the state of a given extent. This fixes both the problem > > where ZERO_RANGE within an EOF can reduce preallocation, and prevents > > the unnecessary shrinkage of preallocation when delalloc extents are > > turned into unwritten extents. > > > > This was found as a regression in xfs/014 after changing delalloc writes > > to create unwritten extents during writeback. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > Looks good, > > Reviewed-by: Christoph Hellwig <hch@xxxxxx> > > A minor nitpick, though: > > > + struct xfs_iext_cursor ncur = *icur; /* struct copy */ > > > > + struct xfs_bmbt_irec prev, got; > > The comment is pretty pointless, as the struct copy is obviously form > the syntax (and we do it for the xfs_iext_cursor structure in quite a > few other places). > > Also please don't add empty lines between the variable declarations. I didn't... not sure where that came from. --D