linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>, fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org, david@fromorbit.com
Subject: Re: [PATCH 2/2] fstests: add configuration option for executing post mkfs commands
Date: Thu, 28 Sep 2023 13:34:30 +0800	[thread overview]
Message-ID: <5485cd32-2308-c9c5-4c97-9ff6c74c64dd@oracle.com> (raw)
In-Reply-To: <dfc4cece-d809-4b5b-93f7-7251ba3a492a@gmx.com>



On 28/09/2023 12:26, Qu Wenruo wrote:
> 
> 
> On 2023/9/28 13:53, Anand Jain wrote:
>> This patch introduces new configuration file parameters,
>> POST_SCRATCH_MKFS_CMD and POST_SCRATCH_POOL_MKFS_CMD.
>>
>> Usage example:
>>
>>          POST_SCRATCH_MKFS_CMD="btrfstune -m"
>>          POST_SCRATCH_POOL_MKFS_CMD="btrfstune -m"
> 
> Can't we add extra options for mkfs.btrfs to support metadata uuid at
> mkfs time?
> 
> We already support quota and all other features, I think it would be
> much easier to implement metadata_uuid inside mkfs.
> 
> If this feature is only for metadata_uuid, then I really prefer to do it
> inside mkfs.btrfs.

Thanks for the comments.

The use of btrfstune -m is just an example; any other command,
function, or script can be assigned to the variable POST_SCRATCH_xx.

Now, regarding updating mkfs.btrfs with the btrfstune -m feature,
why not? It simplifies testing. However, can we identify a use case
other than testing?

Thanks, Anand

> 
> Thanks,
> Qu
>>
>> With this configuration option, test cases using _scratch_mkfs(),
>> scratch_pool_mkfs(), or _scratch_mkfs_sized() will run the above
>> set value after the mkfs operation.
>>
>> Other mkfs functions, such as _mkfs_dev(), are not connected to the
>> POST_SCRATCH_MKFS_CMD.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> ---
>>   common/btrfs | 35 +++++++++++++++++++++++++++++++++++
>>   1 file changed, 35 insertions(+)
>>
>> diff --git a/common/btrfs b/common/btrfs
>> index 798c899f6233..b0972e882c7c 100644
>> --- a/common/btrfs
>> +++ b/common/btrfs
>> @@ -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
>> +
>> +    return 0
>> +}
>> +
>> +post_scratch_pool_mkfs_cmd()
>> +{
>> +    if [[ -v POST_SCRATCH_POOL_MKFS_CMD ]]; then
>> +        echo "$POST_SCRATCH_POOL_MKFS_CMD $SCRATCH_DEV_POOL"
>> +        $POST_SCRATCH_POOL_MKFS_CMD $SCRATCH_DEV_POOL
>> +        return $?
>> +    fi
>> +
>> +    return 0
>> +}
>> +
>>   _scratch_mkfs_retry_btrfs()
>>   {
>>       # _scratch_do_mkfs() may retry mkfs without $MKFS_OPTIONS
>>       _scratch_do_mkfs "$MKFS_BTRFS_PROG" "cat" $*
>>
>> +    if [[ $? == 0 ]]; then
>> +        post_scratch_mkfs_cmd
>> +    fi
>> +
>>       return $?
>>   }
>>
>>   _scratch_mkfs_btrfs()
>>   {
>>       $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $SCRATCH_DEV
>> +
>> +    if [[ $? == 0 ]]; then
>> +        post_scratch_mkfs_cmd
>> +    fi
>> +
>>       return $?
>>   }
>>
>> @@ -708,5 +739,9 @@ _scratch_pool_mkfs_btrfs()
>>   {
>>       $MKFS_BTRFS_PROG $MKFS_OPTIONS $* $SCRATCH_DEV_POOL
>>
>> +    if [[ $? == 0 ]]; then
>> +        post_scratch_pool_mkfs_cmd
>> +    fi
>> +
>>       return $?
>>   }

  reply	other threads:[~2023-09-28  5:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28  4:23 [PATCH 0/2] fstests: add config option to run after mkfs Anand Jain
2023-09-28  4:23 ` [PATCH 1/2] fstests: btrfs streamlining mkfs command for post-mkfs operations Anand Jain
2023-09-28  4:23 ` [PATCH 2/2] fstests: add configuration option for executing post mkfs commands Anand Jain
2023-09-28  4:26   ` Qu Wenruo
2023-09-28  5:34     ` Anand Jain [this message]
2023-09-28  7:40       ` Qu Wenruo
2023-10-06  5:17         ` Dave Chinner
2023-10-09 12:18           ` Anand Jain
2023-10-06  6:09         ` Darrick J. Wong
2023-10-06  6:46           ` Qu Wenruo
2023-10-06 22:12             ` Dave Chinner
2023-10-07  2:45               ` Qu Wenruo
2023-10-09 12:23           ` Anand Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5485cd32-2308-c9c5-4c97-9ff6c74c64dd@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).