zfs 0.8 support (#15)
* Rename Rewind-Policy to Load-Policy See8a393be353 (diff-f29552ad5ed97006cc80fc2b453cbe39R726)
for details. Signed-off-by: steigr <me@stei.gr> * Use threadpool for zpool_search_import. Seee89f1295d4 (diff-24bf46767aadc66215cb194bdba266e7)
for details. Signed-off-by: steigr <me@stei.gr> * Use sendflags struct. See835db58592
for details. Signed-off-by: steigr <me@stei.gr> * Added new pool properties `Checkpoint` and `LoadGuid` OpenZFS 9166 - zfs storage pool checkpoint:d2734cce68
read/write kstats per dataset:a448a2557e
Signed-off-by: steigr <me@stei.gr>
This commit is contained in:
parent
99406fb402
commit
b16d96b1a8
|
@ -178,6 +178,8 @@ const (
|
|||
PoolPropTName
|
||||
PoolPropMaxNodeSize
|
||||
PoolPropMultiHost
|
||||
PoolPropCheckpoint
|
||||
PoolPropLoadGuid
|
||||
PoolNumProps
|
||||
)
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ func (d *Dataset) send(FromName string, outf *os.File, flags *SendFlags) (err er
|
|||
func (d *Dataset) SendOne(FromName string, outf *os.File, flags *SendFlags) (err error) {
|
||||
var cfromname, ctoname *C.char
|
||||
var dpath string
|
||||
var lzc_send_flags uint32
|
||||
var lzc_send_flags C.struct_sendflags
|
||||
|
||||
if d.Type == DatasetTypeSnapshot || (len(FromName) > 0 && !strings.Contains(FromName, "#")) {
|
||||
err = fmt.Errorf(
|
||||
|
@ -144,10 +144,10 @@ func (d *Dataset) SendOne(FromName string, outf *os.File, flags *SendFlags) (err
|
|||
}
|
||||
|
||||
if flags.LargeBlock {
|
||||
lzc_send_flags |= C.LZC_SEND_FLAG_LARGE_BLOCK
|
||||
lzc_send_flags.largeblock = booleanT(true)
|
||||
}
|
||||
if flags.EmbedData {
|
||||
lzc_send_flags |= C.LZC_SEND_FLAG_EMBED_DATA
|
||||
lzc_send_flags.embed_data = booleanT(true)
|
||||
}
|
||||
// if (flags.Compress)
|
||||
// lzc_send_flags |= LZC_SEND_FLAG_COMPRESS;
|
||||
|
|
30
zpool.c
30
zpool.c
|
@ -6,6 +6,8 @@ typedef unsigned long int rlim64_t;
|
|||
|
||||
#include <libzfs.h>
|
||||
#include <libzfs/sys/zfs_context.h>
|
||||
#include <libzutil.h>
|
||||
#include <thread_pool.h>
|
||||
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
|
@ -79,11 +81,11 @@ char *sZPOOL_CONFIG_DEGRADED = ZPOOL_CONFIG_DEGRADED;
|
|||
char *sZPOOL_CONFIG_REMOVED = ZPOOL_CONFIG_REMOVED;
|
||||
char *sZPOOL_CONFIG_FRU = ZPOOL_CONFIG_FRU;
|
||||
char *sZPOOL_CONFIG_AUX_STATE = ZPOOL_CONFIG_AUX_STATE;
|
||||
char *sZPOOL_REWIND_POLICY = ZPOOL_REWIND_POLICY;
|
||||
char *sZPOOL_REWIND_REQUEST = ZPOOL_REWIND_REQUEST;
|
||||
char *sZPOOL_REWIND_REQUEST_TXG = ZPOOL_REWIND_REQUEST_TXG;
|
||||
char *sZPOOL_REWIND_META_THRESH = ZPOOL_REWIND_META_THRESH;
|
||||
char *sZPOOL_REWIND_DATA_THRESH = ZPOOL_REWIND_DATA_THRESH;
|
||||
char *sZPOOL_LOAD_POLICY = ZPOOL_LOAD_POLICY;
|
||||
char *sZPOOL_LOAD_REWIND_POLICY = ZPOOL_LOAD_REWIND_POLICY;
|
||||
char *sZPOOL_LOAD_REQUEST_TXG = ZPOOL_LOAD_REQUEST_TXG;
|
||||
char *sZPOOL_LOAD_META_THRESH = ZPOOL_LOAD_META_THRESH;
|
||||
char *sZPOOL_LOAD_DATA_THRESH = ZPOOL_LOAD_DATA_THRESH;
|
||||
char *sZPOOL_CONFIG_LOAD_TIME = ZPOOL_CONFIG_LOAD_TIME;
|
||||
char *sZPOOL_CONFIG_LOAD_DATA_ERRORS = ZPOOL_CONFIG_LOAD_DATA_ERRORS;
|
||||
char *sZPOOL_CONFIG_REWIND_TIME = ZPOOL_CONFIG_REWIND_TIME;
|
||||
|
@ -248,8 +250,6 @@ property_list_t *read_zpool_properties(zpool_list_ptr pool) {
|
|||
root = read_append_zpool_property(pool, root, ZPOOL_PROP_EXPANDSZ);
|
||||
root = read_append_zpool_property(pool, root, ZPOOL_PROP_FREEING);
|
||||
|
||||
|
||||
|
||||
list = new_property_list();
|
||||
list->property = ZPOOL_NUM_PROPS;
|
||||
sprintf(list->value, "%d", ZPOOL_NUM_PROPS);
|
||||
|
@ -501,18 +501,24 @@ nvlist_ptr go_zpool_search_import(libzfs_handle_ptr zfsh, int paths, char **path
|
|||
idata.paths = paths;
|
||||
// idata.scan = 0;
|
||||
|
||||
thread_init();
|
||||
pools = zpool_search_import(zfsh, &idata);
|
||||
thread_fini();
|
||||
tpool_t *t;
|
||||
t = tpool_create(1, 5 * sysconf(_SC_NPROCESSORS_ONLN), 0, NULL);
|
||||
if (t == NULL)
|
||||
return NULL;
|
||||
|
||||
pools = zpool_search_import(zfsh, &idata, &libzfs_config_ops);
|
||||
|
||||
tpool_wait(t);
|
||||
tpool_destroy(t);
|
||||
return pools;
|
||||
}
|
||||
|
||||
|
||||
int do_zpool_clear(zpool_list_t *pool, const char *device, u_int32_t rewind_policy) {
|
||||
int do_zpool_clear(zpool_list_t *pool, const char *device, u_int32_t load_policy) {
|
||||
nvlist_t *policy = NULL;
|
||||
int ret = 0;
|
||||
if (nvlist_alloc(&policy, NV_UNIQUE_NAME, 0) != 0 ||
|
||||
nvlist_add_uint32(policy, ZPOOL_REWIND_REQUEST, rewind_policy) != 0)
|
||||
nvlist_add_uint32(policy, ZPOOL_LOAD_POLICY, load_policy) != 0)
|
||||
return (1);
|
||||
|
||||
if (zpool_clear(pool->zph, device, policy) != 0)
|
||||
|
|
10
zpool.h
10
zpool.h
|
@ -149,11 +149,11 @@ extern char *sZPOOL_CONFIG_DEGRADED;
|
|||
extern char *sZPOOL_CONFIG_REMOVED;
|
||||
extern char *sZPOOL_CONFIG_FRU;
|
||||
extern char *sZPOOL_CONFIG_AUX_STATE;
|
||||
extern char *sZPOOL_REWIND_POLICY;
|
||||
extern char *sZPOOL_REWIND_REQUEST;
|
||||
extern char *sZPOOL_REWIND_REQUEST_TXG;
|
||||
extern char *sZPOOL_REWIND_META_THRESH;
|
||||
extern char *sZPOOL_REWIND_DATA_THRESH;
|
||||
extern char *sZPOOL_LOAD_POLICY;
|
||||
extern char *sZPOOL_LOAD_REWIND_POLICY;
|
||||
extern char *sZPOOL_LOAD_REQUEST_TXG;
|
||||
extern char *sZPOOL_LOAD_META_THRESH;
|
||||
extern char *sZPOOL_LOAD_DATA_THRESH;
|
||||
extern char *sZPOOL_CONFIG_LOAD_TIME;
|
||||
extern char *sZPOOL_CONFIG_LOAD_DATA_ERRORS;
|
||||
extern char *sZPOOL_CONFIG_REWIND_TIME;
|
||||
|
|
Loading…
Reference in New Issue