All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zorro Lang <zlang@kernel.org>
To: Lukas Herbolt <lukas@herbolt.com>
Cc: djwong@kernel.org, fstests@vger.kernel.org, xfs-linux@vger.kernel.org
Subject: Re: [PATCH v2 1/4] common/rc: Add helper to calculate percentage of free space available
Date: Fri, 15 May 2026 23:59:34 +0800	[thread overview]
Message-ID: <agdCc4iaVWsWUY8e@zlang-mailbox> (raw)
In-Reply-To: <20260514113910.866888-4-lukas@herbolt.com>

On Thu, May 14, 2026 at 01:39:09PM +0200, Lukas Herbolt wrote:
> It calculates percentage of filesystem available space and returns it
> in MB. This helper will be used in the following test/generic fixes.
> 
> Signed-off-by: Lukas Herbolt <lukas@herbolt.com>
> ---
>  changes v2:
> 	spelling and description
>  common/rc | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/common/rc b/common/rc
> index 5fe44e2158ff..9fc733ebdcf4 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -6189,6 +6189,16 @@ _require_fanotify_ioerrors()
>  	_notrun "$FSTYP does not support fanotify ioerrors"
>  }
>  
> +# Computes a percentage of the available space in a filesystem and
> +# returns that quantity in MB. The percentage must not contain a percent
> +# sign ("%").
> +# usage example:
> +# _mb_pct_of_available_space <mount point> <percent>
> +#
> +_mb_pct_of_available_space()
> +{
> +        _df_device $1 | $AWK_PROG -v pct=$2 '{printf "%.f", (($5*(pct/100))/1024)}'

Good to me,

Reviewed-by: Zorro Lang <zlang@kernel.org>

> +}
>  ################################################################################
>  # make sure this script returns success
>  /bin/true
> -- 
> 2.54.0
> 

  parent reply	other threads:[~2026-05-15 15:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14 11:39 [PATCH v2 0/4] Fixes for mkfs.xfs with high amount of CPUs and SSDs Lukas Herbolt
2026-05-14 11:39 ` [PATCH v2 1/4] common/rc: Add helper to calculate percentage of free space available Lukas Herbolt
2026-05-14 14:45   ` Darrick J. Wong
2026-05-15 15:59   ` Zorro Lang [this message]
2026-05-14 11:39 ` [PATCH v2 2/4] common/xfs: helper function to check if -l/-d/-r concurrecy flags Lukas Herbolt
2026-05-14 14:46   ` Darrick J. Wong
2026-05-15 16:03   ` Zorro Lang
2026-05-14 11:39 ` [PATCH v2 3/4] generic/{102,172,347}: Adapt test for XFS on systems with 128+CPUs + SSDs Lukas Herbolt
2026-05-14 14:46   ` Darrick J. Wong
2026-05-15 16:09   ` Zorro Lang
2026-05-14 11:39 ` [PATCH v2 4/4] xfs/21{6,7} Use default -l concurrency=0 on mkfs.xfs that supports it Lukas Herbolt
2026-05-14 14:47   ` Darrick J. Wong
2026-05-15 16:18   ` 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=agdCc4iaVWsWUY8e@zlang-mailbox \
    --to=zlang@kernel.org \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=lukas@herbolt.com \
    --cc=xfs-linux@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.