mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Implemented zpool sync command
This addition will enable us to sync an open TXG to the main pool on demand. The functionality is similar to 'sync(2)' but 'zpool sync' will return when data has hit the main storage instead of potentially just the ZIL as is the case with the 'sync(2)' cmd. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Signed-off-by: Alek Pinchuk <apinchuk@datto.com> Closes #6122
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
|
||||
# Copyright 2016 Nexenta Systems, Inc.
|
||||
# Copyright (c) 2017 Lawrence Livermore National Security, LLC.
|
||||
# Copyright (c) 2017 Datto Inc.
|
||||
#
|
||||
|
||||
. ${STF_TOOLS}/include/logapi.shlib
|
||||
@@ -3203,29 +3204,23 @@ function get_objnum
|
||||
}
|
||||
|
||||
#
|
||||
# Synchronize all the data in pool
|
||||
# Sync data to the pool
|
||||
#
|
||||
# $1 pool name
|
||||
# $2 boolean to force uberblock (and config including zpool cache file) update
|
||||
#
|
||||
function sync_pool #pool
|
||||
function sync_pool #pool <force>
|
||||
{
|
||||
typeset pool=${1:-$TESTPOOL}
|
||||
typeset force=${2:-false}
|
||||
|
||||
log_must $SYNC
|
||||
log_must sleep 2
|
||||
# Flush all the pool data.
|
||||
typeset -i ret
|
||||
zpool scrub $pool >/dev/null 2>&1
|
||||
ret=$?
|
||||
(( $ret != 0 )) && \
|
||||
log_fail "zpool scrub $pool failed."
|
||||
if [[ $force == true ]]; then
|
||||
log_must zpool sync -f $pool
|
||||
else
|
||||
log_must zpool sync $pool
|
||||
fi
|
||||
|
||||
while ! is_pool_scrubbed $pool; do
|
||||
if is_pool_resilvered $pool ; then
|
||||
log_fail "$pool should not be resilver completed."
|
||||
fi
|
||||
log_must sleep 2
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user