On Friday 16 October 2020 12:11:07 AM IST Darrick J. Wong wrote: > On Thu, Oct 15, 2020 at 03:32:54PM +0530, Chandan Babu R wrote: > > On Thursday 15 October 2020 2:11:10 PM IST Christoph Hellwig wrote: > > > On Mon, Oct 12, 2020 at 02:59:38PM +0530, Chandan Babu R wrote: > > > > This commit adds XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT error tag which > > > > helps userspace test programs to get xfs_bmap_btalloc() to always > > > > allocate minlen sized extents. > > > > > > > > This is required for test programs which need a guarantee that minlen > > > > extents allocated for a file do not get merged with their existing > > > > neighbours in the inode's BMBT. "Inode fork extent overflow check" for > > > > Directories, Xattrs and extension of realtime inodes need this since the > > > > file offset at which the extents are being allocated cannot be > > > > explicitly controlled from userspace. > > > > > > > > One way to use this error tag is to, > > > > 1. Consume all of the free space by sequentially writing to a file. > > > > 2. Punch alternate blocks of the file. This causes CNTBT to contain > > > > sufficient number of one block sized extent records. > > > > 3. Inject XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT error tag. > > > > After step 3, xfs_bmap_btalloc() will issue space allocation > > > > requests for minlen sized extents only. > > > > > > > > ENOSPC error code is returned to userspace when there aren't any "one > > > > block sized" extents left in any of the AGs. > > > > > > Can we figure out a way to only build the extra code for debug kernels? > > Yeah, I was gonna say that too. You're basically installing a new > allocator algorithm, but wow it scatters pieces of itself all over the > place. :/ Right. I have almost completed refactoring the code into relevant functions. I will execute the test suite and if everything goes well I will be posting the next version of the patchset soon. Thanks for the review comments. -- chandan