diff mbox series

[9/9] common/populate: make sure _scratch_xfs_populate puts its files on the data device

Message ID 160382534741.1202316.10109027018039105023.stgit@magnolia (mailing list archive)
State Superseded
Headers show
Series xfstests: random fixes | expand

Commit Message

Darrick J. Wong Oct. 27, 2020, 7:02 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Make sure that _scratch_xfs_populate always installs its files on the
data device even if the test config selects rt by default.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/populate |    5 +++++
 1 file changed, 5 insertions(+)

Comments

Christoph Hellwig Oct. 28, 2020, 7:44 a.m. UTC | #1
On Tue, Oct 27, 2020 at 12:02:27PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Make sure that _scratch_xfs_populate always installs its files on the
> data device even if the test config selects rt by default.

Can you explain why this is important (preferably also in a comment in
the source)?
Darrick J. Wong Oct. 28, 2020, 4:27 p.m. UTC | #2
On Wed, Oct 28, 2020 at 07:44:46AM +0000, Christoph Hellwig wrote:
> On Tue, Oct 27, 2020 at 12:02:27PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > Make sure that _scratch_xfs_populate always installs its files on the
> > data device even if the test config selects rt by default.
> 
> Can you explain why this is important (preferably also in a comment in
> the source)?

Ok.  I'll change it to this:

	# We cannot directly force the filesystem to create the metadata
	# structures we want; we can only achieve this indirectly by carefully
	# crafting files and a directory tree.  Therefore, we must have exact
	# control over the layout and device selection of all files created.
	# Clear the rtinherit flag on the root directory so that files are
	# always created on the data volume regardless of MKFS_OPTIONS.
	# We can set the realtime flag when needed.
	$XFS_IO_PROG -c 'chattr -t' $SCRATCH_MNT

--D
diff mbox series

Patch

diff --git a/common/populate b/common/populate
index 0b036051..75e6f499 100644
--- a/common/populate
+++ b/common/populate
@@ -154,6 +154,10 @@  _scratch_xfs_populate() {
 
 	_populate_xfs_qmount_option
 	_scratch_mount
+
+	# Make sure the new files always end up on the data device
+	$XFS_IO_PROG -c 'chattr -t' $SCRATCH_MNT
+
 	blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
 	dblksz="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
 	crc="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep crc= | sed -e 's/^.*crc=//g' -e 's/\([0-9]*\).*$/\1/g')"
@@ -306,6 +310,7 @@  _scratch_xfs_populate() {
 	if [ $is_rmapbt -gt 0 ] && [ $is_rt -gt 0 ]; then
 		echo "+ rtrmapbt btree"
 		nr="$((blksz * 2 / 32))"
+		$XFS_IO_PROG -R -f -c 'truncate 0' "${SCRATCH_MNT}/RTRMAPBT"
 		__populate_create_file $((blksz * nr)) "${SCRATCH_MNT}/RTRMAPBT"
 	fi