diff mbox series

[v4,2/3] common/rc: Add a new _require_scratch_extsize helper function

Message ID 3e0f7be0799a990e2f6856f884e527a92585bf56.1732599868.git.nirjhar@linux.ibm.com (mailing list archive)
State Deferred, archived
Headers show
Series Addition of new tests for extsize hints | expand

Commit Message

Nirjhar Roy Nov. 26, 2024, 5:54 a.m. UTC
_require_scratch_extsize helper function will be used in the
the next patch to make the test run only on filesystems with
extsize support.

Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Signed-off-by: Nirjhar Roy <nirjhar@linux.ibm.com>
---
 common/rc | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Christoph Hellwig Nov. 26, 2024, 6:27 a.m. UTC | #1
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Darrick J. Wong Nov. 27, 2024, 12:54 a.m. UTC | #2
On Tue, Nov 26, 2024 at 11:24:07AM +0530, Nirjhar Roy wrote:
> _require_scratch_extsize helper function will be used in the
> the next patch to make the test run only on filesystems with
> extsize support.
> 
> Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
> Signed-off-by: Nirjhar Roy <nirjhar@linux.ibm.com>

Looks good to me now,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  common/rc | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/common/rc b/common/rc
> index f94bee5e..e6c6047d 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -48,6 +48,23 @@ _test_fsxattr_xflag()
>  	grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat -v" "$1")
>  }
>  
> +# This test requires extsize support on the  filesystem
> +_require_scratch_extsize()
> +{
> +	_require_scratch
> +	_require_xfs_io_command "extsize"
> +	_scratch_mkfs > /dev/null
> +	_scratch_mount
> +	local filename=$SCRATCH_MNT/$RANDOM
> +	local blksz=$(_get_block_size $SCRATCH_MNT)
> +	local extsz=$(( blksz*2 ))
> +	local res=$($XFS_IO_PROG -c "open -f $filename" -c "extsize $extsz" \
> +		-c "extsize")
> +	_scratch_unmount
> +	grep -q "\[$extsz\] $filename" <(echo $res) || \
> +		_notrun "this test requires extsize support on the filesystem"
> +}
> +
>  # Write a byte into a range of a file
>  _pwrite_byte() {
>  	local pattern="$1"
> -- 
> 2.43.5
> 
>
Nirjhar Roy Nov. 27, 2024, 4:10 a.m. UTC | #3
On 11/26/24 11:57, Christoph Hellwig wrote:
> Looks good:
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
Thank you.
Nirjhar Roy Nov. 27, 2024, 4:10 a.m. UTC | #4
On 11/27/24 06:24, Darrick J. Wong wrote:
> On Tue, Nov 26, 2024 at 11:24:07AM +0530, Nirjhar Roy wrote:
>> _require_scratch_extsize helper function will be used in the
>> the next patch to make the test run only on filesystems with
>> extsize support.
>>
>> Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
>> Signed-off-by: Nirjhar Roy <nirjhar@linux.ibm.com>
> Looks good to me now,
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
>
> --D

Thank you.

--NR

>
>> ---
>>   common/rc | 17 +++++++++++++++++
>>   1 file changed, 17 insertions(+)
>>
>> diff --git a/common/rc b/common/rc
>> index f94bee5e..e6c6047d 100644
>> --- a/common/rc
>> +++ b/common/rc
>> @@ -48,6 +48,23 @@ _test_fsxattr_xflag()
>>   	grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat -v" "$1")
>>   }
>>   
>> +# This test requires extsize support on the  filesystem
>> +_require_scratch_extsize()
>> +{
>> +	_require_scratch
>> +	_require_xfs_io_command "extsize"
>> +	_scratch_mkfs > /dev/null
>> +	_scratch_mount
>> +	local filename=$SCRATCH_MNT/$RANDOM
>> +	local blksz=$(_get_block_size $SCRATCH_MNT)
>> +	local extsz=$(( blksz*2 ))
>> +	local res=$($XFS_IO_PROG -c "open -f $filename" -c "extsize $extsz" \
>> +		-c "extsize")
>> +	_scratch_unmount
>> +	grep -q "\[$extsz\] $filename" <(echo $res) || \
>> +		_notrun "this test requires extsize support on the filesystem"
>> +}
>> +
>>   # Write a byte into a range of a file
>>   _pwrite_byte() {
>>   	local pattern="$1"
>> -- 
>> 2.43.5
>>
>>
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index f94bee5e..e6c6047d 100644
--- a/common/rc
+++ b/common/rc
@@ -48,6 +48,23 @@  _test_fsxattr_xflag()
 	grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat -v" "$1")
 }
 
+# This test requires extsize support on the  filesystem
+_require_scratch_extsize()
+{
+	_require_scratch
+	_require_xfs_io_command "extsize"
+	_scratch_mkfs > /dev/null
+	_scratch_mount
+	local filename=$SCRATCH_MNT/$RANDOM
+	local blksz=$(_get_block_size $SCRATCH_MNT)
+	local extsz=$(( blksz*2 ))
+	local res=$($XFS_IO_PROG -c "open -f $filename" -c "extsize $extsz" \
+		-c "extsize")
+	_scratch_unmount
+	grep -q "\[$extsz\] $filename" <(echo $res) || \
+		_notrun "this test requires extsize support on the filesystem"
+}
+
 # Write a byte into a range of a file
 _pwrite_byte() {
 	local pattern="$1"