All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Iliopoulos <ailiop@suse.com>
To: fstests@vger.kernel.org
Subject: [PATCH] common: switch _get_available_space accounting to units of 512 bytes
Date: Tue, 28 Mar 2023 17:01:04 +0200	[thread overview]
Message-ID: <20230328150104.129486-1-ailiop@suse.com> (raw)

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@suse.com>
---
 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))
 }
 
 # get the total space in bytes
-- 
2.35.3


             reply	other threads:[~2023-03-28 15:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28 15:01 Anthony Iliopoulos [this message]
2023-03-28 16:02 ` [PATCH] common: switch _get_available_space accounting to units of 512 bytes Darrick J. Wong
2023-03-28 18:03   ` Zorro Lang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230328150104.129486-1-ailiop@suse.com \
    --to=ailiop@suse.com \
    --cc=fstests@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.