Changeset View
Changeset View
Standalone View
Standalone View
head/tests/sys/cddl/zfs/include/libtest.kshlib
Show First 20 Lines • Show All 2,670 Lines • ▼ Show 20 Lines | function gen_dataset_name | ||||
done | done | ||||
$ECHO $l_name | $ECHO $l_name | ||||
} | } | ||||
# | # | ||||
# Ensure that a given path has been synced, not just ZIL committed. | # Ensure that a given path has been synced, not just ZIL committed. | ||||
# | # | ||||
# XXX The implementation currently requires calling 'zpool history'. On | # XXX On FreeBSD, the sync(8) command (via $SYNC) calls zfs_sync() which just | ||||
# FreeBSD, the sync(8) command (via $SYNC) calls zfs_sync() which just | |||||
# does a zil_commit(), as opposed to a txg_wait_synced(). For things that | # does a zil_commit(), as opposed to a txg_wait_synced(). For things that | ||||
# require writing to their final destination (e.g. for intentional | # require writing to their final destination (e.g. for intentional | ||||
# corruption purposes), zil_commit() is not good enough. | # corruption purposes), zil_commit() is not good enough. | ||||
# | # | ||||
function force_sync_path # path | function force_sync_path # path | ||||
{ | { | ||||
typeset path="$1" | typeset path="$1" | ||||
zfspath=$($DF $path 2>/dev/null | tail -1 | cut -d" " -f1 | cut -d/ -f1) | log_must $ZPOOL export $TESTPOOL | ||||
[ -z "$zfspath" ] && return false | log_must $ZPOOL import -d $path $TESTPOOL | ||||
log_note "Force syncing ${zfspath} for ${path} ..." | |||||
$ZPOOL history $zfspath >/dev/null 2>&1 | |||||
} | } | ||||
# | # | ||||
# Get cksum tuple of dataset | # Get cksum tuple of dataset | ||||
# $1 dataset name | # $1 dataset name | ||||
# | # | ||||
# zdb output is like below | # zdb output is like below | ||||
# " Dataset pool/fs [ZPL], ID 978, cr_txg 2277, 19.0K, 5 objects, | # " Dataset pool/fs [ZPL], ID 978, cr_txg 2277, 19.0K, 5 objects, | ||||
▲ Show 20 Lines • Show All 620 Lines • ▼ Show 20 Lines | function file_dva # dataset filepath [level] [offset] [dva_num] | ||||
typeset -li inode | typeset -li inode | ||||
eval `$STAT -s "$filepath"` | eval `$STAT -s "$filepath"` | ||||
inode="$st_ino" | inode="$st_ino" | ||||
# The inner match is for 'DVA[0]=<0:1b412600:200>', in which the | # The inner match is for 'DVA[0]=<0:1b412600:200>', in which the | ||||
# text surrounding the actual DVA is a fixed size with 8 characters | # text surrounding the actual DVA is a fixed size with 8 characters | ||||
# before it and 1 after. | # before it and 1 after. | ||||
$ZDB -P -vvvvv $dataset $inode | \ | $ZDB -P -vvvvv "$dataset/" $inode | \ | ||||
$AWK -v level=${level} -v dva_num=${dva_num} ' | $AWK -v level=${level} -v dva_num=${dva_num} ' | ||||
BEGIN { stage = 0; } | BEGIN { stage = 0; } | ||||
(stage == 0) && ($1=="Object") { stage = 1; next; } | (stage == 0) && ($1=="Object") { stage = 1; next; } | ||||
(stage == 1) { | (stage == 1) { | ||||
print $3 " " $4; | print $3 " " $4; | ||||
stage = 2; next; | stage = 2; next; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 143 Lines • Show Last 20 Lines |