Re: [PATCH] common: switch _get_available_space accounting to units of 512 bytes

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



On Tue, Mar 28, 2023 at 05:01:04PM +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 df reporting block size from units of 1024b blocks to 512b
> blocks to accommodate accounting for smaller granularity fs block sizes.
> 
> Signed-off-by: Anthony Iliopoulos <ailiop@xxxxxxxx>
> ---
>  common/rc | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index 90749343f3c4..a32bbe3c0b5f 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -4209,8 +4209,8 @@ _get_available_space()
>  		exit 1
>  	fi
>  	local avail_kb;
> -	avail_kb=`$DF_PROG $1 | tail -n1 | awk '{ print $5 }'`
> -	echo $((avail_kb * 1024))
> +	avail_kb=`$DF_PROG --block-size=512 $1 | tail -n1 | awk '{ print $5 }'`
> +	echo $((avail_kb * 512))

Why not have df report the free space in bytes?

$DF_PROG -B 1 $1 | tail -n 1 | awk '{print $5}'

--D

>  }
>  
>  # get the total space in bytes
> -- 
> 2.35.3
> 



[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux