| #! /bin/bash |
| # SPDX-License-Identifier: GPL-2.0 |
| # Copyright (c) 2025 VIVO. All Rights Reserved. |
| # |
| # FS QA Test No. f2fs/014 |
| # |
| # This is a regression test case to verify whether the CP_TRIMMED_FLAG is |
| # properly set after performing the following steps: |
| # 1. mount the f2fs filesystem |
| # 2. create a file, write data to it, then delete the file |
| # 3. unmount the filesystem |
| # 4. verify that the 'trimmed' flag is set in the checkpoint state |
| # We should apply the commit ("f2fs: fix missing discard for active |
| # segments") to resolve the issue where the 'trimmed' flag is missing. |
| # |
| . ./common/preamble |
| _begin_fstest auto quick trim |
| |
| _fixed_by_kernel_commit 21263d035ff2 \ |
| "f2fs: fix missing discard for active segments" |
| |
| _require_scratch |
| _require_command "$DUMP_F2FS_PROG" dump.f2fs |
| |
| _scratch_mkfs >> $seqres.full |
| _scratch_mount >> $seqres.full |
| |
| _require_batched_discard $SCRATCH_MNT |
| |
| foo=$SCRATCH_MNT/foo |
| $XFS_IO_PROG -c "pwrite 0 1m" -c "fsync" -f $foo >> $seqres.full |
| sync |
| |
| rm $foo |
| _scratch_unmount >> $seqres.full 2>&1 |
| |
| $DUMP_F2FS_PROG $SCRATCH_DEV | grep "checkpoint state" | grep -o trimmed |
| |
| status=0 |
| exit |