Re: [PATCH] xfs: test that zone_gc_low_space writes start gc for rw fses

Hans Holmberg <[email protected]>
Newsgroups org.kernel.vger.fstests,org.kernel.vger.linux-xfs
Message-ID <[email protected]>
On 26/03/2026 07:11, Christoph Hellwig wrote:
> On Wed, Mar 25, 2026 at 01:50:13PM +0100, Hans Holmberg wrote:
>> Test that writes to the systfs attribute zone_gc_low_space triggers
> 
> s/systfs/sysfs/
> 
>> +get_scratch_mountstat() {
>> +	awk -v mount="$SCRATCH_MNT" -v stat="$1" \
>> +		'$0~"mounted on "mount" with fstype xfs"{f=1} f&&index($0,stat){print $NF;exit}' \
>> +		/proc/self/mountstats
>> +}
>> +
>> +get_user_available_rt_blocks() {
>> +	get_scratch_mountstat "user available RT blocks:"
>> +}
>> +
>> +gc_required() {
>> +	get_scratch_mountstat "RT GC required:"
>> +}
> 
> Should these go to common/xfs ?

That would be useful I think.
And make them not specific to scratch?

_xfs_get_mountstats <MOUNTPOINT>
_xfs_get_rt_gc_required <MOUNTPOINT>
_xfs_get_user_available_rt_blocks <MOUNTPOINT>

> 
>> +
>> +# figure out if the rt section is internal or not
>> +if [ -z "$SCRATCH_RTDEV" ]; then
>> +	zdev=$SCRATCH_DEV
>> +else
>> +	zdev=$SCRATCH_RTDEV
>> +fi
> 
> Same for this asa new helper?

Yes, something like:

_xfs_get_scratch_rtdev

> 
>> +[ "$rt_available_post" -gt "$rt_available_pre" ] && _fail "gc should not run while read only"
> 
> Split up either using \ or a real if statement to avoid the overly long
> line.
> 
>> +[ "$rt_available_pre" -ge "$rt_available_post" ] && _fail "gc did not free up space"
> 
> Same here.
> 
> Otherwise this looks good.
> 
>
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.