On 2020-10-06 5:50 p.m., Chaitanya Kulkarni wrote: > On 9/30/20 11:54, Logan Gunthorpe wrote: >> Make a common helper from the code in tests nvme/012 and nvme/013 >> to run an fio verify on a XFS file system backed by the >> specified block device. >> >> While we are at it, all the output is redirected to $FULL instead of >> /dev/null. >> >> Signed-off-by: Logan Gunthorpe <logang@xxxxxxxxxxxx> >> --- >> common/xfs | 22 ++++++++++++++++++++++ >> tests/nvme/012 | 14 +------------- >> tests/nvme/013 | 14 +------------- >> 3 files changed, 24 insertions(+), 26 deletions(-) > > The common namespace is getting cluttered. Can you please create > > a subdirectory common/fs/xfs ? I disagree. The common directory only has 9 files. And given there appear to be no other files to add to the fs directory I don't think now is the time to create a directory. We can do so if and when a number of other fs helpers show up and there's a reason to group them together. >> >> diff --git a/common/xfs b/common/xfs >> index d1a603b8c7b5..210c924cdd41 100644 >> --- a/common/xfs >> +++ b/common/xfs >> @@ -9,3 +9,25 @@ >> _have_xfs() { >> _have_fs xfs && _have_program mkfs.xfs >> } >> + >> +_xfs_mkfs_and_mount() { >> + local bdev=$1 >> + local mount_dir=$2 >> + >> + mkdir -p "${mount_dir}" >> + umount "${mount_dir}" >> + mkfs.xfs -l size=32m -f "${bdev}" >> + mount "${bdev}" "${mount_dir}" >> +} >> + >> +_xfs_run_fio_verify_io() { >> + local mount_dir="/mnt/blktests" > > The mount dir should be a parameter and not the hardcode value > to make it reusable. I also disagree here. It is already reusable and is used in a number of places; none of those places require changing the mount directory. If and when a use comes up that requires a different directory (not sure what that would be), a parameter can be added. It is typically standard practice in the Linux community to not add features that have no users as it's confusing to people reading the code. Logan