usr/src/uts/common/fs/zfs/sys/zap_impl.h
author ahrens
Tue, 29 Aug 2006 15:09:44 -0700
changeset 2641 967ea438b194
parent 1578 1fd8ab638fc0
child 2856 6f4d5ee1906a
permissions -rw-r--r--
6462174 zap_update() likes to return 0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     1
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     2
 * CDDL HEADER START
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     3
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
1491
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
     5
 * Common Development and Distribution License (the "License").
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
     6
 * You may not use this file except in compliance with the License.
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     7
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    11
 * and limitations under the License.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    12
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    18
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    19
 * CDDL HEADER END
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    20
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    21
/*
1491
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
    22
 * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    23
 * Use is subject to license terms.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    24
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    25
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    26
#ifndef	_SYS_ZAP_IMPL_H
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    27
#define	_SYS_ZAP_IMPL_H
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    28
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    29
#pragma ident	"%Z%%M%	%I%	%E% SMI"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    30
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    31
#include <sys/zap.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    32
#include <sys/zfs_context.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    33
#include <sys/avl.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    34
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    35
#ifdef	__cplusplus
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    36
extern "C" {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    37
#endif
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    38
1491
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
    39
extern int fzap_default_block_shift;
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
    40
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    41
#define	ZAP_MAGIC 0x2F52AB2AB
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    42
1491
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
    43
#define	FZAP_BLOCK_SHIFT(zap)	((zap)->zap_f.zap_block_shift)
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    44
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    45
#define	ZAP_MAXCD		(uint32_t)(-1)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    46
#define	ZAP_HASHBITS		28
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    47
#define	MZAP_ENT_LEN		64
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    48
#define	MZAP_NAME_LEN		(MZAP_ENT_LEN - 8 - 4 - 2)
1491
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
    49
#define	MZAP_MAX_BLKSHIFT	SPA_MAXBLOCKSHIFT
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    50
#define	MZAP_MAX_BLKSZ		(1 << MZAP_MAX_BLKSHIFT)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    51
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    52
typedef struct mzap_ent_phys {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    53
	uint64_t mze_value;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    54
	uint32_t mze_cd;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    55
	uint16_t mze_pad;	/* in case we want to chain them someday */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    56
	char mze_name[MZAP_NAME_LEN];
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    57
} mzap_ent_phys_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    58
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    59
typedef struct mzap_phys {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    60
	uint64_t mz_block_type;	/* ZBT_MICRO */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    61
	uint64_t mz_salt;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    62
	uint64_t mz_pad[6];
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    63
	mzap_ent_phys_t mz_chunk[1];
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    64
	/* actually variable size depending on block size */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    65
} mzap_phys_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    66
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    67
typedef struct mzap_ent {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    68
	avl_node_t mze_node;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    69
	int mze_chunkid;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    70
	uint64_t mze_hash;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    71
	mzap_ent_phys_t mze_phys;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    72
} mzap_ent_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    73
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    74
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    75
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    76
 * The (fat) zap is stored in one object. It is an array of
1491
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
    77
 * 1<<FZAP_BLOCK_SHIFT byte blocks. The layout looks like one of:
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    78
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    79
 * ptrtbl fits in first block:
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    80
 * 	[zap_phys_t zap_ptrtbl_shift < 6] [zap_leaf_t] ...
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    81
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    82
 * ptrtbl too big for first block:
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    83
 * 	[zap_phys_t zap_ptrtbl_shift >= 6] [zap_leaf_t] [ptrtbl] ...
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    84
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    85
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    86
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    87
struct dmu_buf;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    88
struct zap_leaf;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    89
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    90
#define	ZBT_LEAF		((1ULL << 63) + 0)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    91
#define	ZBT_HEADER		((1ULL << 63) + 1)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    92
#define	ZBT_MICRO		((1ULL << 63) + 3)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    93
/* any other values are ptrtbl blocks */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    94
1491
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
    95
/*
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
    96
 * the embedded pointer table takes up half a block:
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
    97
 * block size / entry size (2^3) / 2
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
    98
 */
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
    99
#define	ZAP_EMBEDDED_PTRTBL_SHIFT(zap) (FZAP_BLOCK_SHIFT(zap) - 3 - 1)
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
   100
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
   101
/*
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
   102
 * The embedded pointer table starts half-way through the block.  Since
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
   103
 * the pointer table itself is half the block, it starts at (64-bit)
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
   104
 * word number (1<<ZAP_EMBEDDED_PTRTBL_SHIFT(zap)).
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
   105
 */
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
   106
