Message ID | 20210315111926.837170-2-hsiangkao@redhat.com (mailing list archive) |
---|---|
State | Deferred, archived |
Headers | show |
Series | xfs: testcases for shrinking free space in the last AG | expand |
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
On Mon, Mar 29, 2021 at 12:18:25AM +0800, Eryu Guan wrote: > 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 will update. > > > + > > + _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. hmmm.. I also don't think this check is correct now. Maybe try to shrink one fs-block would be better. Will update later. Thanks, Gao Xiang > > Thanks, > Eryu > > > + _scratch_unmount > > +} > > + > > # run xfs_check and friends on a FS. > > _check_xfs_filesystem() > > { > > -- > > 2.27.0 >
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 + + _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" + _scratch_unmount +} + # run xfs_check and friends on a FS. _check_xfs_filesystem() {
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(+)