diff mbox series

[2/5] common/xfs: Add function to detect support for metadump v2

Message ID 20240102084357.1199843-3-chandanbabu@kernel.org (mailing list archive)
State Superseded, archived
Headers show
Series Add support for testing XFS metadump v2 | expand

Commit Message

Chandan Babu R Jan. 2, 2024, 8:43 a.m. UTC
This commit defines a new function to help detect support for metadump v2.

Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
---
 common/xfs | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Darrick J. Wong Jan. 2, 2024, 6:27 p.m. UTC | #1
On Tue, Jan 02, 2024 at 02:13:49PM +0530, Chandan Babu R wrote:
> This commit defines a new function to help detect support for metadump v2.
> 
> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
> ---
>  common/xfs | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/common/xfs b/common/xfs
> index 38094828..558a6bb5 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -698,6 +698,14 @@ _xfs_mdrestore() {
>  	$XFS_MDRESTORE_PROG $options "${metadump}" "${device}"
>  }
>  
> +_scratch_metadump_v2_supported()
> +{
> +	$XFS_DB_PROG -c "help metadump" $SCRATCH_DEV | \
> +		grep -q "Metadump version to be used"
> +
> +	return $?

You don't need this; bash will retain the status code of the last
process in the pipe as the result value.

(Looks good to me otherwise.)

--D

> +}
> +
>  # Snapshot the metadata on the scratch device
>  _scratch_xfs_metadump()
>  {
> -- 
> 2.43.0
> 
>
Chandan Babu R Jan. 5, 2024, 7:03 a.m. UTC | #2
On Tue, Jan 02, 2024 at 10:27:33 AM -0800, Darrick J. Wong wrote:
> On Tue, Jan 02, 2024 at 02:13:49PM +0530, Chandan Babu R wrote:
>> This commit defines a new function to help detect support for metadump v2.
>> 
>> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
>> ---
>>  common/xfs | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>> 
>> diff --git a/common/xfs b/common/xfs
>> index 38094828..558a6bb5 100644
>> --- a/common/xfs
>> +++ b/common/xfs
>> @@ -698,6 +698,14 @@ _xfs_mdrestore() {
>>  	$XFS_MDRESTORE_PROG $options "${metadump}" "${device}"
>>  }
>>  
>> +_scratch_metadump_v2_supported()
>> +{
>> +	$XFS_DB_PROG -c "help metadump" $SCRATCH_DEV | \
>> +		grep -q "Metadump version to be used"
>> +
>> +	return $?
>
> You don't need this; bash will retain the status code of the last
> process in the pipe as the result value.
>
> (Looks good to me otherwise.)
>

Ok. I will fix it up.

>> +}
>> +
>>  # Snapshot the metadata on the scratch device
>>  _scratch_xfs_metadump()
>>  {
>> -- 
>> 2.43.0
>> 
>>
diff mbox series

Patch

diff --git a/common/xfs b/common/xfs
index 38094828..558a6bb5 100644
--- a/common/xfs
+++ b/common/xfs
@@ -698,6 +698,14 @@  _xfs_mdrestore() {
 	$XFS_MDRESTORE_PROG $options "${metadump}" "${device}"
 }
 
+_scratch_metadump_v2_supported()
+{
+	$XFS_DB_PROG -c "help metadump" $SCRATCH_DEV | \
+		grep -q "Metadump version to be used"
+
+	return $?
+}
+
 # Snapshot the metadata on the scratch device
 _scratch_xfs_metadump()
 {