FreeBSD ZFS
The Zettabyte File System
|
ZFS VNode operations. More...
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/systm.h>
#include <sys/sysmacros.h>
#include <sys/resource.h>
#include <sys/vfs.h>
#include <sys/vnode.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/kmem.h>
#include <sys/taskq.h>
#include <sys/uio.h>
#include <sys/atomic.h>
#include <sys/namei.h>
#include <sys/mman.h>
#include <sys/cmn_err.h>
#include <sys/errno.h>
#include <sys/unistd.h>
#include <sys/zfs_dir.h>
#include <sys/zfs_ioctl.h>
#include <sys/fs/zfs.h>
#include <sys/dmu.h>
#include <sys/dmu_objset.h>
#include <sys/spa.h>
#include <sys/txg.h>
#include <sys/dbuf.h>
#include <sys/zap.h>
#include <sys/sa.h>
#include <sys/dirent.h>
#include <sys/policy.h>
#include <sys/sunddi.h>
#include <sys/filio.h>
#include <sys/sid.h>
#include <sys/zfs_ctldir.h>
#include <sys/zfs_fuid.h>
#include <sys/zfs_sa.h>
#include <sys/dnlc.h>
#include <sys/zfs_rlock.h>
#include <sys/extdirent.h>
#include <sys/kidmap.h>
#include <sys/bio.h>
#include <sys/buf.h>
#include <sys/sf_buf.h>
#include <sys/sched.h>
#include <sys/acl.h>
#include <vm/vm_param.h>
#include <vm/vm_pageout.h>
#include <vm/vm_page.h>
Go to the source code of this file.
Data Structures | |
struct | zfs_zlock |
Defines | |
#define | FLAG_CHECK(fflag, xflag, xfield) |
#define | FLAG_CHANGE(fflag, zflag, xflag, xfield) |
Typedefs | |
typedef struct zfs_zlock | zfs_zlock_t |
Functions | |
static int | zfs_open (vnode_t **vpp, int flag, cred_t *cr, caller_context_t *ct) |
static int | zfs_close (vnode_t *vp, int flag, int count, offset_t offset, cred_t *cr, caller_context_t *ct) |
static int | zfs_holey (vnode_t *vp, u_long cmd, offset_t *off) |
Lseek support for finding holes (cmd == _FIO_SEEK_HOLE) and data (cmd == _FIO_SEEK_DATA). | |
static int | zfs_ioctl (vnode_t *vp, u_long com, intptr_t data, int flag, cred_t *cred, int *rvalp, caller_context_t *ct) |
static vm_page_t | page_lookup (vnode_t *vp, int64_t start, int64_t off, int64_t nbytes) |
static void | page_unlock (vm_page_t pp) |
static caddr_t | zfs_map_page (vm_page_t pp, struct sf_buf **sfp) |
static void | zfs_unmap_page (struct sf_buf *sf) |
static void | update_pages (vnode_t *vp, int64_t start, int len, objset_t *os, uint64_t oid, int segflg, dmu_tx_t *tx) |
When a file is memory mapped, we must keep the IO data synchronized between the DMU cache and the memory mapped pages. | |
static int | mappedread_sf (vnode_t *vp, int nbytes, uio_t *uio) |
Read with UIO_NOCOPY flag means that sendfile(2) requests ZFS to populate a range of page cache pages with data. | |
static int | mappedread (vnode_t *vp, int nbytes, uio_t *uio) |
When a file is memory mapped, we must keep the IO data synchronized between the DMU cache and the memory mapped pages. | |
static int | zfs_read (vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct) |
Read bytes from specified file into supplied buffer. | |
static int | zfs_write (vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct) |
Write the bytes to a file. | |
void | zfs_get_done (zgd_t *zgd, int error) |
int | zfs_get_data (void *arg, lr_write_t *lr, char *buf, zio_t *zio) |
Get data to generate a TX_WRITE intent log record. | |
static int | zfs_access (vnode_t *vp, int mode, int flag, cred_t *cr, caller_context_t *ct) |
static int | specvp_check (vnode_t **vpp, cred_t *cr) |
If vnode is for a device return a specfs vnode instead. | |
static int | zfs_lookup (vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp, int nameiop, cred_t *cr, kthread_t *td, int flags) |
Lookup an entry in a directory, or an extended attribute directory. | |
static int | zfs_create (vnode_t *dvp, char *name, vattr_t *vap, int excl, int mode, vnode_t **vpp, cred_t *cr, kthread_t *td) |
Attempt to create a new entry in a directory. | |
static int | zfs_remove (vnode_t *dvp, char *name, cred_t *cr, caller_context_t *ct, int flags) |
Remove an entry from a directory. | |
static int | zfs_mkdir (vnode_t *dvp, char *dirname, vattr_t *vap, vnode_t **vpp, cred_t *cr, caller_context_t *ct, int flags, vsecattr_t *vsecp) |
Create a new directory and insert it into dvp using the name provided. | |
static int | zfs_rmdir (vnode_t *dvp, char *name, vnode_t *cwd, cred_t *cr, caller_context_t *ct, int flags) |
Remove a directory subdir entry. | |
static int | zfs_readdir (vnode_t *vp, uio_t *uio, cred_t *cr, int *eofp, int *ncookies, u_long **cookies) |
Read multiple directory entries. | |
static int | zfs_fsync (vnode_t *vp, int syncflag, cred_t *cr, caller_context_t *ct) |
static int | zfs_getattr (vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, caller_context_t *ct) |
Get the requested file attributes and place them in the provided vattr structure. | |
static int | zfs_setattr (vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, caller_context_t *ct) |
Set the file attributes to the values contained in the vattr structure. | |
static void | zfs_rename_unlock (zfs_zlock_t **zlpp) |
Drop locks and release vnodes that were held by zfs_rename_lock(). | |
static int | zfs_rename_lock (znode_t *szp, znode_t *tdzp, znode_t *sdzp, zfs_zlock_t **zlpp) |
Search back through the directory tree, using the ".." entries. | |
static int | zfs_rename (vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm, cred_t *cr, caller_context_t *ct, int flags) |
Move an entry from the provided source directory to the target directory. | |
static int | zfs_symlink (vnode_t *dvp, vnode_t **vpp, char *name, vattr_t *vap, char *link, cred_t *cr, kthread_t *td) |
Insert the indicated symbolic reference entry into the directory. | |
static int | zfs_readlink (vnode_t *vp, uio_t *uio, cred_t *cr, caller_context_t *ct) |
Return, in the buffer contained in the provided uio structure, the symbolic path referred to by vp. | |
static int | zfs_link (vnode_t *tdvp, vnode_t *svp, char *name, cred_t *cr, caller_context_t *ct, int flags) |
Insert a new entry into directory tdvp referencing svp. | |
void | zfs_inactive (vnode_t *vp, cred_t *cr, caller_context_t *ct) |
CTASSERT (sizeof(struct zfid_short)<=sizeof(struct fid)) | |
CTASSERT (sizeof(struct zfid_long)<=sizeof(struct fid)) | |
static int | zfs_fid (vnode_t *vp, fid_t *fidp, caller_context_t *ct) |
static int | zfs_pathconf (vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr, caller_context_t *ct) |
static int | zfs_getsecattr (vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr, caller_context_t *ct) |
int | zfs_setsecattr (vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr, caller_context_t *ct) |
static int | ioflags (int ioflags) |
static int | zfs_getpages (struct vnode *vp, vm_page_t *m, int count, int reqpage) |
static int | zfs_freebsd_getpages (struct vop_getpages_args *ap) |
static int | zfs_freebsd_open (struct vop_open_args *ap) |
static int | zfs_freebsd_close (struct vop_close_args *ap) |
static int | zfs_freebsd_ioctl (struct vop_ioctl_args *ap) |
static int | zfs_freebsd_read (struct vop_read_args *ap) |
static int | zfs_freebsd_write (struct vop_write_args *ap) |
static int | zfs_freebsd_access (struct vop_access_args *ap) |
static int | zfs_freebsd_lookup (struct vop_lookup_args *ap) |
static int | zfs_freebsd_create (struct vop_create_args *ap) |
static int | zfs_freebsd_remove (struct vop_remove_args *ap) |
static int | zfs_freebsd_mkdir (struct vop_mkdir_args *ap) |
static int | zfs_freebsd_rmdir (struct vop_rmdir_args *ap) |
static int | zfs_freebsd_readdir (struct vop_readdir_args *ap) |
static int | zfs_freebsd_fsync (struct vop_fsync_args *ap) |
static int | zfs_freebsd_getattr (struct vop_getattr_args *ap) |
static int | zfs_freebsd_setattr (struct vop_setattr_args *ap) |
static int | zfs_freebsd_rename (struct vop_rename_args *ap) |
static int | zfs_freebsd_symlink (struct vop_symlink_args *ap) |
static int | zfs_freebsd_readlink (struct vop_readlink_args *ap) |
static int | zfs_freebsd_link (struct vop_link_args *ap) |
static int | zfs_freebsd_inactive (struct vop_inactive_args *ap) |
static void | zfs_reclaim_complete (void *arg, int pending) |
static int | zfs_freebsd_reclaim (struct vop_reclaim_args *ap) |
static int | zfs_freebsd_fid (struct vop_fid_args *ap) |
static int | zfs_freebsd_pathconf (struct vop_pathconf_args *ap) |
static int | zfs_freebsd_fifo_pathconf (struct vop_pathconf_args *ap) |
static int | zfs_create_attrname (int attrnamespace, const char *name, char *attrname, size_t size) |
static int | zfs_getextattr (struct vop_getextattr_args *ap) |
Vnode operating to retrieve a named extended attribute. | |
int | zfs_deleteextattr (struct vop_deleteextattr_args *ap) |
static int | zfs_setextattr (struct vop_setextattr_args *ap) |
Vnode operation to set a named attribute. | |
static int | zfs_listextattr (struct vop_listextattr_args *ap) |
Vnode operation to retrieve extended attributes on a vnode. | |
int | zfs_freebsd_getacl (struct vop_getacl_args *ap) |
int | zfs_freebsd_setacl (struct vop_setacl_args *ap) |
int | zfs_freebsd_aclcheck (struct vop_aclcheck_args *ap) |
Variables | |
offset_t | zfs_read_chunk_size = 1024 * 1024 |
uint64_t | null_xattr = 0 |
ulong_t | zfs_fsync_sync_cnt = 4 |
struct vop_vector | zfs_vnodeops |
struct vop_vector | zfs_fifoops |
struct vop_vector | zfs_shareops |
ZFS VNode operations.
Entry points to the ZFS module
Programming rules.
Each vnode op performs some logical unit of work. To do this, the ZPL must properly lock its in-core state, create a DMU transaction, do the work, record this work in the intent log (ZIL), commit the DMU transaction, and wait for the intent log to commit if it is a synchronous operation. Moreover, the vnode ops must work in both normal and log replay context. The ordering of events is important to avoid deadlocks and references to freed memory. The example below illustrates the following Big Rules:
In general, this is how things should be ordered in each vnode op:
ZFS_ENTER(zfsvfs); // exit if unmounted top: zfs_dirent_lock(&dl, ...) // lock directory entry (may VN_HOLD()) rw_enter(...); // grab any other locks you need tx = dmu_tx_create(...); // get DMU tx dmu_tx_hold_*(); // hold each object you might modify error = dmu_tx_assign(tx, TXG_NOWAIT); // try to assign if (error) { rw_exit(...); // drop locks zfs_dirent_unlock(dl); // unlock directory entry VN_RELE(...); // release held vnodes if (error == ERESTART) { dmu_tx_wait(tx); dmu_tx_abort(tx); goto top; } dmu_tx_abort(tx); // abort DMU tx ZFS_EXIT(zfsvfs); // finished in zfs return (error); // really out of space } error = do_real_work(); // do whatever this VOP does if (error == 0) zfs_log_*(...); // on success, make ZIL entry dmu_tx_commit(tx); // commit DMU tx -- error or not rw_exit(...); // drop locks zfs_dirent_unlock(dl); // unlock directory entry VN_RELE(...); // release held vnodes zil_commit(zilog, foid); // synchronous when necessary ZFS_EXIT(zfsvfs); // finished in zfs return (error); // done, report error
Definition in file zfs_vnops.c.
#define FLAG_CHANGE | ( | fflag, | |
zflag, | |||
xflag, | |||
xfield | |||
) |
do { \ if (((fflags & (fflag)) && !(zflags & (zflag))) || \ ((zflags & (zflag)) && !(fflags & (fflag)))) { \ XVA_SET_REQ(&xvap, (xflag)); \ (xfield) = ((fflags & (fflag)) != 0); \ } \ } while (0)
#define FLAG_CHECK | ( | fflag, | |
xflag, | |||
xfield | |||
) |
do { \ if (XVA_ISSET_RTN(&xvap, (xflag)) && (xfield) != 0) \ fflags |= (fflag); \ } while (0)
typedef struct zfs_zlock zfs_zlock_t |
CTASSERT | ( | sizeof(struct zfid_short)<=sizeof(struct fid) | ) |
CTASSERT | ( | sizeof(struct zfid_long)<=sizeof(struct fid) | ) |
static int ioflags | ( | int | ioflags | ) | [static] |
Definition at line 5519 of file zfs_vnops.c.
static int mappedread | ( | vnode_t * | vp, |
int | nbytes, | ||
uio_t * | uio | ||
) | [static] |
When a file is memory mapped, we must keep the IO data synchronized between the DMU cache and the memory mapped pages.
What this means:
On Read: We "read" preferentially from memory mapped pages, else we default from the dmu buffer.
Definition at line 505 of file zfs_vnops.c.
static int mappedread_sf | ( | vnode_t * | vp, |
int | nbytes, | ||
uio_t * | uio | ||
) | [static] |
Read with UIO_NOCOPY flag means that sendfile(2) requests ZFS to populate a range of page cache pages with data.
Definition at line 439 of file zfs_vnops.c.
static vm_page_t page_lookup | ( | vnode_t * | vp, |
int64_t | start, | ||
int64_t | off, | ||
int64_t | nbytes | ||
) | [static] |
Definition at line 326 of file zfs_vnops.c.
static void page_unlock | ( | vm_page_t | pp | ) | [static] |
Definition at line 361 of file zfs_vnops.c.
static int specvp_check | ( | vnode_t ** | vpp, |
cred_t * | cr | ||
) | [static] |
If vnode is for a device return a specfs vnode instead.
Definition at line 1258 of file zfs_vnops.c.
static void update_pages | ( | vnode_t * | vp, |
int64_t | start, | ||
int | len, | ||
objset_t * | os, | ||
uint64_t | oid, | ||
int | segflg, | ||
dmu_tx_t * | tx | ||
) | [static] |
When a file is memory mapped, we must keep the IO data synchronized between the DMU cache and the memory mapped pages.
What this means:
On Write: If we find a memory mapped page, we write to *both* the page and the dmu buffer.
Definition at line 390 of file zfs_vnops.c.
static int zfs_access | ( | vnode_t * | vp, |
int | mode, | ||
int | flag, | ||
cred_t * | cr, | ||
caller_context_t * | ct | ||
) | [static] |
Definition at line 1235 of file zfs_vnops.c.
static int zfs_close | ( | vnode_t * | vp, |
int | flag, | ||
int | count, | ||
offset_t | offset, | ||
cred_t * | cr, | ||
caller_context_t * | ct | ||
) | [static] |
Definition at line 203 of file zfs_vnops.c.
static int zfs_create | ( | vnode_t * | dvp, |
char * | name, | ||
vattr_t * | vap, | ||
int | excl, | ||
int | mode, | ||
vnode_t ** | vpp, | ||
cred_t * | cr, | ||
kthread_t * | td | ||
) | [static] |
Attempt to create a new entry in a directory.
If the entry already exists, truncate the file if permissible, else return an error. Return the vp of the created or trunc'd file.
[in,out] | dvp | vnode of directory to put new file entry in. On return, ctime|mtime are updated if new entry created |
[in] | name | name of new file entry. |
[in] | vap | attributes of new file. |
[in] | excl | flag indicating exclusive or non-exclusive mode. |
[in] | mode | mode to open file with. |
[out] | vpp | storage for the returned vnode of created or trunc'd entry. On return, ctime|mtime are updated, and atime is updated if the file is new |
[in] | cr | credentials of caller |
Timestamps:
Definition at line 1492 of file zfs_vnops.c.
static int zfs_create_attrname | ( | int | attrnamespace, |
const char * | name, | ||
char * | attrname, | ||
size_t | size | ||
) | [static] |
Definition at line 6234 of file zfs_vnops.c.
int zfs_deleteextattr | ( | struct vop_deleteextattr_args * | ap | ) |
Definition at line 6353 of file zfs_vnops.c.
static int zfs_fid | ( | vnode_t * | vp, |
fid_t * | fidp, | ||
caller_context_t * | ct | ||
) | [static] |
Definition at line 5003 of file zfs_vnops.c.
static int zfs_freebsd_access | ( | struct vop_access_args * | ap | ) | [static] |
Definition at line 5698 of file zfs_vnops.c.
int zfs_freebsd_aclcheck | ( | struct vop_aclcheck_args * | ap | ) |
Definition at line 6679 of file zfs_vnops.c.
static int zfs_freebsd_close | ( | struct vop_close_args * | ap | ) | [static] |
Definition at line 5641 of file zfs_vnops.c.
static int zfs_freebsd_create | ( | struct vop_create_args * | ap | ) | [static] |
Definition at line 5760 of file zfs_vnops.c.
static int zfs_freebsd_fid | ( | struct vop_fid_args * | ap | ) | [static] |
Definition at line 6175 of file zfs_vnops.c.
static int zfs_freebsd_fifo_pathconf | ( | struct vop_pathconf_args * | ap | ) | [static] |
Definition at line 6205 of file zfs_vnops.c.
static int zfs_freebsd_fsync | ( | struct vop_fsync_args * | ap | ) | [static] |
Definition at line 5847 of file zfs_vnops.c.
int zfs_freebsd_getacl | ( | struct vop_getacl_args * | ap | ) |
Definition at line 6605 of file zfs_vnops.c.
static int zfs_freebsd_getattr | ( | struct vop_getattr_args * | ap | ) | [static] |
Definition at line 5860 of file zfs_vnops.c.
static int zfs_freebsd_getpages | ( | struct vop_getpages_args * | ap | ) | [static] |
Definition at line 5608 of file zfs_vnops.c.
static int zfs_freebsd_inactive | ( | struct vop_inactive_args * | ap | ) | [static] |
Definition at line 6080 of file zfs_vnops.c.
static int zfs_freebsd_ioctl | ( | struct vop_ioctl_args * | ap | ) | [static] |
Definition at line 5654 of file zfs_vnops.c.
static int zfs_freebsd_link | ( | struct vop_link_args * | ap | ) | [static] |
Definition at line 6065 of file zfs_vnops.c.
static int zfs_freebsd_lookup | ( | struct vop_lookup_args * | ap | ) | [static] |
Definition at line 5742 of file zfs_vnops.c.
static int zfs_freebsd_mkdir | ( | struct vop_mkdir_args * | ap | ) | [static] |
Definition at line 5797 of file zfs_vnops.c.
static int zfs_freebsd_open | ( | struct vop_open_args * | ap | ) | [static] |
Definition at line 5622 of file zfs_vnops.c.
static int zfs_freebsd_pathconf | ( | struct vop_pathconf_args * | ap | ) | [static] |
Definition at line 6186 of file zfs_vnops.c.
static int zfs_freebsd_read | ( | struct vop_read_args * | ap | ) | [static] |
Definition at line 5670 of file zfs_vnops.c.
static int zfs_freebsd_readdir | ( | struct vop_readdir_args * | ap | ) | [static] |
Definition at line 5831 of file zfs_vnops.c.
static int zfs_freebsd_readlink | ( | struct vop_readlink_args * | ap | ) | [static] |
Definition at line 6053 of file zfs_vnops.c.
static int zfs_freebsd_reclaim | ( | struct vop_reclaim_args * | ap | ) | [static] |
Definition at line 6115 of file zfs_vnops.c.
static int zfs_freebsd_remove | ( | struct vop_remove_args * | ap | ) | [static] |
Definition at line 5782 of file zfs_vnops.c.
static int zfs_freebsd_rename | ( | struct vop_rename_args * | ap | ) | [static] |
Definition at line 5996 of file zfs_vnops.c.
static int zfs_freebsd_rmdir | ( | struct vop_rmdir_args * | ap | ) | [static] |
Definition at line 5816 of file zfs_vnops.c.
int zfs_freebsd_setacl | ( | struct vop_setacl_args * | ap | ) |
Definition at line 6632 of file zfs_vnops.c.
static int zfs_freebsd_setattr | ( | struct vop_setattr_args * | ap | ) | [static] |
Definition at line 5906 of file zfs_vnops.c.
static int zfs_freebsd_symlink | ( | struct vop_symlink_args * | ap | ) | [static] |
Definition at line 6031 of file zfs_vnops.c.
static int zfs_freebsd_write | ( | struct vop_write_args * | ap | ) | [static] |
Definition at line 5684 of file zfs_vnops.c.
static int zfs_fsync | ( | vnode_t * | vp, |
int | syncflag, | ||
cred_t * | cr, | ||
caller_context_t * | ct | ||
) | [static] |
Definition at line 2603 of file zfs_vnops.c.
int zfs_get_data | ( | void * | arg, |
lr_write_t * | lr, | ||
char * | buf, | ||
zio_t * | zio | ||
) |
Get data to generate a TX_WRITE intent log record.
Definition at line 1117 of file zfs_vnops.c.
void zfs_get_done | ( | zgd_t * | zgd, |
int | error | ||
) |
Definition at line 1087 of file zfs_vnops.c.
static int zfs_getattr | ( | vnode_t * | vp, |
vattr_t * | vap, | ||
int | flags, | ||
cred_t * | cr, | ||
caller_context_t * | ct | ||
) | [static] |
Get the requested file attributes and place them in the provided vattr structure.
[in] | vp | vnode of file. |
[in,out] | vap | va_mask identifies requested attributes. If AT_XVATTR set, then optional attrs are requested. Attribute values are returned here |
[in] | flags | ATTR_NOACLCHECK (CIFS server context) |
[in] | cr | credentials of caller. |
[in] | ct | caller context |
Definition at line 2636 of file zfs_vnops.c.
static int zfs_getextattr | ( | struct vop_getextattr_args * | ap | ) | [static] |
Vnode operating to retrieve a named extended attribute.
Definition at line 6282 of file zfs_vnops.c.
static int zfs_getpages | ( | struct vnode * | vp, |
vm_page_t * | m, | ||
int | count, | ||
int | reqpage | ||
) | [static] |
Definition at line 5534 of file zfs_vnops.c.
static int zfs_getsecattr | ( | vnode_t * | vp, |
vsecattr_t * | vsecp, | ||
int | flag, | ||
cred_t * | cr, | ||
caller_context_t * | ct | ||
) | [static] |
Definition at line 5142 of file zfs_vnops.c.
static int zfs_holey | ( | vnode_t * | vp, |
u_long | cmd, | ||
offset_t * | off | ||
) | [static] |
Lseek support for finding holes (cmd == _FIO_SEEK_HOLE) and data (cmd == _FIO_SEEK_DATA).
"off" is an in/out parameter.
Definition at line 236 of file zfs_vnops.c.
void zfs_inactive | ( | vnode_t * | vp, |
cred_t * | cr, | ||
caller_context_t * | ct | ||
) |
Definition at line 4537 of file zfs_vnops.c.
static int zfs_ioctl | ( | vnode_t * | vp, |
u_long | com, | ||
intptr_t | data, | ||
int | flag, | ||
cred_t * | cred, | ||
int * | rvalp, | ||
caller_context_t * | ct | ||
) | [static] |
Definition at line 276 of file zfs_vnops.c.
static int zfs_link | ( | vnode_t * | tdvp, |
vnode_t * | svp, | ||
char * | name, | ||
cred_t * | cr, | ||
caller_context_t * | ct, | ||
int | flags | ||
) | [static] |
Insert a new entry into directory tdvp referencing svp.
[in,out] | tdvp | Directory to contain new entry. On return, ctime and mtime are updated |
[in,out] | svp | vnode of new entry. On return, ctime is updated |
[in] | name | name of new entry. |
[in] | cr | credentials of caller |
[in] | ct | caller context |
Timestamps:
Definition at line 4163 of file zfs_vnops.c.
static int zfs_listextattr | ( | struct vop_listextattr_args * | ap | ) | [static] |
Vnode operation to retrieve extended attributes on a vnode.
Definition at line 6485 of file zfs_vnops.c.
static int zfs_lookup | ( | vnode_t * | dvp, |
char * | nm, | ||
vnode_t ** | vpp, | ||
struct componentname * | cnp, | ||
int | nameiop, | ||
cred_t * | cr, | ||
kthread_t * | td, | ||
int | flags | ||
) | [static] |
Lookup an entry in a directory, or an extended attribute directory.
If it exists, return a held vnode reference for it.
[in] | dvp | vnode of directory to search |
[in] | nm | name of entry to lookup |
[out] | vpp | vnode of located entry, NULL if not found. |
[in] | cr | credentials of caller |
[in] | flags | LOOKUP_XATTR set if looking for an attribute. |
Timestamps: NA
Definition at line 1292 of file zfs_vnops.c.
static caddr_t zfs_map_page | ( | vm_page_t | pp, |
struct sf_buf ** | sfp | ||
) | [static] |
Definition at line 368 of file zfs_vnops.c.
static int zfs_mkdir | ( | vnode_t * | dvp, |
char * | dirname, | ||
vattr_t * | vap, | ||
vnode_t ** | vpp, | ||
cred_t * | cr, | ||
caller_context_t * | ct, | ||
int | flags, | ||
vsecattr_t * | vsecp | ||
) | [static] |
Create a new directory and insert it into dvp using the name provided.
Return a pointer to the inserted directory.
[in,out] | dvp | vnode of directory to add subdir to. On return, ctime and mtime are updated |
[in] | dirname | name of new directory. |
[in] | vap | attributes of new directory. |
[out] | vpp | storage for the returned vnode of the created directory. Ctime, mtime, and atime are updated |
[in] | cr | credentials of caller. |
[in] | ct | caller context |
[in] | vsecp | ACL to be set |
Timestamps:
Definition at line 1976 of file zfs_vnops.c.
static int zfs_open | ( | vnode_t ** | vpp, |
int | flag, | ||
cred_t * | cr, | ||
caller_context_t * | ct | ||
) | [static] |
Definition at line 170 of file zfs_vnops.c.
static int zfs_pathconf | ( | vnode_t * | vp, |
int | cmd, | ||
ulong_t * | valp, | ||
cred_t * | cr, | ||
caller_context_t * | ct | ||
) | [static] |
Definition at line 5059 of file zfs_vnops.c.
static int zfs_read | ( | vnode_t * | vp, |
uio_t * | uio, | ||
int | ioflag, | ||
cred_t * | cr, | ||
caller_context_t * | ct | ||
) | [static] |
Read bytes from specified file into supplied buffer.
[in,out] | vp | vnode of file to be read from. On return, atime is updated if byte count > 0 |
[in,out] | uio | structure supplying read location, range info, and return buffer. On return, the range and offset is updated, and the buffer is filled |
[in] | ioflag | SYNC flags; used to provide FRSYNC semantics |
[in] | cr | credentials of caller |
[in] | ct | caller context |
Definition at line 571 of file zfs_vnops.c.
static int zfs_readdir | ( | vnode_t * | vp, |
uio_t * | uio, | ||
cred_t * | cr, | ||
int * | eofp, | ||
int * | ncookies, | ||
u_long ** | cookies | ||
) | [static] |
Read multiple directory entries.
Read as many directory entries as will fit into the provided buffer from the given directory cursor position (specified in the uio structure.
[in,out] | vp | vnode of directory to read. On return, atime is updated |
[in,out] | uio | structure supplying read location, range info, and return buffer. On return, offset and range are updated and buffer is filled |
[in] | cr | credentials of caller |
[out] | eofp | set to true if end-of-file detected |
[out] | ncookies | number of returned cookies |
[out] | cookies | array of cookies returned by ZAP. Note that the low 4 bits of the cookie returned by zap is always zero. This allows us to use the low range for "special" directory entries: We use 0 for '.', and 1 for '..'. If this is the root of the filesystem, we use the offset 2 for the '.zfs' directory. |
Timestamps:
Definition at line 2300 of file zfs_vnops.c.
static int zfs_readlink | ( | vnode_t * | vp, |
uio_t * | uio, | ||
cred_t * | cr, | ||
caller_context_t * | ct | ||
) | [static] |
Return, in the buffer contained in the provided uio structure, the symbolic path referred to by vp.
[in,out] | vp | vnode of symbolic link. On return, atime is updated |
[in,out] | uio | structure to contain the link path. |
[in] | cr | credentials of caller. |
[in] | ct | caller context |
Timestamps:
Definition at line 4122 of file zfs_vnops.c.
static void zfs_reclaim_complete | ( | void * | arg, |
int | pending | ||
) | [static] |
Definition at line 6093 of file zfs_vnops.c.
static int zfs_remove | ( | vnode_t * | dvp, |
char * | name, | ||
cred_t * | cr, | ||
caller_context_t * | ct, | ||
int | flags | ||
) | [static] |
Remove an entry from a directory.
[in,out] | dvp | vnode of directory to remove entry from. On return, ctime and mtime are updated |
[in] | name | name of entry to remove. |
[in] | cr | credentials of caller. |
[in] | ct | caller context |
[in] | flags | case flags |
Timestamps:
Definition at line 1744 of file zfs_vnops.c.
static int zfs_rename | ( | vnode_t * | sdvp, |
char * | snm, | ||
vnode_t * | tdvp, | ||
char * | tnm, | ||
cred_t * | cr, | ||
caller_context_t * | ct, | ||
int | flags | ||
) | [static] |
Move an entry from the provided source directory to the target directory.
Change the entry name as indicated.
[in,out] | sdvp | Source directory containing the "old entry". ctime|mtime are updated on return |
[in] | snm | Old entry name. |
[in,out] | tdvp | Target directory to contain the "new entry". ctime|mtime are updated on return |
[in] | tnm | New entry name. |
[in] | cr | credentials of caller. |
[in] | ct | caller context |
[in] | flags | case flags |
Timestamps:
Definition at line 3605 of file zfs_vnops.c.
static int zfs_rename_lock | ( | znode_t * | szp, |
znode_t * | tdzp, | ||
znode_t * | sdzp, | ||
zfs_zlock_t ** | zlpp | ||
) | [static] |
Search back through the directory tree, using the ".." entries.
Lock each directory in the chain to prevent concurrent renames. Fail any attempt to move a directory into one of its own descendants. XXX - z_parent_lock can overlap with map or grow locks
Definition at line 3517 of file zfs_vnops.c.
static void zfs_rename_unlock | ( | zfs_zlock_t ** | zlpp | ) | [static] |
Drop locks and release vnodes that were held by zfs_rename_lock().
Definition at line 3497 of file zfs_vnops.c.
static int zfs_rmdir | ( | vnode_t * | dvp, |
char * | name, | ||
vnode_t * | cwd, | ||
cred_t * | cr, | ||
caller_context_t * | ct, | ||
int | flags | ||
) | [static] |
Remove a directory subdir entry.
If the current working directory is the same as the subdir to be removed, the remove will fail.
[in,out] | dvp | vnode of directory to remove from. On return, ctime and mtime are updated |
[in] | name | name of directory to be removed. |
[in] | cwd | vnode of current working directory. |
[in] | cr | credentials of caller. |
[in] | ct | caller context |
[in] | flags | case flags |
Timestamps:
Definition at line 2156 of file zfs_vnops.c.
static int zfs_setattr | ( | vnode_t * | vp, |
vattr_t * | vap, | ||
int | flags, | ||
cred_t * | cr, | ||
caller_context_t * | ct | ||
) | [static] |
Set the file attributes to the values contained in the vattr structure.
[in,out] | vp | vnode of file to be modified. On return, ctime is updated. mtime is updated if the size changed |
[in] | vap | new attribute values. If AT_XVATTR set, then optional attrs are being set |
[in] | flags | flags - ATTR_UTIME set if non-default time values provided - ATTR_NOACLCHECK (CIFS context only) |
[in] | cr | credentials of caller |
[in] | ct | caller context |
Timestamps:
Definition at line 2863 of file zfs_vnops.c.
static int zfs_setextattr | ( | struct vop_setextattr_args * | ap | ) | [static] |
Vnode operation to set a named attribute.
Definition at line 6418 of file zfs_vnops.c.
int zfs_setsecattr | ( | vnode_t * | vp, |
vsecattr_t * | vsecp, | ||
int | flag, | ||
cred_t * | cr, | ||
caller_context_t * | ct | ||
) |
Definition at line 5160 of file zfs_vnops.c.
static int zfs_symlink | ( | vnode_t * | dvp, |
vnode_t ** | vpp, | ||
char * | name, | ||
vattr_t * | vap, | ||
char * | link, | ||
cred_t * | cr, | ||
kthread_t * | td | ||
) | [static] |
Insert the indicated symbolic reference entry into the directory.
[in,out] | dvp | Directory to contain new symbolic link. On return, ctime and mtime are updated |
[in] | name | target path of new symlink |
[in] | vap | Attributes of new entry |
[in] | link | Name for new symlink entry |
[in] | cr | credentials of caller |
Timestamps:
Definition at line 3971 of file zfs_vnops.c.
static void zfs_unmap_page | ( | struct sf_buf * | sf | ) | [static] |
Definition at line 376 of file zfs_vnops.c.
static int zfs_write | ( | vnode_t * | vp, |
uio_t * | uio, | ||
int | ioflag, | ||
cred_t * | cr, | ||
caller_context_t * | ct | ||
) | [static] |
Write the bytes to a file.
[in,out] | vp | vnode of file to be written to. On return, ctime and/or mtime is updated if byte count > 0 |
[in,out] | uio | structure supplying write location, range info, and data buffer. On return, offset and range is updated |
[in] | ioflag | FAPPEND, FSYNC, and/or FDSYNC |
[in] | cr | credentials of caller |
[in] | ct | caller context (NFS/CIFS fem monitor only) |
Timestamps:
Definition at line 721 of file zfs_vnops.c.
uint64_t null_xattr = 0 |
Definition at line 1724 of file zfs_vnops.c.
struct vop_vector zfs_fifoops |
{ .vop_default = &fifo_specops, .vop_fsync = zfs_freebsd_fsync, .vop_access = zfs_freebsd_access, .vop_getattr = zfs_freebsd_getattr, .vop_inactive = zfs_freebsd_inactive, .vop_read = VOP_PANIC, .vop_reclaim = zfs_freebsd_reclaim, .vop_setattr = zfs_freebsd_setattr, .vop_write = VOP_PANIC, .vop_pathconf = zfs_freebsd_fifo_pathconf, .vop_fid = zfs_freebsd_fid, .vop_getacl = zfs_freebsd_getacl, .vop_setacl = zfs_freebsd_setacl, .vop_aclcheck = zfs_freebsd_aclcheck, }
Definition at line 6693 of file zfs_vnops.c.
ulong_t zfs_fsync_sync_cnt = 4 |
Definition at line 2600 of file zfs_vnops.c.
offset_t zfs_read_chunk_size = 1024 * 1024 |
Definition at line 551 of file zfs_vnops.c.
struct vop_vector zfs_shareops |
{ .vop_default = &default_vnodeops, .vop_access = zfs_freebsd_access, .vop_inactive = zfs_freebsd_inactive, .vop_reclaim = zfs_freebsd_reclaim, .vop_fid = zfs_freebsd_fid, .vop_pathconf = zfs_freebsd_pathconf, }
Definition at line 6694 of file zfs_vnops.c.
struct vop_vector zfs_vnodeops |
Definition at line 6692 of file zfs_vnops.c.