dnode.h revision 503ad85c168c7992ccc310af845a581cff3c72b5
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DNODE_H
#define _SYS_DNODE_H
#include <sys/zfs_context.h>
#include <sys/refcount.h>
#include <sys/dmu_zfetch.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* dnode_hold() flags.
*/
#define DNODE_MUST_BE_ALLOCATED 1
#define DNODE_MUST_BE_FREE 2
/*
* dnode_next_offset() flags.
*/
#define DNODE_FIND_HOLE 1
#define DNODE_FIND_BACKWARDS 2
#define DNODE_FIND_HAVELOCK 4
/*
* Fixed constants.
*/
/*
* Derived constants.
*/
/* The +2 here is a cheesy way to round up */
struct dmu_buf_impl;
struct objset;
struct zio;
enum dnode_dirtycontext {
};
/* Is dn_used in bytes? if not, it's in multiples of SPA_MINBLOCKSIZE */
#define DNODE_FLAG_USED_BYTES (1<<0)
typedef struct dnode_phys {
/* accounting is protected by dn_dirty_mtx */
} dnode_phys_t;
typedef struct dnode {
/*
* dn_struct_rwlock protects the structure of the dnode,
* including the number of levels of indirection (dn_nlevels),
* dn_maxblkid, and dn_next_*
*/
/* Our link on dn_objset->os_dnodes list; protected by os_lock. */
/* immutable: */
struct dmu_buf_impl *dn_dbuf;
/*
* Copies of stuff in dn_phys. They're valid in the open
* context (eg. even before the dnode is first synced).
* Where necessary, these are protected by dn_struct_rwlock.
*/
/* protected by os_lock: */
/* protected by dn_mtx: */
/* protected by own devices */
/* parent IO for current sync write */
/* used in syncing context */
/* holds prefetch structure */
} dnode_t;
typedef struct free_range {
} free_range_t;
void dnode_init(void);
void dnode_fini(void);
#ifdef ZFS_DEBUG
/*
* There should be a ## between the string literal and fmt, to make it
* clear that we're joining two strings together, but that piece of shit
* gcc doesn't support that preprocessor token.
*/
if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
char __db_buf[32]; \
if (__db_obj == DMU_META_DNODE_OBJECT) \
else \
(u_longlong_t)__db_obj);\
__db_buf, __VA_ARGS__); \
} \
#else
#define DNODE_VERIFY(dn)
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DNODE_H */