zfs_znode.h revision 67bd71c6cc629bab3aa0d595c624a667f1574254
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_FS_ZFS_ZNODE_H
#define _SYS_FS_ZFS_ZNODE_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef _KERNEL
#include <sys/isa_defs.h>
#include <sys/zfs_vfsops.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Define special zfs pflags
*/
#define MASTER_NODE_OBJ 1
/*
* special attributes for master node.
*/
#define ZFS_FSID "FSID"
#define ZFS_DELETE_QUEUE "DELETE_QUEUE"
#define ZFS_ROOT_OBJ "ROOT"
#define ZPL_VERSION_OBJ "VERSION"
#define ZFS_PROP_BLOCKPERPAGE "BLOCKPERPAGE"
#define ZFS_PROP_NOGROWBLOCKS "NOGROWBLOCKS"
#define ZFS_FLAG_BLOCKPERPAGE 0x1
#define ZFS_FLAG_NOGROWBLOCKS 0x2
/*
* ZPL version - rev'd whenever an incompatible on-disk format change
*/
#define ZPL_VERSION 1ULL
#define ZFS_MAX_BLOCKSIZE (SPA_MAXBLOCKSIZE)
/* Path component length */
/*
* The generic fs code uses MAXNAMELEN to represent
* what the largest component length is. Unfortunately,
* this length includes the terminating NULL. ZFS needs
* to tell the users via pathconf() and statvfs() what the
* true maximum length of a component is, excluding the NULL.
*/
/*
* This is the persistent portion of the znode. It is stored
* in the "bonus buffer" of the file. Short symbolic links
* are also stored in the bonus buffer.
*/
typedef struct znode_phys {
/*
* Data may pad out any remaining bytes in the znode buffer, eg:
*
* |<---------------------- dnode_phys (512) ------------------------>|
* |<-- dnode (192) --->|<----------- "bonus" buffer (320) ---------->|
* |<---- znode (264) ---->|<---- data (56) ---->|
*
* At present, we only use this space to store symbolic links.
*/
} znode_phys_t;
/*
* Directory entry locks control access to directory entries.
* They are used to protect creates, deletes, and renames.
* Each directory znode has a mutex and a list of locked names.
*/
#ifdef _KERNEL
typedef struct zfs_dirlock {
char *dl_name; /* directory entry being locked */
typedef struct znode {
/*
* These are dmu managed fields.
*/
} znode_t;
/*
* Range locking rules
* --------------------
* 1. When truncating a file (zfs_create, zfs_setattr, zfs_space) the whole
* file range needs to be locked as RL_WRITER. Only then can the pages be
* freed etc and zp_size reset. zp_size must be set within range lock.
* 2. For writes and punching holes (zfs_write & zfs_space) just the range
* being written or freed needs to be locked as RL_WRITER.
* Multiple writes at the end of the file must coordinate zp_size updates
* to ensure data isn't lost. A compare and swap loop is currently used
* to ensure the file size is at least the offset last written.
* 3. For reads (zfs_read, zfs_get_data & zfs_putapage) just the range being
* read needs to be locked as RL_READER. A check against zp_size can then
* be made for reading beyond end of file.
*/
/*
* Convert between znode pointers and vnode pointers
*/
/*
* ZFS_ENTER() is called on entry to each ZFS vnode and vfs operation.
* ZFS_EXIT() must be called before exitting the vop.
*/
{ \
if ((zfsvfs)->z_unmounted1) { \
return (EIO); \
} \
}
/*
* Macros for dealing with dmu_buf_hold
*/
#define ZFS_OBJ_MUTEX(zp) \
/*
*/
{ \
}
{ \
}
/*
* Timestamp defines
*/
#define STATE_CHANGED (AT_CTIME)
extern void zfs_set_dataprop(objset_t *);
extern void zfs_znode_init(void);
extern void zfs_znode_fini(void);
extern void zfs_zinactive(znode_t *);
extern void zfs_znode_free(znode_t *);
extern void zfs_remove_op_tables();
extern int zfs_create_op_tables();
extern zil_get_data_t zfs_get_data;
extern int zfsfstype;
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_FS_ZFS_ZNODE_H */