Re: [PATCH 1/2] common/dmlogwrites: add _require_logwrites_size helper

Anand Jain <[email protected]>
Newsgroups org.kernel.vger.fstests,org.kernel.vger.linux-btrfs
Message-ID <[email protected]>
On 14/4/26 18:20, Disha Goel wrote:
> Add a new helper function _require_logwrites_size() to check if the
> LOGWRITES_DEV meets a minimum size requirement.
> 
> This is useful for tests that use dm-log-writes with additional space
> requirements, such as creating LVM snapshots during log replay or tests
> that generate large amounts of logged I/O operations.
> 
> The function takes a size parameter in KB and skips the test if
> LOGWRITES_DEV is smaller than the required size.
> 
> Signed-off-by: Disha Goel <[email protected]>
> ---
>  common/dmlogwrites | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/common/dmlogwrites b/common/dmlogwrites
> index a27e1966..1ce2b2fb 100644
> --- a/common/dmlogwrites
> +++ b/common/dmlogwrites
> @@ -14,6 +14,15 @@ _require_log_writes()
>  	_require_test_program "log-writes/replay-log"
>  }
>  
> +_require_logwrites_size()
> +{
> +        [ $# -eq 1 ] || _fail "_require_logwrites_size: expected size param"
> +
> +        local devsize=$(_get_device_size $LOGWRITES_DEV)
> +        [ $devsize -lt $1 ] && \
> +                _notrun "LOGWRITES_DEV too small, ${devsize}KB < $1KB"
> +}
> +
>  # Starting from v4.15-rc1, DAX support was added to dm-log-writes, but note
>  # that it doesn't track the data that we write via the mmap(), so we can't do
>  # any data integrity checking. We can only verify that the metadata writes for


_require_logwrites_size() should be designed something like this

_require_log_writes_sized()
{
	local size=$1

	_require_log_writes
	check $size || _notrun
}

So, patch 2/2 can simply call `_require_log_writes_sized <>`

Thanks.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.