Changeset View
Changeset View
Standalone View
Standalone View
stand/libsa/zfs/zfsimpl.c
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
#include "zfsimpl.h" | #include "zfsimpl.h" | ||||
#include "zfssubr.c" | #include "zfssubr.c" | ||||
#ifdef HAS_ZSTD_ZFS | #ifdef HAS_ZSTD_ZFS | ||||
extern int zstd_init(void); | extern int zstd_init(void); | ||||
#endif | #endif | ||||
struct zfsmount { | struct zfsmount { | ||||
char *path; | |||||
const spa_t *spa; | const spa_t *spa; | ||||
objset_phys_t objset; | objset_phys_t objset; | ||||
uint64_t rootobj; | uint64_t rootobj; | ||||
STAILQ_ENTRY(zfsmount) next; | |||||
}; | }; | ||||
static struct zfsmount zfsmount __unused; | |||||
typedef STAILQ_HEAD(zfs_mnt_list, zfsmount) zfs_mnt_list_t; | |||||
static zfs_mnt_list_t zfsmount = STAILQ_HEAD_INITIALIZER(zfsmount); | |||||
/* | /* | ||||
* The indirect_child_t represents the vdev that we will read from, when we | * The indirect_child_t represents the vdev that we will read from, when we | ||||
* need to read all copies of the data (e.g. for scrub or reconstruction). | * need to read all copies of the data (e.g. for scrub or reconstruction). | ||||
* For plain (non-mirror) top-level vdevs (i.e. is_vdev is not a mirror), | * For plain (non-mirror) top-level vdevs (i.e. is_vdev is not a mirror), | ||||
* ic_vdev is the same as is_vdev. However, for mirror top-level vdevs, | * ic_vdev is the same as is_vdev. However, for mirror top-level vdevs, | ||||
* ic_vdev is a child of the mirror. | * ic_vdev is a child of the mirror. | ||||
*/ | */ | ||||
typedef struct indirect_child { | typedef struct indirect_child { | ||||
▲ Show 20 Lines • Show All 3,252 Lines • ▼ Show 20 Lines | zfs_get_root(const spa_t *spa, uint64_t *objid) | ||||
* to find the dataset object and from that the object set itself. | * to find the dataset object and from that the object set itself. | ||||
*/ | */ | ||||
dsl_dir_phys_t *dd = (dsl_dir_phys_t *)&dir.dn_bonus; | dsl_dir_phys_t *dd = (dsl_dir_phys_t *)&dir.dn_bonus; | ||||
*objid = dd->dd_head_dataset_obj; | *objid = dd->dd_head_dataset_obj; | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
zfs_mount(const spa_t *spa, uint64_t rootobj, struct zfsmount *mount) | zfs_mount_impl(const spa_t *spa, uint64_t rootobj, struct zfsmount *mount) | ||||
{ | { | ||||
mount->spa = spa; | mount->spa = spa; | ||||
/* | /* | ||||
* Find the root object set if not explicitly provided | * Find the root object set if not explicitly provided | ||||
*/ | */ | ||||
if (rootobj == 0 && zfs_get_root(spa, &rootobj)) { | if (rootobj == 0 && zfs_get_root(spa, &rootobj)) { | ||||
▲ Show 20 Lines • Show All 465 Lines • Show Last 20 Lines |