Re: [PATCH v2 1/2] common/dmlogwrites: add _require_log_writes_sized helper
Anand Jain <[email protected]>
| Newsgroups | org.kernel.vger.fstests,org.kernel.vger.linux-btrfs |
|---|---|
| Message-ID | <[email protected]> |
On 5/5/26 07:16, Anand Jain wrote: > > > On 5/5/26 05:53, Anand Jain wrote: >> >> looks good. >> >> Reviewed-by: Anand Jain <[email protected]> >> >> Thanks >> > > sorry, not yet; I'm canceling the RVB. > Details below. > > >> v2: >> - Renamed function from _require_logwrites_size to > _require_log_writes_sized >> - Added documentation comment clarifying the parameter is in KB >> - Made function call _require_log_writes() internally to avoid redundant >> calls in test code > > > This change log should be below the Signed-off-by "---" > > >> Suggested-by: Darrick J. Wong <[email protected]> >> Suggested-by: Anand Jain <[email protected]> >> Signed-off-by: Disha Goel <[email protected]> >> --- > > ... v2 changes here... > > >> common/dmlogwrites | 15 +++++++++++++++ >> 1 file changed, 15 insertions(+) >> >> diff --git a/common/dmlogwrites b/common/dmlogwrites >> index a27e1966..0925b333 100644 >> --- a/common/dmlogwrites >> +++ b/common/dmlogwrites >> @@ -14,6 +14,21 @@ _require_log_writes() >> _require_test_program "log-writes/replay-log" >> } >> >> +# Require a log writes device of a minimum size >> +# $1: minimum size in KB >> +_require_log_writes_sized() >> +{ >> + local size=$1 >> + >> + [ $# -eq 1 ] || _fail "_require_log_writes_sized: expected > size param" >> + >> + _require_log_writes >> + >> + local devsize=$(_get_device_size $LOGWRITES_DEV) > > Please keep all declarations at the beginning of the function. > >> + [ $devsize -lt $1 ] && \ > > use $size instead of $1 and > > $devsize and $size units are different, 512 sectors vs KiB My bad, devsize is also in KiB. So this is fine. > >> + _notrun "LOGWRITES_DEV too small, ${devsize}KB < > ${size}KB" >> +} >> + > > $devsize is not in KB and $size is in KiB This is fine as well. Thanks, Anand