mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
common/punch: Filter fiemap output by FS block size
When testing FS instances of block size other than 4k, the output of fiemap command will not match those in *.out files. This commit adds an optional "block size" argument to _filter_fiemap() which prints fiemap output in units of block size. Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Tested-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
committed by
Eryu Guan
parent
b1180a9f75
commit
4ba5b50735
+14
-5
@@ -165,7 +165,11 @@ _test_punch() {
|
||||
|
||||
_coalesce_extents()
|
||||
{
|
||||
awk -F: '
|
||||
block_size=$1
|
||||
|
||||
[[ -z $block_size ]] && block_size=512
|
||||
|
||||
awk -v block_size="$block_size" -F: '
|
||||
{
|
||||
range = $2;
|
||||
type = $3;
|
||||
@@ -176,19 +180,24 @@ _coalesce_extents()
|
||||
|
||||
if (type != prev_type) {
|
||||
if (prev_type != "")
|
||||
printf("%u]:%s\n", low - 1, prev_type);
|
||||
printf("%u: [%u..", out_count++, low);
|
||||
printf("%u]:%s\n", (low * 512 / block_size) - 1,
|
||||
prev_type);
|
||||
printf("%u: [%u..", out_count++,
|
||||
(low * 512) / block_size);
|
||||
prev_type = type;
|
||||
}
|
||||
}
|
||||
END {
|
||||
if (prev_type != "")
|
||||
printf("%u]:%s\n", high, prev_type);
|
||||
printf("%u]:%s\n", ((high + 1) * 512 / block_size) - 1,
|
||||
prev_type);
|
||||
}'
|
||||
}
|
||||
|
||||
_filter_fiemap()
|
||||
{
|
||||
block_size=$1
|
||||
|
||||
$AWK_PROG '
|
||||
$3 ~ /hole/ {
|
||||
print $1, $2, $3;
|
||||
@@ -201,7 +210,7 @@ _filter_fiemap()
|
||||
$5 ~ /0x[[:xdigit:]]+/ {
|
||||
print $1, $2, "data";
|
||||
}' |
|
||||
_coalesce_extents
|
||||
_coalesce_extents $block_size
|
||||
}
|
||||
|
||||
_filter_fiemap_flags()
|
||||
|
||||
Reference in New Issue
Block a user