author | George Wilson <George.Wilson@Sun.COM> |
Tue, 16 Mar 2010 00:09:25 -0700 | |
changeset 11932 | 197b866a8e44 |
parent 10922 | e2081f502306 |
child 12470 | 54258108784b |
permissions | -rw-r--r-- |
789 | 1 |
/* |
2 |
* CDDL HEADER START |
|
3 |
* |
|
4 |
* The contents of this file are subject to the terms of the |
|
1544 | 5 |
* Common Development and Distribution License (the "License"). |
6 |
* You may not use this file except in compliance with the License. |
|
789 | 7 |
* |
8 |
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
9 |
* or http://www.opensolaris.org/os/licensing. |
|
10 |
* See the License for the specific language governing permissions |
|
11 |
* and limitations under the License. |
|
12 |
* |
|
13 |
* When distributing Covered Code, include this CDDL HEADER in each |
|
14 |
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
15 |
* If applicable, add the following below this CDDL HEADER, with the |
|
16 |
* fields enclosed by brackets "[]" replaced with your own identifying |
|
17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
|
18 |
* |
|
19 |
* CDDL HEADER END |
|
20 |
*/ |
|
21 |
/* |
|
11932
197b866a8e44
6925762 zios blocked on mutex, holder blocked on read
George Wilson <George.Wilson@Sun.COM>
parents:
10922
diff
changeset
|
22 |
* Copyright 2010 Sun Microsystems, Inc. All rights reserved. |
789 | 23 |
* Use is subject to license terms. |
24 |
*/ |
|
25 |
||
26 |
#ifndef _SYS_BPLIST_H |
|
27 |
#define _SYS_BPLIST_H |
|
28 |
||
29 |
#include <sys/dmu.h> |
|
30 |
#include <sys/spa.h> |
|
31 |
#include <sys/txg.h> |
|
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
32 |
#include <sys/zio.h> |
789 | 33 |
#include <sys/zfs_context.h> |
34 |
||
35 |
#ifdef __cplusplus |
|
36 |
extern "C" { |
|
37 |
#endif |
|
38 |
||
39 |
typedef struct bplist_phys { |
|
40 |
/* |
|
41 |
* This is the bonus buffer for the dead lists. The object's |
|
42 |
* contents is an array of bpl_entries blkptr_t's, representing |
|
43 |
* a total of bpl_bytes physical space. |
|
44 |
*/ |
|
45 |
uint64_t bpl_entries; |
|
46 |
uint64_t bpl_bytes; |
|
2082 | 47 |
uint64_t bpl_comp; |
48 |
uint64_t bpl_uncomp; |
|
789 | 49 |
} bplist_phys_t; |
50 |
||
2082 | 51 |
#define BPLIST_SIZE_V0 (2 * sizeof (uint64_t)) |
52 |
||
789 | 53 |
typedef struct bplist_q { |
54 |
blkptr_t bpq_blk; |
|
11932
197b866a8e44
6925762 zios blocked on mutex, holder blocked on read
George Wilson <George.Wilson@Sun.COM>
parents:
10922
diff
changeset
|
55 |
list_node_t bpq_node; |
789 | 56 |
} bplist_q_t; |
57 |
||
58 |
typedef struct bplist { |
|
59 |
kmutex_t bpl_lock; |
|
60 |
objset_t *bpl_mos; |
|
61 |
uint64_t bpl_object; |
|
2082 | 62 |
uint8_t bpl_blockshift; |
63 |
uint8_t bpl_bpshift; |
|
64 |
uint8_t bpl_havecomp; |
|
11932
197b866a8e44
6925762 zios blocked on mutex, holder blocked on read
George Wilson <George.Wilson@Sun.COM>
parents:
10922
diff
changeset
|
65 |
kmutex_t bpl_q_lock; |
197b866a8e44
6925762 zios blocked on mutex, holder blocked on read
George Wilson <George.Wilson@Sun.COM>
parents:
10922
diff
changeset
|
66 |
list_t bpl_queue; |
789 | 67 |
bplist_phys_t *bpl_phys; |
68 |
dmu_buf_t *bpl_dbuf; |
|
69 |
dmu_buf_t *bpl_cached_dbuf; |
|
70 |
} bplist_t; |
|
71 |
||
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
72 |
typedef void bplist_sync_cb_t(void *arg, const blkptr_t *bp, dmu_tx_t *tx); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
73 |
|
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
74 |
extern void bplist_init(bplist_t *bpl); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
75 |
extern void bplist_fini(bplist_t *bpl); |
789 | 76 |
extern uint64_t bplist_create(objset_t *mos, int blocksize, dmu_tx_t *tx); |
77 |
extern void bplist_destroy(objset_t *mos, uint64_t object, dmu_tx_t *tx); |
|
1544 | 78 |
extern int bplist_open(bplist_t *bpl, objset_t *mos, uint64_t object); |
789 | 79 |
extern void bplist_close(bplist_t *bpl); |
80 |
extern boolean_t bplist_empty(bplist_t *bpl); |
|
81 |
extern int bplist_iterate(bplist_t *bpl, uint64_t *itorp, blkptr_t *bp); |
|
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
2082
diff
changeset
|
82 |
extern int bplist_enqueue(bplist_t *bpl, const blkptr_t *bp, dmu_tx_t *tx); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
83 |
extern void bplist_enqueue_cb(void *bpl, const blkptr_t *bp, dmu_tx_t *tx); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
2082
diff
changeset
|
84 |
extern void bplist_enqueue_deferred(bplist_t *bpl, const blkptr_t *bp); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
85 |
extern void bplist_sync(bplist_t *bpl, bplist_sync_cb_t *func, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
86 |
void *arg, dmu_tx_t *tx); |
789 | 87 |
extern void bplist_vacate(bplist_t *bpl, dmu_tx_t *tx); |
2082 | 88 |
extern int bplist_space(bplist_t *bpl, |
89 |
uint64_t *usedp, uint64_t *compp, uint64_t *uncompp); |
|
7390
6d408f0a5fbd
PSARC/2008/518 ZFS space accounting enhancements
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
90 |
extern int bplist_space_birthrange(bplist_t *bpl, |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7390
diff
changeset
|
91 |
uint64_t mintxg, uint64_t maxtxg, uint64_t *dsizep); |
789 | 92 |
|
93 |
#ifdef __cplusplus |
|
94 |
} |
|
95 |
#endif |
|
96 |
||
97 |
#endif /* _SYS_BPLIST_H */ |