2015-06-05 16:26:32 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# test zero-log
|
|
|
|
|
2018-02-08 06:34:19 +00:00
|
|
|
source "$TEST_TOP/common"
|
2015-06-05 16:26:32 +00:00
|
|
|
|
|
|
|
check_prereq mkfs.btrfs
|
|
|
|
check_prereq btrfs
|
2015-07-27 12:24:31 +00:00
|
|
|
prepare_test_dev
|
2015-06-05 16:26:32 +00:00
|
|
|
|
|
|
|
get_log_root()
|
|
|
|
{
|
2018-03-23 15:34:30 +00:00
|
|
|
"$TOP/btrfs" inspect-internal dump-super "$1" | \
|
2015-06-05 16:26:32 +00:00
|
|
|
grep '^log_root\>' | awk '{print $2}'
|
|
|
|
}
|
|
|
|
get_log_root_level() {
|
2018-03-23 15:34:30 +00:00
|
|
|
"$TOP/btrfs" inspect-internal dump-super "$1" | \
|
2015-06-05 16:26:32 +00:00
|
|
|
grep '^log_root_level' | awk '{print $2}'
|
|
|
|
}
|
|
|
|
|
|
|
|
test_zero_log()
|
|
|
|
{
|
|
|
|
# FIXME: we need an image with existing log_root
|
2019-06-05 17:09:38 +00:00
|
|
|
run_check_mkfs_test_dev --rootdir "$INTERNAL_BIN/Documentation"
|
2018-03-23 15:34:30 +00:00
|
|
|
run_check "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV"
|
2018-03-27 07:45:44 +00:00
|
|
|
run_check "$TOP/btrfs" rescue zero-log "$TEST_DEV"
|
2018-03-23 15:34:30 +00:00
|
|
|
log_root=$(get_log_root "$TEST_DEV")
|
|
|
|
log_root_level=$(get_log_root "$TEST_DEV")
|
2015-06-05 16:26:32 +00:00
|
|
|
if [ "$log_root" != 0 ]; then
|
|
|
|
_fail "FAIL: log_root not reset"
|
|
|
|
fi
|
|
|
|
if [ "$log_root_level" != 0 ]; then
|
|
|
|
_fail "FAIL: log_root_level not reset"
|
|
|
|
fi
|
2018-03-23 15:34:30 +00:00
|
|
|
run_check "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV"
|
|
|
|
run_check $SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV"
|
2015-06-05 16:26:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
test_zero_log standalone
|
|
|
|
test_zero_log internal
|