populate: fix leafn creation test for v4 filesystems
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 5 Nov 2018 17:25:47 +0000 (09:25 -0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 11 Nov 2018 14:05:12 +0000 (22:05 +0800)
The leafn creation test doesn't work on some v4 filesystems
because the field names change.  Rearrange the code somewhat so that it
works properly.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/populate

index 610425f..d49fbc2 100644 (file)
@@ -444,7 +444,9 @@ __populate_check_xfs_dir() {
                (test "${datab}" -eq 1 && test "${leafb}" -eq 1 && test "${freeb}" -eq 0) || _fail "failed to create ${dtype} dir ino ${inode} datab ${datab} leafb ${leafb} freeb ${freeb}"
                ;;
        "leafn")
-               _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${leaf_lblk}" -c "p lhdr.info.hdr.magic" | egrep -q '(0x3dff|0xd2ff)' || _fail "failed to create ${dtype} dir ino ${inode} datab ${datab} leafb ${leafb} freeb ${freeb}"
+               _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${leaf_lblk}" -c "p lhdr.info.hdr.magic" | grep -q '0x3dff' && return
+               _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${leaf_lblk}" -c "p lhdr.info.magic" | grep -q '0xd2ff' && return
+               _fail "failed to create ${dtype} dir ino ${inode} datab ${datab} leafb ${leafb} freeb ${freeb}"
                ;;
        "node"|"btree")
                (test "${datab}" -eq 1 && test "${leafb}" -eq 1 && test "${freeb}" -eq 1) || _fail "failed to create ${dtype} dir ino ${inode} datab ${datab} leafb ${leafb} freeb ${freeb}"