skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS" && return
[ $RC != 0 ] && error "filefrag $fm_file failed"
- filefrag_op=$(filefrag -ve $fm_file | grep -A 100 "ext:" |
- grep -v "ext:" | grep -v "found")
+ filefrag_op=$(filefrag -ve $fm_file |
+ sed -n '/ext:/,/found/{/ext:/d; /found/d; p}')
lun=$($GETSTRIPE -i $fm_file)
start_blk=`echo $filefrag_op | cut -d: -f2 | cut -d. -f1`
test_130b() {
[ "$OSTCOUNT" -lt "2" ] &&
- skip_env "skipping FIEMAP on 2-stripe file test" && return
-
- [ "$OSTCOUNT" -ge "10" ] &&
- skip_env "skipping FIEMAP with >= 10 OSTs" && return
+ skip_env "skipping FIEMAP on $OSTCOUNT-stripe file" && return
local filefrag_op=$(filefrag -e 2>&1 | grep "invalid option")
[ -n "$filefrag_op" ] && skip_env "filefrag does not support FIEMAP" &&
trap cleanup_130 EXIT RETURN
local fm_file=$DIR/$tfile
- $SETSTRIPE -S 65536 -c 2 $fm_file || error "setstripe on $fm_file"
+ $SETSTRIPE -S 65536 -c $OSTCOUNT $fm_file ||
+ error "setstripe on $fm_file"
[ "$(facet_fstype ost$(($($GETSTRIPE -i $fm_file) + 1)))" = "zfs" ] &&
skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS" && return
- dd if=/dev/zero of=$fm_file bs=1M count=2 ||
+ dd if=/dev/zero of=$fm_file bs=1M count=$OSTCOUNT ||
error "dd failed on $fm_file"
filefrag -ves $fm_file || error "filefrag $fm_file failed"
- filefrag_op=$(filefrag -ve $fm_file | grep -A 100 "ext:" |
- grep -v "ext:" | grep -v "found")
+ filefrag_op=$(filefrag -ve $fm_file |
+ sed -n '/ext:/,/found/{/ext:/d; /found/d; p}')
- last_lun=$(echo $filefrag_op | cut -d: -f5)
+ last_lun=$(echo $filefrag_op | cut -d: -f5 |
+ sed -e 's/^[ \t]*/0x/' | sed -e 's/0x0x/0x/')
IFS=$'\n'
tot_len=0
num_luns=1
for line in $filefrag_op
do
- frag_lun=`echo $line | cut -d: -f5`
- ext_len=`echo $line | cut -d: -f4`
+ frag_lun=$(echo $line | cut -d: -f5 |
+ sed -e 's/^[ \t]*/0x/' | sed -e 's/0x0x/0x/')
+ ext_len=$(echo $line | cut -d: -f4)
if (( $frag_lun != $last_lun )); then
if (( tot_len != 1024 )); then
cleanup_130
- error "FIEMAP on $fm_file failed; returned len $tot_len for OST $last_lun instead of 256"
+ error "FIEMAP on $fm_file failed; returned " \
+ "len $tot_len for OST $last_lun instead of 1024"
return
else
(( num_luns += 1 ))
(( tot_len += ext_len ))
last_lun=$frag_lun
done
- if (( num_luns != 2 || tot_len != 1024 )); then
+ if (( num_luns != $OSTCOUNT || tot_len != 1024 )); then
cleanup_130
- error "FIEMAP on $fm_file failed; returned wrong number of luns or wrong len for OST $last_lun"
+ error "FIEMAP on $fm_file failed; returned wrong number of " \
+ "luns or wrong len for OST $last_lun"
return
fi
cleanup_130
- echo "FIEMAP on 2-stripe file succeeded"
+ echo "FIEMAP on $OSTCOUNT-stripe file succeeded"
}
-run_test 130b "FIEMAP (2-stripe file)"
+run_test 130b "FIEMAP ($OSTCOUNT-stripe file)"
test_130c() {
[ "$OSTCOUNT" -lt "2" ] &&
skip_env "skipping FIEMAP on 2-stripe file" && return
- [ "$OSTCOUNT" -ge "10" ] &&
- skip_env "skipping FIEMAP with >= 10 OSTs" && return
-
filefrag_op=$(filefrag -e 2>&1 | grep "invalid option")
[ -n "$filefrag_op" ] && skip "filefrag does not support FIEMAP" &&
return
[ "$(facet_fstype ost$(($($GETSTRIPE -i $fm_file) + 1)))" = "zfs" ] &&
skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS" && return
- dd if=/dev/zero of=$fm_file seek=1 bs=1M count=1 || error "dd failed on $fm_file"
+ dd if=/dev/zero of=$fm_file seek=1 bs=1M count=1 ||
+ error "dd failed on $fm_file"
filefrag -ves $fm_file || error "filefrag $fm_file failed"
- filefrag_op=`filefrag -ve $fm_file | grep -A 100 "ext:" | grep -v "ext:" | grep -v "found"`
+ filefrag_op=$(filefrag -ve $fm_file |
+ sed -n '/ext:/,/found/{/ext:/d; /found/d; p}')
- last_lun=`echo $filefrag_op | cut -d: -f5`
+ last_lun=$(echo $filefrag_op | cut -d: -f5 |
+ sed -e 's/^[ \t]*/0x/' | sed -e 's/0x0x/0x/')
IFS=$'\n'
tot_len=0
num_luns=1
for line in $filefrag_op
do
- frag_lun=`echo $line | cut -d: -f5`
- ext_len=`echo $line | cut -d: -f4`
+ frag_lun=$(echo $line | cut -d: -f5 |
+ sed -e 's/^[ \t]*/0x/' | sed -e 's/0x0x/0x/')
+ ext_len=$(echo $line | cut -d: -f4)
if (( $frag_lun != $last_lun )); then
logical=`echo $line | cut -d: -f2 | cut -d. -f1`
if (( logical != 512 )); then
cleanup_130
- error "FIEMAP on $fm_file failed; returned logical start for lun $logical instead of 512"
+ error "FIEMAP on $fm_file failed; returned " \
+ "logical start for lun $logical instead of 512"
return
fi
if (( tot_len != 512 )); then
cleanup_130
- error "FIEMAP on $fm_file failed; returned len $tot_len for OST $last_lun instead of 1024"
+ error "FIEMAP on $fm_file failed; returned " \
+ "len $tot_len for OST $last_lun instead of 1024"
return
else
(( num_luns += 1 ))
done
if (( num_luns != 2 || tot_len != 512 )); then
cleanup_130
- error "FIEMAP on $fm_file failed; returned wrong number of luns or wrong len for OST $last_lun"
+ error "FIEMAP on $fm_file failed; returned wrong number of " \
+ "luns or wrong len for OST $last_lun"
return
fi
run_test 130c "FIEMAP (2-stripe file with hole)"
test_130d() {
- [ "$OSTCOUNT" -lt "3" ] && skip_env "skipping FIEMAP on N-stripe file test" && return
-
- [ "$OSTCOUNT" -ge "10" ] &&
- skip_env "skipping FIEMAP with >= 10 OSTs" && return
+ [ "$OSTCOUNT" -lt "3" ] &&
+ skip_env "skipping FIEMAP on N-stripe file test" && return
filefrag_op=$(filefrag -e 2>&1 | grep "invalid option")
- [ -n "$filefrag_op" ] && skip "filefrag does not support FIEMAP" && return
+ [ -n "$filefrag_op" ] && skip "filefrag does not support FIEMAP" &&
+ return
trap cleanup_130 EXIT RETURN
local fm_file=$DIR/$tfile
- $SETSTRIPE -S 65536 -c $OSTCOUNT $fm_file||error "setstripe on $fm_file"
+ $SETSTRIPE -S 65536 -c $OSTCOUNT $fm_file ||
+ error "setstripe on $fm_file"
[ "$(facet_fstype ost$(($($GETSTRIPE -i $fm_file) + 1)))" = "zfs" ] &&
skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS" && return
error "dd failed on $fm_file"
filefrag -ves $fm_file || error "filefrag $fm_file failed"
- filefrag_op=`filefrag -ve $fm_file | grep -A 100 "ext:" |
- grep -v "ext:" | grep -v "found"`
+ filefrag_op=$(filefrag -ve $fm_file |
+ sed -n '/ext:/,/found/{/ext:/d; /found/d; p}')
- last_lun=`echo $filefrag_op | cut -d: -f5`
+ last_lun=$(echo $filefrag_op | cut -d: -f5 |
+ sed -e 's/^[ \t]*/0x/' | sed -e 's/0x0x/0x/')
IFS=$'\n'
tot_len=0
num_luns=1
for line in $filefrag_op
do
- frag_lun=`echo $line | cut -d: -f5`
- ext_len=`echo $line | cut -d: -f4`
+ frag_lun=$(echo $line | cut -d: -f5 |
+ sed -e 's/^[ \t]*/0x/' | sed -e 's/0x0x/0x/')
+ ext_len=$(echo $line | cut -d: -f4)
if (( $frag_lun != $last_lun )); then
if (( tot_len != 1024 )); then
cleanup_130
- error "FIEMAP on $fm_file failed; returned len $tot_len for OST $last_lun instead of 1024"
+ error "FIEMAP on $fm_file failed; returned " \
+ "len $tot_len for OST $last_lun instead of 1024"
return
else
(( num_luns += 1 ))
done
if (( num_luns != actual_stripecnt || tot_len != 1024 )); then
cleanup_130
- error "FIEMAP on $fm_file failed; returned wrong number of luns or wrong len for OST $last_lun"
+ error "FIEMAP on $fm_file failed; returned wrong number of " \
+ "luns or wrong len for OST $last_lun"
return
fi
run_test 130d "FIEMAP (N-stripe file)"
test_130e() {
- [ "$OSTCOUNT" -lt "2" ] && skip_env "skipping continuation FIEMAP test" && return
-
- [ "$OSTCOUNT" -ge "10" ] &&
- skip_env "skipping FIEMAP with >= 10 OSTs" && return
+ [ "$OSTCOUNT" -lt "2" ] &&
+ skip_env "skipping continuation FIEMAP test" && return
filefrag_op=$(filefrag -e 2>&1 | grep "invalid option")
[ -n "$filefrag_op" ] && skip "filefrag does not support FIEMAP" && return
done
filefrag -ves $fm_file || error "filefrag $fm_file failed"
- filefrag_op=`filefrag -ve $fm_file | grep -A 12000 "ext:" | grep -v "ext:" | grep -v "found"`
+ filefrag_op=$(filefrag -ve $fm_file |
+ sed -n '/ext:/,/found/{/ext:/d; /found/d; p}')
- last_lun=`echo $filefrag_op | cut -d: -f5`
+ last_lun=$(echo $filefrag_op | cut -d: -f5 |
+ sed -e 's/^[ \t]*/0x/' | sed -e 's/0x0x/0x/')
IFS=$'\n'
tot_len=0
num_luns=1
for line in $filefrag_op
do
- frag_lun=`echo $line | cut -d: -f5`
- ext_len=`echo $line | cut -d: -f4`
+ frag_lun=$(echo $line | cut -d: -f5 |
+ sed -e 's/^[ \t]*/0x/' | sed -e 's/0x0x/0x/')
+ ext_len=$(echo $line | cut -d: -f4)
if (( $frag_lun != $last_lun )); then
if (( tot_len != $EXPECTED_LEN )); then
cleanup_130
- error "FIEMAP on $fm_file failed; returned len $tot_len for OST $last_lun instead of $EXPECTED_LEN"
+ error "FIEMAP on $fm_file failed; returned " \
+ "len $tot_len for OST $last_lun instead " \
+ "of $EXPECTED_LEN"
return
else
(( num_luns += 1 ))
done
if (( num_luns != 2 || tot_len != $EXPECTED_LEN )); then
cleanup_130
- error "FIEMAP on $fm_file failed; returned wrong number of luns or wrong len for OST $last_lun"
+ error "FIEMAP on $fm_file failed; returned wrong number " \
+ "of luns or wrong len for OST $last_lun"
return
fi