]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit - libxfs/xfs_bmap.c
xfs: Introduce error injection to allocate only minlen size extents for files
authorChandan Babu R <chandanrlinux@gmail.com>
Mon, 5 Apr 2021 22:36:56 +0000 (18:36 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Mon, 5 Apr 2021 22:36:56 +0000 (18:36 -0400)
commit3006cea4c9418998b2cdea3ac65cd78809aa81ee
tree2e122c416b58bdc683c8fedf388280af18e68c6e
parentfc177ab00ad284b737fabf2539a1895a4eac13ab
xfs: Introduce error injection to allocate only minlen size extents for files

Source kernel commit: 301519674699aa9b80a15b2b2165e08532b176e6

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.

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
io/inject.c
libxfs/xfs_alloc.c
libxfs/xfs_alloc.h
libxfs/xfs_bmap.c
libxfs/xfs_errortag.h