Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 19 additions & 23 deletions include/libuzfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ struct uzfs_dentry {
char name[0];
};

typedef struct libuzfs_zpool_handle libuzfs_zpool_handle_t;
typedef struct libuzfs_dataset_handle libuzfs_dataset_handle_t;
typedef struct uzfs_inode_attr uzfs_inode_attr_t;
typedef struct uzfs_object_attr uzfs_object_attr_t;
Expand Down Expand Up @@ -114,28 +113,24 @@ extern void libuzfs_init(void);
extern void libuzfs_fini(void);
extern void libuzfs_set_zpool_cache_path(const char *zpool_cache);

extern int libuzfs_zpool_create(const char *zpool, const char *path);
typedef struct libuzfs_zpool_handle libuzfs_zpool_handle_t;

extern int libuzfs_zpool_destroy(const char *zpool);
extern libuzfs_zpool_handle_t *libuzfs_zpool_open(const char *zpool,
int *err, boolean_t autotrim);
extern int libuzfs_zpool_open(const char *const dev_paths[], uint32_t ndevs,
const char *pool_name, libuzfs_zpool_handle_t **zhpp,
boolean_t create, boolean_t autotrim, const void *metrics);
extern void libuzfs_zpool_close(libuzfs_zpool_handle_t *zhp);

extern int libuzfs_zpool_import(const char *dev_path,
char *pool_name, int size);
extern int libuzfs_zpool_export(const char *pool_name);

extern void libuzfs_zpool_prop_set(libuzfs_zpool_handle_t *zhp,
zpool_prop_t prop, uint64_t value);

extern int libuzfs_zpool_prop_get(libuzfs_zpool_handle_t *zhp,
zpool_prop_t prop, uint64_t *value);

extern int libuzfs_dataset_create(const char *dsname);
extern void libuzfs_dataset_destroy(const char *dsname);
extern libuzfs_dataset_handle_t *libuzfs_dataset_open(const char *dsname,
int *err, uint32_t dnodesize, uint32_t max_blksz, const void *metrics);
extern int libuzfs_zpool_dev_add(libuzfs_zpool_handle_t *zhp,
const char *dev_path);
extern int libuzfs_zpool_start_trim(libuzfs_zpool_handle_t *zhp);
extern int libuzfs_zpool_expand_vdev(libuzfs_zpool_handle_t *zhp,
const char *dev_path);

extern libuzfs_dataset_handle_t *libuzfs_dataset_open(
libuzfs_zpool_handle_t *zhp, const char *dsname, int *err,
uint32_t dnodesize, uint32_t max_blksz, boolean_t create);
extern void libuzfs_dataset_close(libuzfs_dataset_handle_t *dhp);
extern int libuzfs_dataset_destroy(libuzfs_zpool_handle_t *zhp,
const char *dsname);

extern uint64_t libuzfs_dataset_get_superblock_ino(
libuzfs_dataset_handle_t *dhp);
Expand Down Expand Up @@ -231,6 +226,10 @@ typedef int (*dir_emit_func_t)(void *arg, uint64_t whence,
extern int libuzfs_dentry_iterate(libuzfs_inode_handle_t *dihp,
uint64_t whence, void *arg, dir_emit_func_t dir_emit);

typedef void (*ds_emit_func_t)(void *arg, const char *name);
int libuzfs_dataset_iterate(libuzfs_zpool_handle_t *zhp, void *arg,
ds_emit_func_t ds_emit);

extern int libuzfs_fs_create(const char *fsname);
extern void libuzfs_fs_destroy(const char *fsname);
extern int libuzfs_fs_init(const char *fsname, uint64_t *fsid);
Expand Down Expand Up @@ -290,11 +289,8 @@ extern void libuzfs_dataset_space(libuzfs_dataset_handle_t *dhp,
extern int libuzfs_object_next_hole(libuzfs_inode_handle_t *ihp, uint64_t *off);
extern void libuzfs_wait_log_commit(libuzfs_dataset_handle_t *dhp);

extern int libuzfs_dataset_expand(libuzfs_dataset_handle_t *dhp);

extern void libuzfs_set_fail_percent(int fail_percent);

extern int libuzfs_start_manual_trim(libuzfs_dataset_handle_t *dhp);
extern int libuzfs_object_next_block(libuzfs_inode_handle_t *ihp,
uint64_t *offset, uint64_t *size);

Expand Down
13 changes: 6 additions & 7 deletions include/libuzfs_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ typedef enum uzfs_attr_type {
UZFS_END
} uzfs_attr_type_t;

struct libuzfs_zpool_handle {
char zpool_name[ZFS_MAX_DATASET_NAME_LEN];
spa_t *spa;
};

struct libuzfs_inode_handle {
sa_handle_t *sa_hdl;
libuzfs_dataset_handle_t *dhp;
Expand All @@ -77,14 +72,13 @@ typedef struct uzfs_hold_handle {
uint64_t ino;
} uzfs_hold_handle_t;

#define NUM_NODE_BUCKETS 997
#define NUM_NODE_BUCKETS 59

typedef struct uzfs_holds {
kmutex_t locks[NUM_NODE_BUCKETS];
avl_tree_t trees[NUM_NODE_BUCKETS];
} uzfs_holds_t;


struct libuzfs_dataset_handle {
char name[ZFS_MAX_DATASET_NAME_LEN];
objset_t *os;
Expand All @@ -96,6 +90,11 @@ struct libuzfs_dataset_handle {
uint32_t dnodesize;
};

struct libuzfs_zpool_handle {
char name[ZFS_MAX_DATASET_NAME_LEN];
spa_t *spa;
};

struct libuzfs_kvattr_iterator {
nvlist_t *hp_kvattrs_in_sa;
nvlist_t *kvattrs_in_sa;
Expand Down
5 changes: 3 additions & 2 deletions include/libzutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ extern const char * const * zpool_default_search_paths(size_t *count);
extern int zpool_read_label(int, nvlist_t **, int *);
extern int zpool_label_disk_wait(const char *, int);
extern int zpool_read_label_secure(int fd, nvlist_t **config, int *num_labels);
extern nvlist_t *zpool_leaf_to_pools(nvlist_t *leaf_config, int num_labels,
const char *dev_path);
extern int zpool_read_configs_from_devs(const char *const dev_paths[],
uint32_t ndevs, const char *pool_name, nvlist_t **pools,
int *empty_dev, int *nempty);

struct udev_device;

Expand Down
2 changes: 1 addition & 1 deletion include/sys/spa.h
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ extern int spa_get_stats(const char *pool, nvlist_t **config, char *altroot,
size_t buflen);
extern int spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props,
nvlist_t *zplprops, struct dsl_crypto_params *dcp);
extern int spa_import(char *pool, nvlist_t *config, nvlist_t *props,
extern int spa_import(const char *pool, nvlist_t *config, nvlist_t *props,
uint64_t flags);
extern nvlist_t *spa_tryimport(nvlist_t *tryconfig);
extern int spa_destroy(const char *pool);
Expand Down
Loading