[RFC PATCH v3 1/3] common/xfs: add a _require_xfs_shrink helper

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

 



In order to detect whether the current kernel supports XFS shrinking.

Signed-off-by: Gao Xiang <hsiangkao@xxxxxxxxxx>
---
 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
+
+	_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()
 {
-- 
2.27.0




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux