FreeBSD ZFS
The Zettabyte File System
Defines | Functions

sys/zfs_ctldir.h File Reference

#include <sys/vnode.h>
#include <sys/zfs_vfsops.h>
#include <sys/zfs_znode.h>
Include dependency graph for zfs_ctldir.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define ZFS_CTLDIR_NAME   ".zfs"
#define zfs_has_ctldir(zdp)
#define zfs_show_ctldir(zdp)
#define ZFSCTL_INO_ROOT   0x1
#define ZFSCTL_INO_SNAPDIR   0x2
#define ZFSCTL_INO_SHARES   0x3

Functions

void zfsctl_create (zfsvfs_t *)
 Create the '.zfs' directory.
void zfsctl_destroy (zfsvfs_t *)
 Destroy the '.zfs' directory.
vnode_t * zfsctl_root (znode_t *)
 Given a root znode, retrieve the associated .zfs directory.
void zfsctl_init (void)
 Initialize the various GFS pieces we'll need to create and manipulate .zfs directories.
void zfsctl_fini (void)
boolean_t zfsctl_is_node (vnode_t *)
int zfsctl_rename_snapshot (const char *from, const char *to)
int zfsctl_destroy_snapshot (const char *snapname, int force)
int zfsctl_umount_snapshots (vfs_t *, int, cred_t *)
 Unmount any snapshots for the given filesystem.
int zfsctl_root_lookup (vnode_t *dvp, char *nm, vnode_t **vpp, pathname_t *pnp, int flags, vnode_t *rdir, cred_t *cr, caller_context_t *ct, int *direntflags, pathname_t *realpnp)
 Special case the handling of "..".
int zfsctl_lookup_objset (vfs_t *vfsp, uint64_t objsetid, zfsvfs_t **zfsvfsp)

Define Documentation

#define ZFS_CTLDIR_NAME   ".zfs"

Definition at line 36 of file zfs_ctldir.h.

#define zfs_has_ctldir (   zdp)
Value:
((zdp)->z_id == (zdp)->z_zfsvfs->z_root && \
        ((zdp)->z_zfsvfs->z_ctldir != NULL))

Definition at line 38 of file zfs_ctldir.h.

#define zfs_show_ctldir (   zdp)
Value:
(zfs_has_ctldir(zdp) && \
        ((zdp)->z_zfsvfs->z_show_ctldir))

Definition at line 41 of file zfs_ctldir.h.

#define ZFSCTL_INO_ROOT   0x1

Definition at line 62 of file zfs_ctldir.h.

#define ZFSCTL_INO_SHARES   0x3

Definition at line 64 of file zfs_ctldir.h.

#define ZFSCTL_INO_SNAPDIR   0x2

Definition at line 63 of file zfs_ctldir.h.


Function Documentation

void zfsctl_create ( zfsvfs_t zfsvfs)

Create the '.zfs' directory.

This directory is cached as part of the VFS structure. This results in a hold on the vfs_t. The code in zfs_umount() therefore checks against a vfs_count of 2 instead of 1. This reference is removed when the ctldir is destroyed in the unmount.

Definition at line 243 of file zfs_ctldir.c.

void zfsctl_destroy ( zfsvfs_t zfsvfs)

Destroy the '.zfs' directory.

Only called when the filesystem is unmounted. There might still be more references if we were force unmounted, but only new zfs_inactive() calls can occur and they don't reference .zfs

Definition at line 281 of file zfs_ctldir.c.

int zfsctl_destroy_snapshot ( const char *  snapname,
int  force 
)
void zfsctl_fini ( void  )

Definition at line 182 of file zfs_ctldir.c.

void zfsctl_init ( void  )

Initialize the various GFS pieces we'll need to create and manipulate .zfs directories.

This is called from the ZFS init routine, and initializes the vnode ops vectors that we'll be using.

Definition at line 174 of file zfs_ctldir.c.

boolean_t zfsctl_is_node ( vnode_t *  )

Definition at line 208 of file zfs_ctldir.c.

int zfsctl_lookup_objset ( vfs_t *  vfsp,
uint64_t  objsetid,
zfsvfs_t **  zfsvfsp 
)

Definition at line 1625 of file zfs_ctldir.c.

int zfsctl_rename_snapshot ( const char *  from,
const char *  to 
)
vnode_t* zfsctl_root ( znode_t zp)

Given a root znode, retrieve the associated .zfs directory.

Add a hold to the vnode and return it.

Definition at line 292 of file zfs_ctldir.c.

int zfsctl_root_lookup ( vnode_t *  dvp,
char *  nm,
vnode_t **  vpp,
pathname_t *  pnp,
int  flags,
vnode_t *  rdir,
cred_t *  cr,
caller_context_t *  ct,
int *  direntflags,
pathname_t *  realpnp 
)

Special case the handling of "..".

Definition at line 518 of file zfs_ctldir.c.

int zfsctl_umount_snapshots ( vfs_t *  vfsp,
int  fflags,
cred_t *  cr 
)

Unmount any snapshots for the given filesystem.

This is called from zfs_umount() - if we have a ctldir, then go through and unmount all the snapshots.

Definition at line 1688 of file zfs_ctldir.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines