Re: [PATCH] ext4/309: add test for ext4_dir_entry2 wipe

Leah Rumancik
2021-05-17T13:41:29Z

On Mon, May 17, 2021 at 12:11:08AM +0800, Eryu Guan wrote:
> On Tue, May 04, 2021 at 07:34:25PM +0000, Leah Rumancik wrote:
> > From: Leah Rumancik <lrumancik@google.com>
> >
> > Check wiping of dir entry data upon removing a file, converting to an
> > htree, and splitting htree nodes.
> >
> > Tests commit 6c0912739699d8e4b6a87086401bf3ad3c59502d ("ext4: wipe
> > ext4_dir_entry2 upon file deletion").
> >
> > Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
> > ---
> > tests/ext4/309 | 193 +++++++++++++++++++++++++++++++++++++++++++++
> > tests/ext4/309.out | 5 ++
> > tests/ext4/group | 1 +
> > 3 files changed, 199 insertions(+)
> > create mode 100755 tests/ext4/309
> > create mode 100644 tests/ext4/309.out
> >
> > diff --git a/tests/ext4/309 b/tests/ext4/309
> > new file mode 100755
> > index 00000000..c46db688
> > --- /dev/null
> > +++ b/tests/ext4/309
> > @@ -0,0 +1,193 @@
> > +#!/bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright (c) 2021 Google, Inc. All Rights Reserved.
> > +#
> > +# FS QA Test No. 309
> > +#
> > +# Test wiping of ext4_dir_entry2 data upon file removal, conversion
> > +# to htree, and splitting of htree nodes
> > +#
> > +seq=`basename $0`
> > +seqres=$RESULT_DIR/$seq
> > +echo "QA output created by $seq"
> > +
> > +status=1 # failure is the default!
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# remove previous $seqres.full before test
> > +rm -f $seqres.full
> > +
> > +# real QA test starts here
> > +_supported_fs ext4
> > +
> > +_require_scratch
> > +_require_dumpe2fs "$DUMPE2FS_PROG" dumpe2fs
> > +_require_command "$DEBUGFS_PROG" debugfs
> > +
> > +
> > +SCRATCH_DIR="${SCRATCH_MNT}/scratch_dir"
>
> SCRATCH_DIR could be easily confused with SCRATCH_MNT. 'testdir' with
> lower case variable name should be fine.
>
> > +
> > +# get block number filename's dir ent
> > +# argument 1: filename
> > +get_block() {
> > + echo $($DEBUGFS_PROG $SCRATCH_DEV -R "dirsearch /scratch_dir $1" 2>> $seqres.full | grep -o -m 1 "phys [0-9]\+" | cut -c 6-)
>
> Please use tab for indention.
>
> Thanks,
> Eryu
>
> > +_scratch_mkfs_sized $((128 * 1024 * 1024)) >> $seqres.full 2>&1
> > +blocksize=$($DUMPE2FS_PROG -h $SCRATCH_DEV 2>> $seqres.full | grep "Block size:" | cut -d ":" -f2 | tr -d " \t\n\r")
>
> How about doing "_get_block_size $SCRATCH_MNT" after _scratch_mount ?
>

Sure, this all sounds good. I'll send out an updated version.

Thanks,
Leah