On 18/08/2023 23:13, Darrick J. Wong wrote:
On Thu, Aug 17, 2023 at 11:40:04PM +0800, Anand Jain wrote:
There are two repair functions: _repair_scratch_fs() and
_repair_test_fs(). As the names suggest, these functions are designed to
repair the filesystems SCRATCH_DEV and TEST_DEV, respectively. However,
these functions never called proper comamnd for the filesystem type btrfs.
This patch fixes it. Thx.
Heh. This sounds like a good improvement. :)
:-) (btrfs-progs has eloborate repair test cases.)
Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
---
common/rc | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/common/rc b/common/rc
index 66d270acf069..49effbf760c0 100644
--- a/common/rc
+++ b/common/rc
@@ -1177,6 +1177,15 @@ _repair_scratch_fs()
fi
return $res
;;
+ btrfs)
+ echo "btrfs check --repair --force $SCRATCH_DEV"
+ btrfs check --repair --force $SCRATCH_DEV 2>&1
Should you allow callers of _repair_{test,scratch}_fs to pass in
arguments?
As I searched, no caller is passing any arguments, so we could
enhance it when required, IMO.
The _xfs_repair_test_fs() function is not found. It looks like
it needs a fix.
Thanks, Anand
--D
+ local res=$?
+ if [ $res -ne 0 ]; then
+ _dump_err2 "btrfs repair failed, err=$res"
+ fi
+ return $res
+ ;;
bcachefs)
# With bcachefs, if fsck detects any errors we consider it a bug and we
# want the test to fail:
@@ -1229,6 +1238,11 @@ _repair_test_fs()
res=$?
fi
;;
+ btrfs)
+ echo 'btrfs check --repair --force "$@"' > /tmp.repair 2>&1
+ btrfs check --repair --force "$@" >> /tmp.repair 2>&1
+ res=$?
+ ;;
*)
# Let's hope fsck -y suffices...
fsck -t $FSTYP -y $TEST_DEV >$tmp.repair 2>&1
--
2.39.3