usr/src/uts/common/fs/zfs/sys/dmu_traverse.h
author eschrock
Fri, 03 Mar 2006 20:08:16 -0800
changeset 1544 938876158511
parent 789 b348f31ed315
child 1732 9e3ae798af31
permissions -rw-r--r--
PSARC 2006/077 zpool clear PSARC 2006/139 FMA for ZFS 6284889 arc should replace the znode cache 6333006 DMU & DSL should not panic upon I/O error 6333092 concurrent reads to a file not scaling with number of readers 6338081 ZFS/FMA phase 1 6338386 need persistent error log 6341326 i/o error causes arc buf hash table corruption 6341639 zfs backup/restore should compute/verify checksum of backup stream 6348002 out of space due to changing properties 6354724 inaccurate error message from zfs restore 6354872 dmu_sync() blows predictive accounting 6355416 zpool scrubbing consumes all memory, system hung 6363995 df should only load libzfs when it encounters a ZFS filesystem 6366320 zfs backup/restore doesn't like signals 6368892 mount -m support needed for legacy mounts 6368902 boot archive fstat support needed for ZFS Mountroot 6369424 BFU complains when bfu'ing a ZFS root filesystem 6374062 mountroot support needed for ZFS 6376356 dirtying dbuf obj=43 lvl=0 blkid=0 but not tx_held 6378391 unused members of dmu_objset_stats_t 6378392 clean up zfs_cmd_t structure 6378685 buf_init should allocate its hash table more carefully 6378976 ziltest should be a first class citizen 6381086 zdb segfaults if there is a spa deferred-free bplist 6381203 deadlock due to i/o while assigning (tc_lock held) 6381209 freed space is not immediately available 6381344 'zpool clear' 6381345 FAULTED devices should really be UNAVAIL 6381346 import should mark devices as persistently unavailable 6383272 recursive mutex_enter() during log replay with zfs root 6386326 origin property is not displayed 6386354 libzfs does too much in its _init section, calls exit(1) 6386624 zpool should not complain about non-existent devices from libdiskmgt 6386910 spa needs to be i/o error hardened 6387735 need a mechanism to inject faults into ZFS 6387736 internal ZFS utilities should be placed in an ON-private package 6389928 libzfs should ship a lint library 6390609 malformed vdev config panics on zpool_create() 6390677 version number checking makes upgrades challenging 6390713 ztest hangs in zil_suspend() 6391873 metadata compression should be turned back on 6392113 ztest sometimes reports leaked blocks because ZIL isn't resilvered 6393004 minor memory leak in unique_insert()
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
1544
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 789
diff changeset
     5
 * Common Development and Distribution License (the "License").
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 789
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
/*
1544
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 789
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_DMU_TRAVERSE_H
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    27
#define	_SYS_DMU_TRAVERSE_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/zfs_context.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    32
#include <sys/spa.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    33
#include <sys/zio.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    34
#include <sys/dmu.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    35
#include <sys/dnode.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    36
#include <sys/arc.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    37
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    38
#ifdef	__cplusplus
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    39
extern "C" {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    40
#endif
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    41
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    42
#define	ADVANCE_POST	0		/* post-order traversal */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    43
#define	ADVANCE_PRE	0x01		/* pre-order traversal */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    44
#define	ADVANCE_PRUNE	0x02		/* prune by prev snapshot birth time */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    45
#define	ADVANCE_DATA	0x04		/* read user data blocks */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    46
#define	ADVANCE_HOLES	0x08		/* visit holes */
1544
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 789
diff changeset
    47
#define	ADVANCE_ZIL	0x10		/* visit intent log blocks */
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 789
diff changeset
    48
#define	ADVANCE_NOLOCK	0x20		/* Don't grab SPA sync lock */
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    49
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    50
#define	ZB_NO_LEVEL	-2
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    51
#define	ZB_MAXLEVEL	32		/* Next power of 2 >= DN_MAX_LEVELS */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    52
#define	ZB_MAXBLKID	(1ULL << 62)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    53
#define	ZB_MAXOBJSET	(1ULL << 62)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    54
#define	ZB_MAXOBJECT	(1ULL << 62)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    55
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    56
#define	ZB_MOS_CACHE	0
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    57
#define	ZB_MDN_CACHE	1
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    58
#define	ZB_DN_CACHE	2
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    59
#define	ZB_DEPTH	3
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    60
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    61
typedef struct zseg {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    62
	uint64_t	seg_mintxg;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    63
	uint64_t	seg_maxtxg;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    64
	zbookmark_t	seg_start;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    65
	zbookmark_t	seg_end;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    66
	list_node_t	seg_node;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    67
} zseg_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    68
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    69
typedef struct traverse_blk_cache {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    70
	zbookmark_t	bc_bookmark;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    71
	blkptr_t	bc_blkptr;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    72
	void		*bc_data;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    73
	dnode_phys_t	*bc_dnode;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    74
	int		bc_errno;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    75
	int		bc_pad1;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    76
	uint64_t	bc_pad2;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    77
} traverse_blk_cache_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    78
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    79
typedef int (blkptr_cb_t)(traverse_blk_cache_t *bc, spa_t *spa, void *arg);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    80
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    81
struct traverse_handle {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    82
	spa_t		*th_spa;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    83
	blkptr_cb_t	*th_func;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    84
	void		*th_arg;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    85
	int		th_advance;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    86
	int		th_zio_flags;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    87
	list_t		th_seglist;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    88
	traverse_blk_cache_t th_cache[ZB_DEPTH][ZB_MAXLEVEL];
1544
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 789
diff changeset
    89
	traverse_blk_cache_t th_zil_cache;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    90
	uint64_t	th_hits;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    91
	uint64_t	th_arc_hits;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    92
	uint64_t	th_reads;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    93
	uint64_t	th_callbacks;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    94
	uint64_t	th_syncs;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    95
	uint64_t	th_restarts;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    96
	zbookmark_t	th_noread;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    97
	zbookmark_t	th_lastcb;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    98
};
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    99
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   100
int traverse_dsl_dataset(struct dsl_dataset *ds, uint64_t txg_start,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   101
    int advance, blkptr_cb_t func, void *arg);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   102
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   103
traverse_handle_t *traverse_init(spa_t *spa, blkptr_cb_t *func, void *arg,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   104
    int advance, int zio_flags);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   105
void traverse_fini(traverse_handle_t *th);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   106
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   107
void traverse_add_dnode(traverse_handle_t *th,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   108
    uint64_t mintxg, uint64_t maxtxg, uint64_t objset, uint64_t object);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   109
void traverse_add_objset(traverse_handle_t *th,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   110
    uint64_t mintxg, uint64_t maxtxg, uint64_t objset);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   111
void traverse_add_pool(traverse_handle_t *th, uint64_t mintxg, uint64_t maxtxg);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   112
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   113
int traverse_more(traverse_handle_t *th);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   114
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   115
#ifdef	__cplusplus
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   116
}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   117
#endif
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   118
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   119
#endif /* _SYS_DMU_TRAVERSE_H */