@@ -690,17 +690,48 @@ _require_btrfs_scratch_logical_resolve_v2()
_scratch_unmount
}
+post_scratch_mkfs_cmd()
+{
+ if [[ -v POST_SCRATCH_MKFS_CMD ]]; then
+ echo "$POST_SCRATCH_MKFS_CMD $SCRATCH_DEV"
+ $POST_SCRATCH_MKFS_CMD $SCRATCH_DEV
+ return $?
+ fi
Ideally this should be something like:
export SCRATCH_BTRFS_UUID='<uuid spec>'
btrfs_tune_dev() {
local dev="$1"
if [ -n "$SCRATCH_BTRFS_UUID" ]; then
btrfstune -m $SCRATCH_BTRFS_UUID $dev
return $?
fi
return 0;
}
_scratch_pool_mkfs_btrfs()
{
.....
btrfs_tune_dev $SCRATCH_DEV_POOL
.....
}
_scratch_mkfs_btrfs()
{
.....
btrfs_tune_dev $SCRATCH_DEV
.....
}
See how different it becomes when you stop thinking about filesystem
configuration as a generic post-mkfs command and instead think of it
as just another configuration option?
There's a possibility that mkfs.btrfs might include an option similar
to btrfstune -m, but its main purpose would likely be for running
fstests as there isn't any other use-case for it. If this addition
happens, I can withdraw this patch.
However, to clarify your approach mentioned above, if we want to set
SCRATCH_BTRFS_UUID to the UUID of TEST_DEV, then the config file
should contain something like this:
SCRATCH_BTRFS_UUID=$(blkid /dev/sda1 | awk '{print $2}' | cut -d"="
-f2 | sed s/\"//g)
This should go in the config file. Right?
Thanks, Anand