From bec1067d54a004cb52a4a6762bfa1d4a30300865 Mon Sep 17 00:00:00 2001 From: Alek P Date: Fri, 19 May 2017 12:33:11 -0700 Subject: 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 Reviewed by: Matthew Ahrens Signed-off-by: Alek Pinchuk Closes #6122 --- include/libzfs.h | 3 +++ include/libzfs_core.h | 3 +++ include/sys/fs/zfs.h | 2 ++ 3 files changed, 8 insertions(+) (limited to 'include') diff --git a/include/libzfs.h b/include/libzfs.h index 08c7813ed..c634ccd86 100644 --- a/include/libzfs.h +++ b/include/libzfs.h @@ -26,6 +26,7 @@ * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2016, Intel Corporation. * Copyright 2016 Nexenta Systems, Inc. + * Copyright (c) 2017 Datto Inc. */ #ifndef _LIBZFS_H @@ -264,6 +265,8 @@ extern int zpool_clear(zpool_handle_t *, const char *, nvlist_t *); extern int zpool_reguid(zpool_handle_t *); extern int zpool_reopen(zpool_handle_t *); +extern int zpool_sync_one(zpool_handle_t *, void *); + extern int zpool_vdev_online(zpool_handle_t *, const char *, int, vdev_state_t *); extern int zpool_vdev_offline(zpool_handle_t *, const char *, boolean_t); diff --git a/include/libzfs_core.h b/include/libzfs_core.h index 0dfbca72b..f71d4b205 100644 --- a/include/libzfs_core.h +++ b/include/libzfs_core.h @@ -21,6 +21,7 @@ /* * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright (c) 2017 Datto Inc. */ #ifndef _LIBZFS_CORE_H @@ -89,6 +90,8 @@ boolean_t lzc_exists(const char *); int lzc_rollback(const char *, char *, int); +int lzc_sync(const char *, nvlist_t *, nvlist_t **); + #ifdef __cplusplus } #endif diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h index d59489de6..7414eee5a 100644 --- a/include/sys/fs/zfs.h +++ b/include/sys/fs/zfs.h @@ -24,6 +24,7 @@ * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. + * Copyright (c) 2017 Datto Inc. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -1020,6 +1021,7 @@ typedef enum zfs_ioc { ZFS_IOC_GET_BOOKMARKS, ZFS_IOC_DESTROY_BOOKMARKS, ZFS_IOC_RECV_NEW, + ZFS_IOC_POOL_SYNC, /* * Linux - 3/64 numbers reserved. -- cgit v1.2.3