On Wed, Mar 29, 2023 at 05:52:36PM +0200, Anthony Iliopoulos wrote: > xfs/220 relies on detecting free space changes after truncation of > single filesystem blocks, and this fails when the fs block size is 512b. > > By default df is counting 1024b block units and as such is not reporting > any change in the number of available blocks after freeing just a 512b > block. > > Switch the _get_available_space df reporting block size from units of > 1024b blocks directly to single bytes in order to make free space > accounting fine-grained and independent of any fs block size > assumptions. > > Do the same for _get_available_space, since there is no reason for > having an additional conversion step. > > Signed-off-by: Anthony Iliopoulos <ailiop@xxxxxxxx> > --- > common/rc | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > v2: incorporate changes from reviews by djwong and zlang > * change reporting directly to bytes and avoid conversion step > altogether > * do the same for _get_available_space > > diff --git a/common/rc b/common/rc > index 90749343f3c4..9e4475c0f429 100644 > --- a/common/rc > +++ b/common/rc > @@ -4208,9 +4208,7 @@ _get_available_space() > echo "Usage: _get_available_space <mnt>" > exit 1 > fi > - local avail_kb; > - avail_kb=`$DF_PROG $1 | tail -n1 | awk '{ print $5 }'` > - echo $((avail_kb * 1024)) > + $DF_PROG -B 1 $1 | tail -n1 | awk '{ print $5 }' > } > > # get the total space in bytes > @@ -4221,9 +4219,7 @@ _get_total_space() > echo "Usage: _get_total_space <mnt>" > exit 1 > fi > - local total_kb; > - total_kb=`$DF_PROG $1 | tail -n1 | awk '{ print $3 }'` > - echo $(($total_kb * 1024)) > + $DF_PROG -B 1 $1 | tail -n1 | awk '{ print $3 }' Looks good to me, Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx> --D > } > > # return device size in kb > -- > 2.35.3 >