On Thu, Jun 03, 2021 at 05:30:18AM +0000, xuyang2018.jy@xxxxxxxxxxx wrote: > on 2021/5/17 22:48, Leah Rumancik wrote: > > From: Leah Rumancik<lrumancik@xxxxxxxxxx> > > > > 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@xxxxxxxxx> > > > > Changes in v2: > > - fix formatting > > - use _get_block_size instead of manually finding blocksize > > - change scratch_dir to testdir to avoid confusion > > --- > > tests/ext4/309 | 191 +++++++++++++++++++++++++++++++++++++++++++++ > > tests/ext4/309.out | 5 ++ > > tests/ext4/group | 1 + > > 3 files changed, 197 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..a4f74e7f > > --- /dev/null > > +++ b/tests/ext4/309 > > @@ -0,0 +1,191 @@ > > +#!/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_command "$DEBUGFS_PROG" debugfs > > + > > +testdir="${SCRATCH_MNT}/testdir" > > + > > +# get block number filename's dir ent > > +# argument 1: filename > > +get_block() { > > + echo $($DEBUGFS_PROG $SCRATCH_DEV -R "dirsearch /testdir $1" 2>> $seqres.full | grep -o -m 1 "phys [0-9]\+" | cut -c 6-) > > +} > > + > > +# get offset of filename's dirent within the block > > +# argument 1: filename > > +get_offset() { > > + echo $($DEBUGFS_PROG $SCRATCH_DEV -R "dirsearch /testdir $1" 2>> $seqres.full | grep -o -m 1 "offset [0-9]\+" | cut -c 8-) > > +} > > + > > +# get record length of dir ent at specified block and offset > > +# argument 1: block > > +# argument 2: offset > > +get_reclen() { > > + echo $(od $SCRATCH_DEV --skip-bytes=$(($1 * $blocksize + $2 + 4)) --read-bytes=2 -d -An --endian=little | tr -d ' \t\n\r') > When I test this case on centos7, it will report non-supported --endian > option for od command because old od doesn't support this option before > the following patch. > https://github.com/coreutils/coreutils/commit/b370924c03adaef222859061c61be06fc30c9a3e#diff-1cfd938943be810271354b667b12b6ed6ec85481d3fabb6f85d94193bd201235 > > Is this option neccessary? > > Best Regards > Yang Xu. I have added a check to skip the test if the od version is before the endian flag was introduced. Please let me know if you still have issues. -Leah