#define	ZAP_EMBEDDED_PTRTBL_ENT(zap, idx) \
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
   107
	((uint64_t *)(zap)->zap_f.zap_phys) \
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
   108
	[(idx) + (1<<ZAP_EMBEDDED_PTRTBL_SHIFT(zap))]
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   109
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   110
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   111
 * TAKE NOTE:
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   112
 * If zap_phys_t is modified, zap_byteswap() must be modified.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   113
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   114
typedef struct zap_phys {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   115
	uint64_t zap_block_type;	/* ZBT_HEADER */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   116
	uint64_t zap_magic;		/* ZAP_MAGIC */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   117
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   118
	struct zap_table_phys {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   119
		uint64_t zt_blk;	/* starting block number */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   120
		uint64_t zt_numblks;	/* number of blocks */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   121
		uint64_t zt_shift;	/* bits to index it */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   122
		uint64_t zt_nextblk;	/* next (larger) copy start block */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   123
		uint64_t zt_blks_copied; /* number source blocks copied */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   124
	} zap_ptrtbl;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   125
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   126
	uint64_t zap_freeblk;		/* the next free block */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   127
	uint64_t zap_num_leafs;		/* number of leafs */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   128
	uint64_t zap_num_entries;	/* number of entries */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   129
	uint64_t zap_salt;		/* salt to stir into hash function */
1491
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
   130
	/*
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
   131
	 * This structure is followed by padding, and then the embedded
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
   132
	 * pointer table.  The embedded pointer table takes up second
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
   133
	 * half of the block.  It is accessed using the
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
   134
	 * ZAP_EMBEDDED_PTRTBL_ENT() macro.
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
   135
	 */
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   136
} zap_phys_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   137
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   138
typedef struct zap_table_phys zap_table_phys_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   139
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   140
typedef struct zap {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   141
	objset_t *zap_objset;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   142
	uint64_t zap_object;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   143
	struct dmu_buf *zap_dbuf;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   144
	krwlock_t zap_rwlock;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   145
	int zap_ismicro;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   146
	uint64_t zap_salt;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   147
	union {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   148
		struct {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   149
			zap_phys_t *zap_phys;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   150
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   151
			/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   152
			 * zap_num_entries_mtx protects
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   153
			 * zap_num_entries
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   154
			 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   155
			kmutex_t zap_num_entries_mtx;
1491
bdcb30e07e7d 6389368 fat zap should use 16k blocks (with backwards compatability)
ahrens
parents: 885
diff changeset
   156
			int zap_block_shift;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   157
		} zap_fat;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   158
		struct {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   159
			mzap_phys_t *zap_phys;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   160
			int16_t zap_num_entries;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   161
			int16_t zap_num_chunks;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   162
			int16_t zap_alloc_next;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   163
			avl_tree_t zap_avl;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   164
		} zap_micro;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   165
	} zap_u;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   166
} zap_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   167
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   168
#define	zap_f	zap_u.zap_fat
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   169
#define	zap_m	zap_u.zap_micro
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   170
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   171
uint64_t zap_hash(zap_t *zap, const char *name);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   172
int zap_lockdir(objset_t *os, uint64_t obj, dmu_tx_t *tx,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   173
    krw_t lti, int fatreader, zap_t **zapp);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   174
void zap_unlockdir(zap_t *zap);
2641
967ea438b194 6462174 zap_update() likes to return 0
ahrens
parents: 1578
diff changeset
   175
void zap_evict(dmu_buf_t *db, void *vmzap);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   176
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   177
#define	ZAP_HASH_IDX(hash, n) (((n) == 0) ? 0 : ((hash) >> (64 - (n))))
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   178
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   179
void fzap_byteswap(void *buf, size_t size);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   180
int fzap_count(zap_t *zap, uint64_t *count);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   181
int fzap_lookup(zap_t *zap, const char *name,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   182
    uint64_t integer_size, uint64_t num_integers, void *buf);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   183
int fzap_add(zap_t *zap, const char *name,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   184
    uint64_t integer_size, uint64_t num_integers,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   185
    const void *val, dmu_tx_t *tx);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   186
int fzap_update(zap_t *zap, const char *name,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   187
    int integer_size, uint64_t num_integers, const void *val, dmu_tx_t *tx);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   188
int fzap_length(zap_t *zap, const char *name,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   189
    uint64_t *integer_size, uint64_t *num_integers);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   190
int fzap_remove(zap_t *zap, const char *name, dmu_tx_t *tx);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   191
int fzap_cursor_retrieve(zap_t *zap, zap_cursor_t *zc, zap_attribute_t *za);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   192
void fzap_get_stats(zap_t *zap, zap_stats_t *zs);
885
d925b21dba78 6347493 tar of 25K empty directory entries in ZFS takes 30+ seconds ...
ahrens
parents: 789
diff changeset
   193
void zap_put_leaf(struct zap_leaf *l);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   194
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   195
int fzap_add_cd(zap_t *zap, const char *name,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   196
    uint64_t integer_size, uint64_t num_integers,
1544
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1491
diff changeset
   197
    const void *val, uint32_t cd, dmu_tx_t *tx);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   198
void fzap_upgrade(zap_t *zap, dmu_tx_t *tx);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   199
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   200
#ifdef	__cplusplus
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   201
}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   202
#endif
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   203
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   204
#endif /* _SYS_ZAP_IMPL_H */