All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <guan@eryu.me>
To: Gao Xiang <hsiangkao@redhat.com>
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org,
	"Darrick J. Wong" <djwong@kernel.org>,
	Zorro Lang <zlang@redhat.com>
Subject: Re: [RFC PATCH v3 1/3] common/xfs: add a _require_xfs_shrink helper
Date: Mon, 29 Mar 2021 00:18:25 +0800	[thread overview]
Message-ID: <YGCsUXMF+uupaHNV@desktop> (raw)
In-Reply-To: <20210315111926.837170-2-hsiangkao@redhat.com>

On Mon, Mar 15, 2021 at 07:19:24PM +0800, Gao Xiang wrote:
> In order to detect whether the current kernel supports XFS shrinking.
> 
> Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
> ---
>  common/xfs | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/common/xfs b/common/xfs
> index 2156749d..ea3b6cab 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -432,6 +432,17 @@ _supports_xfs_scrub()
>  	return 0
>  }
>  
> +_require_xfs_shrink()
> +{
> +	_require_scratch

_require_command "$XFS_GROWFS_PROG" xfs_growfs

> +
> +	_scratch_mkfs_xfs > /dev/null
> +	_scratch_mount
> +	$XFS_GROWFS_PROG -D1 "$SCRATCH_MNT" 2>&1 | grep -q 'Invalid argument' || \
> +		_notrun "kernel does not support shrinking"

Better to describe the behavior here to explain why EINVAL means kernel
supports shrink.

Thanks,
Eryu

> +	_scratch_unmount
> +}
> +
>  # run xfs_check and friends on a FS.
>  _check_xfs_filesystem()
>  {
> -- 
> 2.27.0

  reply	other threads:[~2021-03-28 16:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15 11:19 [RFC PATCH v3 0/3] xfs: testcases for shrinking free space in the last AG Gao Xiang
2021-03-15 11:19 ` [RFC PATCH v3 1/3] common/xfs: add a _require_xfs_shrink helper Gao Xiang
2021-03-28 16:18   ` Eryu Guan [this message]
2021-03-28 19:51     ` Gao Xiang
2021-03-15 11:19 ` [RFC PATCH v3 2/3] xfs: basic functionality test for shrinking free space in the last AG Gao Xiang
2021-03-28 16:32   ` Eryu Guan
2021-03-28 20:06     ` Gao Xiang
2021-03-29  2:14       ` Eryu Guan
2021-03-29  2:43         ` Gao Xiang
2021-03-15 11:19 ` [RFC PATCH v3 3/3] xfs: stress " Gao Xiang
2021-03-28 16:46   ` Eryu Guan
2021-03-28 20:09     ` Gao Xiang

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=YGCsUXMF+uupaHNV@desktop \
    --to=guan@eryu.me \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=hsiangkao@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=zlang@redhat.com \
    /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.