4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
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.
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]
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 * Copyright (c) 2013 by Delphix. All rights reserved.
28 #include <sys/dmu_impl.h>
30 #include <sys/dmu_tx.h>
31 #include <sys/dmu_objset.h>
32 #include <sys/dsl_dataset.h> /* for dsl_dataset_block_freeable() */
33 #include <sys/dsl_dir.h> /* for dsl_dir_tempreserve_*() */
34 #include <sys/dsl_pool.h>
35 #include <sys/zap_impl.h> /* for fzap_default_block_shift */
38 #include <sys/sa_impl.h>
39 #include <sys/zfs_context.h>
40 #include <sys/varargs.h>
42 typedef void (*dmu_tx_hold_func_t
)(dmu_tx_t
*tx
, struct dnode
*dn
,
43 uint64_t arg1
, uint64_t arg2
);
45 dmu_tx_stats_t dmu_tx_stats
= {
46 { "dmu_tx_assigned", KSTAT_DATA_UINT64
},
47 { "dmu_tx_delay", KSTAT_DATA_UINT64
},
48 { "dmu_tx_error", KSTAT_DATA_UINT64
},
49 { "dmu_tx_suspended", KSTAT_DATA_UINT64
},
50 { "dmu_tx_group", KSTAT_DATA_UINT64
},
51 { "dmu_tx_how", KSTAT_DATA_UINT64
},
52 { "dmu_tx_memory_reserve", KSTAT_DATA_UINT64
},
53 { "dmu_tx_memory_reclaim", KSTAT_DATA_UINT64
},
54 { "dmu_tx_memory_inflight", KSTAT_DATA_UINT64
},
55 { "dmu_tx_dirty_throttle", KSTAT_DATA_UINT64
},
56 { "dmu_tx_write_limit", KSTAT_DATA_UINT64
},
57 { "dmu_tx_quota", KSTAT_DATA_UINT64
},
60 static kstat_t
*dmu_tx_ksp
;
63 dmu_tx_create_dd(dsl_dir_t
*dd
)
65 dmu_tx_t
*tx
= kmem_zalloc(sizeof (dmu_tx_t
), KM_PUSHPAGE
);
68 tx
->tx_pool
= dd
->dd_pool
;
69 list_create(&tx
->tx_holds
, sizeof (dmu_tx_hold_t
),
70 offsetof(dmu_tx_hold_t
, txh_node
));
71 list_create(&tx
->tx_callbacks
, sizeof (dmu_tx_callback_t
),
72 offsetof(dmu_tx_callback_t
, dcb_node
));
74 refcount_create(&tx
->tx_space_written
);
75 refcount_create(&tx
->tx_space_freed
);
81 dmu_tx_create(objset_t
*os
)
83 dmu_tx_t
*tx
= dmu_tx_create_dd(os
->os_dsl_dataset
->ds_dir
);
85 tx
->tx_lastsnap_txg
= dsl_dataset_prev_snap_txg(os
->os_dsl_dataset
);
90 dmu_tx_create_assigned(struct dsl_pool
*dp
, uint64_t txg
)
92 dmu_tx_t
*tx
= dmu_tx_create_dd(NULL
);
94 ASSERT3U(txg
, <=, dp
->dp_tx
.tx_open_txg
);
103 dmu_tx_is_syncing(dmu_tx_t
*tx
)
105 return (tx
->tx_anyobj
);
109 dmu_tx_private_ok(dmu_tx_t
*tx
)
111 return (tx
->tx_anyobj
);
114 static dmu_tx_hold_t
*
115 dmu_tx_hold_object_impl(dmu_tx_t
*tx
, objset_t
*os
, uint64_t object
,
116 enum dmu_tx_hold_type type
, uint64_t arg1
, uint64_t arg2
)
122 if (object
!= DMU_NEW_OBJECT
) {
123 err
= dnode_hold(os
, object
, tx
, &dn
);
129 if (err
== 0 && tx
->tx_txg
!= 0) {
130 mutex_enter(&dn
->dn_mtx
);
132 * dn->dn_assigned_txg == tx->tx_txg doesn't pose a
133 * problem, but there's no way for it to happen (for
136 ASSERT(dn
->dn_assigned_txg
== 0);
137 dn
->dn_assigned_txg
= tx
->tx_txg
;
138 (void) refcount_add(&dn
->dn_tx_holds
, tx
);
139 mutex_exit(&dn
->dn_mtx
);
143 txh
= kmem_zalloc(sizeof (dmu_tx_hold_t
), KM_PUSHPAGE
);
147 txh
->txh_type
= type
;
148 txh
->txh_arg1
= arg1
;
149 txh
->txh_arg2
= arg2
;
151 list_insert_tail(&tx
->tx_holds
, txh
);
157 dmu_tx_add_new_object(dmu_tx_t
*tx
, objset_t
*os
, uint64_t object
)
160 * If we're syncing, they can manipulate any object anyhow, and
161 * the hold on the dnode_t can cause problems.
163 if (!dmu_tx_is_syncing(tx
)) {
164 (void) dmu_tx_hold_object_impl(tx
, os
,
165 object
, THT_NEWOBJECT
, 0, 0);
170 dmu_tx_check_ioerr(zio_t
*zio
, dnode_t
*dn
, int level
, uint64_t blkid
)
175 rw_enter(&dn
->dn_struct_rwlock
, RW_READER
);
176 db
= dbuf_hold_level(dn
, level
, blkid
, FTAG
);
177 rw_exit(&dn
->dn_struct_rwlock
);
179 return (SET_ERROR(EIO
));
180 err
= dbuf_read(db
, zio
, DB_RF_CANFAIL
| DB_RF_NOPREFETCH
);
186 dmu_tx_count_twig(dmu_tx_hold_t
*txh
, dnode_t
*dn
, dmu_buf_impl_t
*db
,
187 int level
, uint64_t blkid
, boolean_t freeable
, uint64_t *history
)
189 objset_t
*os
= dn
->dn_objset
;
190 dsl_dataset_t
*ds
= os
->os_dsl_dataset
;
191 int epbs
= dn
->dn_indblkshift
- SPA_BLKPTRSHIFT
;
192 dmu_buf_impl_t
*parent
= NULL
;
196 if (level
>= dn
->dn_nlevels
|| history
[level
] == blkid
)
199 history
[level
] = blkid
;
201 space
= (level
== 0) ? dn
->dn_datablksz
: (1ULL << dn
->dn_indblkshift
);
203 if (db
== NULL
|| db
== dn
->dn_dbuf
) {
207 ASSERT(DB_DNODE(db
) == dn
);
208 ASSERT(db
->db_level
== level
);
209 ASSERT(db
->db
.db_size
== space
);
210 ASSERT(db
->db_blkid
== blkid
);
212 parent
= db
->db_parent
;
215 freeable
= (bp
&& (freeable
||
216 dsl_dataset_block_freeable(ds
, bp
, bp
->blk_birth
)));
219 txh
->txh_space_tooverwrite
+= space
;
221 txh
->txh_space_towrite
+= space
;
223 txh
->txh_space_tounref
+= bp_get_dsize(os
->os_spa
, bp
);
225 dmu_tx_count_twig(txh
, dn
, parent
, level
+ 1,
226 blkid
>> epbs
, freeable
, history
);
231 dmu_tx_count_write(dmu_tx_hold_t
*txh
, uint64_t off
, uint64_t len
)
233 dnode_t
*dn
= txh
->txh_dnode
;
234 uint64_t start
, end
, i
;
235 int min_bs
, max_bs
, min_ibs
, max_ibs
, epbs
, bits
;
242 min_bs
= SPA_MINBLOCKSHIFT
;
243 max_bs
= SPA_MAXBLOCKSHIFT
;
244 min_ibs
= DN_MIN_INDBLKSHIFT
;
245 max_ibs
= DN_MAX_INDBLKSHIFT
;
248 uint64_t history
[DN_MAX_LEVELS
];
249 int nlvls
= dn
->dn_nlevels
;
253 * For i/o error checking, read the first and last level-0
254 * blocks (if they are not aligned), and all the level-1 blocks.
256 if (dn
->dn_maxblkid
== 0) {
257 delta
= dn
->dn_datablksz
;
258 start
= (off
< dn
->dn_datablksz
) ? 0 : 1;
259 end
= (off
+len
<= dn
->dn_datablksz
) ? 0 : 1;
260 if (start
== 0 && (off
> 0 || len
< dn
->dn_datablksz
)) {
261 err
= dmu_tx_check_ioerr(NULL
, dn
, 0, 0);
267 zio_t
*zio
= zio_root(dn
->dn_objset
->os_spa
,
268 NULL
, NULL
, ZIO_FLAG_CANFAIL
);
270 /* first level-0 block */
271 start
= off
>> dn
->dn_datablkshift
;
272 if (P2PHASE(off
, dn
->dn_datablksz
) ||
273 len
< dn
->dn_datablksz
) {
274 err
= dmu_tx_check_ioerr(zio
, dn
, 0, start
);
279 /* last level-0 block */
280 end
= (off
+len
-1) >> dn
->dn_datablkshift
;
281 if (end
!= start
&& end
<= dn
->dn_maxblkid
&&
282 P2PHASE(off
+len
, dn
->dn_datablksz
)) {
283 err
= dmu_tx_check_ioerr(zio
, dn
, 0, end
);
290 int shft
= dn
->dn_indblkshift
- SPA_BLKPTRSHIFT
;
291 for (i
= (start
>>shft
)+1; i
< end
>>shft
; i
++) {
292 err
= dmu_tx_check_ioerr(zio
, dn
, 1, i
);
301 delta
= P2NPHASE(off
, dn
->dn_datablksz
);
304 min_ibs
= max_ibs
= dn
->dn_indblkshift
;
305 if (dn
->dn_maxblkid
> 0) {
307 * The blocksize can't change,
308 * so we can make a more precise estimate.
310 ASSERT(dn
->dn_datablkshift
!= 0);
311 min_bs
= max_bs
= dn
->dn_datablkshift
;
315 * If this write is not off the end of the file
316 * we need to account for overwrites/unref.
318 if (start
<= dn
->dn_maxblkid
) {
319 for (l
= 0; l
< DN_MAX_LEVELS
; l
++)
322 while (start
<= dn
->dn_maxblkid
) {
325 rw_enter(&dn
->dn_struct_rwlock
, RW_READER
);
326 err
= dbuf_hold_impl(dn
, 0, start
, FALSE
, FTAG
, &db
);
327 rw_exit(&dn
->dn_struct_rwlock
);
330 txh
->txh_tx
->tx_err
= err
;
334 dmu_tx_count_twig(txh
, dn
, db
, 0, start
, B_FALSE
,
339 * Account for new indirects appearing
340 * before this IO gets assigned into a txg.
343 epbs
= min_ibs
- SPA_BLKPTRSHIFT
;
344 for (bits
-= epbs
* (nlvls
- 1);
345 bits
>= 0; bits
-= epbs
)
346 txh
->txh_fudge
+= 1ULL << max_ibs
;
352 delta
= dn
->dn_datablksz
;
357 * 'end' is the last thing we will access, not one past.
358 * This way we won't overflow when accessing the last byte.
360 start
= P2ALIGN(off
, 1ULL << max_bs
);
361 end
= P2ROUNDUP(off
+ len
, 1ULL << max_bs
) - 1;
362 txh
->txh_space_towrite
+= end
- start
+ 1;
367 epbs
= min_ibs
- SPA_BLKPTRSHIFT
;
370 * The object contains at most 2^(64 - min_bs) blocks,
371 * and each indirect level maps 2^epbs.
373 for (bits
= 64 - min_bs
; bits
>= 0; bits
-= epbs
) {
376 ASSERT3U(end
, >=, start
);
377 txh
->txh_space_towrite
+= (end
- start
+ 1) << max_ibs
;
380 * We also need a new blkid=0 indirect block
381 * to reference any existing file data.
383 txh
->txh_space_towrite
+= 1ULL << max_ibs
;
388 if (txh
->txh_space_towrite
+ txh
->txh_space_tooverwrite
>
390 err
= SET_ERROR(EFBIG
);
393 txh
->txh_tx
->tx_err
= err
;
397 dmu_tx_count_dnode(dmu_tx_hold_t
*txh
)
399 dnode_t
*dn
= txh
->txh_dnode
;
400 dnode_t
*mdn
= DMU_META_DNODE(txh
->txh_tx
->tx_objset
);
401 uint64_t space
= mdn
->dn_datablksz
+
402 ((mdn
->dn_nlevels
-1) << mdn
->dn_indblkshift
);
404 if (dn
&& dn
->dn_dbuf
->db_blkptr
&&
405 dsl_dataset_block_freeable(dn
->dn_objset
->os_dsl_dataset
,
406 dn
->dn_dbuf
->db_blkptr
, dn
->dn_dbuf
->db_blkptr
->blk_birth
)) {
407 txh
->txh_space_tooverwrite
+= space
;
408 txh
->txh_space_tounref
+= space
;
410 txh
->txh_space_towrite
+= space
;
411 if (dn
&& dn
->dn_dbuf
->db_blkptr
)
412 txh
->txh_space_tounref
+= space
;
417 dmu_tx_hold_write(dmu_tx_t
*tx
, uint64_t object
, uint64_t off
, int len
)
421 ASSERT(tx
->tx_txg
== 0);
422 ASSERT(len
< DMU_MAX_ACCESS
);
423 ASSERT(len
== 0 || UINT64_MAX
- off
>= len
- 1);
425 txh
= dmu_tx_hold_object_impl(tx
, tx
->tx_objset
,
426 object
, THT_WRITE
, off
, len
);
430 dmu_tx_count_write(txh
, off
, len
);
431 dmu_tx_count_dnode(txh
);
435 dmu_tx_count_free(dmu_tx_hold_t
*txh
, uint64_t off
, uint64_t len
)
437 uint64_t blkid
, nblks
, lastblk
;
438 uint64_t space
= 0, unref
= 0, skipped
= 0;
439 dnode_t
*dn
= txh
->txh_dnode
;
440 dsl_dataset_t
*ds
= dn
->dn_objset
->os_dsl_dataset
;
441 spa_t
*spa
= txh
->txh_tx
->tx_pool
->dp_spa
;
443 uint64_t l0span
= 0, nl1blks
= 0;
445 if (dn
->dn_nlevels
== 0)
449 * The struct_rwlock protects us against dn_nlevels
450 * changing, in case (against all odds) we manage to dirty &
451 * sync out the changes after we check for being dirty.
452 * Also, dbuf_hold_impl() wants us to have the struct_rwlock.
454 rw_enter(&dn
->dn_struct_rwlock
, RW_READER
);
455 epbs
= dn
->dn_indblkshift
- SPA_BLKPTRSHIFT
;
456 if (dn
->dn_maxblkid
== 0) {
457 if (off
== 0 && len
>= dn
->dn_datablksz
) {
461 rw_exit(&dn
->dn_struct_rwlock
);
465 blkid
= off
>> dn
->dn_datablkshift
;
466 nblks
= (len
+ dn
->dn_datablksz
- 1) >> dn
->dn_datablkshift
;
468 if (blkid
> dn
->dn_maxblkid
) {
469 rw_exit(&dn
->dn_struct_rwlock
);
472 if (blkid
+ nblks
> dn
->dn_maxblkid
)
473 nblks
= dn
->dn_maxblkid
- blkid
+ 1;
476 l0span
= nblks
; /* save for later use to calc level > 1 overhead */
477 if (dn
->dn_nlevels
== 1) {
479 for (i
= 0; i
< nblks
; i
++) {
480 blkptr_t
*bp
= dn
->dn_phys
->dn_blkptr
;
481 ASSERT3U(blkid
+ i
, <, dn
->dn_nblkptr
);
483 if (dsl_dataset_block_freeable(ds
, bp
, bp
->blk_birth
)) {
484 dprintf_bp(bp
, "can free old%s", "");
485 space
+= bp_get_dsize(spa
, bp
);
487 unref
+= BP_GET_ASIZE(bp
);
493 lastblk
= blkid
+ nblks
- 1;
495 dmu_buf_impl_t
*dbuf
;
496 uint64_t ibyte
, new_blkid
;
498 int err
, i
, blkoff
, tochk
;
501 ibyte
= blkid
<< dn
->dn_datablkshift
;
502 err
= dnode_next_offset(dn
,
503 DNODE_FIND_HAVELOCK
, &ibyte
, 2, 1, 0);
504 new_blkid
= ibyte
>> dn
->dn_datablkshift
;
506 skipped
+= (lastblk
>> epbs
) - (blkid
>> epbs
) + 1;
510 txh
->txh_tx
->tx_err
= err
;
513 if (new_blkid
> lastblk
) {
514 skipped
+= (lastblk
>> epbs
) - (blkid
>> epbs
) + 1;
518 if (new_blkid
> blkid
) {
519 ASSERT((new_blkid
>> epbs
) > (blkid
>> epbs
));
520 skipped
+= (new_blkid
>> epbs
) - (blkid
>> epbs
) - 1;
521 nblks
-= new_blkid
- blkid
;
524 blkoff
= P2PHASE(blkid
, epb
);
525 tochk
= MIN(epb
- blkoff
, nblks
);
527 err
= dbuf_hold_impl(dn
, 1, blkid
>> epbs
, FALSE
, FTAG
, &dbuf
);
529 txh
->txh_tx
->tx_err
= err
;
533 txh
->txh_memory_tohold
+= dbuf
->db
.db_size
;
536 * We don't check memory_tohold against DMU_MAX_ACCESS because
537 * memory_tohold is an over-estimation (especially the >L1
538 * indirect blocks), so it could fail. Callers should have
539 * already verified that they will not be holding too much
543 err
= dbuf_read(dbuf
, NULL
, DB_RF_HAVESTRUCT
| DB_RF_CANFAIL
);
545 txh
->txh_tx
->tx_err
= err
;
546 dbuf_rele(dbuf
, FTAG
);
550 bp
= dbuf
->db
.db_data
;
553 for (i
= 0; i
< tochk
; i
++) {
554 if (dsl_dataset_block_freeable(ds
, &bp
[i
],
556 dprintf_bp(&bp
[i
], "can free old%s", "");
557 space
+= bp_get_dsize(spa
, &bp
[i
]);
559 unref
+= BP_GET_ASIZE(bp
);
561 dbuf_rele(dbuf
, FTAG
);
567 rw_exit(&dn
->dn_struct_rwlock
);
570 * Add in memory requirements of higher-level indirects.
571 * This assumes a worst-possible scenario for dn_nlevels and a
572 * worst-possible distribution of l1-blocks over the region to free.
575 uint64_t blkcnt
= 1 + ((l0span
>> epbs
) >> epbs
);
578 * Here we don't use DN_MAX_LEVEL, but calculate it with the
579 * given datablkshift and indblkshift. This makes the
580 * difference between 19 and 8 on large files.
582 int maxlevel
= 2 + (DN_MAX_OFFSET_SHIFT
- dn
->dn_datablkshift
) /
583 (dn
->dn_indblkshift
- SPA_BLKPTRSHIFT
);
585 while (level
++ < maxlevel
) {
586 txh
->txh_memory_tohold
+= MAX(MIN(blkcnt
, nl1blks
), 1)
587 << dn
->dn_indblkshift
;
588 blkcnt
= 1 + (blkcnt
>> epbs
);
592 /* account for new level 1 indirect blocks that might show up */
594 txh
->txh_fudge
+= skipped
<< dn
->dn_indblkshift
;
595 skipped
= MIN(skipped
, DMU_MAX_DELETEBLKCNT
>> epbs
);
596 txh
->txh_memory_tohold
+= skipped
<< dn
->dn_indblkshift
;
598 txh
->txh_space_tofree
+= space
;
599 txh
->txh_space_tounref
+= unref
;
603 dmu_tx_hold_free(dmu_tx_t
*tx
, uint64_t object
, uint64_t off
, uint64_t len
)
610 ASSERT(tx
->tx_txg
== 0);
612 txh
= dmu_tx_hold_object_impl(tx
, tx
->tx_objset
,
613 object
, THT_FREE
, off
, len
);
618 if (off
>= (dn
->dn_maxblkid
+1) * dn
->dn_datablksz
)
620 if (len
== DMU_OBJECT_END
)
621 len
= (dn
->dn_maxblkid
+1) * dn
->dn_datablksz
- off
;
623 dmu_tx_count_dnode(txh
);
626 * For i/o error checking, we read the first and last level-0
627 * blocks if they are not aligned, and all the level-1 blocks.
629 * Note: dbuf_free_range() assumes that we have not instantiated
630 * any level-0 dbufs that will be completely freed. Therefore we must
631 * exercise care to not read or count the first and last blocks
632 * if they are blocksize-aligned.
634 if (dn
->dn_datablkshift
== 0) {
635 dmu_tx_count_write(txh
, off
, len
);
637 /* first block will be modified if it is not aligned */
638 if (!IS_P2ALIGNED(off
, 1 << dn
->dn_datablkshift
))
639 dmu_tx_count_write(txh
, off
, 1);
640 /* last block will be modified if it is not aligned */
641 if (!IS_P2ALIGNED(off
+ len
, 1 << dn
->dn_datablkshift
))
642 dmu_tx_count_write(txh
, off
+len
, 1);
646 * Check level-1 blocks.
648 if (dn
->dn_nlevels
> 1) {
649 int shift
= dn
->dn_datablkshift
+ dn
->dn_indblkshift
-
651 uint64_t start
= off
>> shift
;
652 uint64_t end
= (off
+ len
) >> shift
;
655 ASSERT(dn
->dn_datablkshift
!= 0);
656 ASSERT(dn
->dn_indblkshift
!= 0);
658 zio
= zio_root(tx
->tx_pool
->dp_spa
,
659 NULL
, NULL
, ZIO_FLAG_CANFAIL
);
660 for (i
= start
; i
<= end
; i
++) {
661 uint64_t ibyte
= i
<< shift
;
662 err
= dnode_next_offset(dn
, 0, &ibyte
, 2, 1, 0);
671 err
= dmu_tx_check_ioerr(zio
, dn
, 1, i
);
684 dmu_tx_count_free(txh
, off
, len
);
688 dmu_tx_hold_zap(dmu_tx_t
*tx
, uint64_t object
, int add
, const char *name
)
695 ASSERT(tx
->tx_txg
== 0);
697 txh
= dmu_tx_hold_object_impl(tx
, tx
->tx_objset
,
698 object
, THT_ZAP
, add
, (uintptr_t)name
);
703 dmu_tx_count_dnode(txh
);
707 * We will be able to fit a new object's entries into one leaf
708 * block. So there will be at most 2 blocks total,
709 * including the header block.
711 dmu_tx_count_write(txh
, 0, 2 << fzap_default_block_shift
);
715 ASSERT3U(DMU_OT_BYTESWAP(dn
->dn_type
), ==, DMU_BSWAP_ZAP
);
717 if (dn
->dn_maxblkid
== 0 && !add
) {
721 * If there is only one block (i.e. this is a micro-zap)
722 * and we are not adding anything, the accounting is simple.
724 err
= dmu_tx_check_ioerr(NULL
, dn
, 0, 0);
731 * Use max block size here, since we don't know how much
732 * the size will change between now and the dbuf dirty call.
734 bp
= &dn
->dn_phys
->dn_blkptr
[0];
735 if (dsl_dataset_block_freeable(dn
->dn_objset
->os_dsl_dataset
,
737 txh
->txh_space_tooverwrite
+= SPA_MAXBLOCKSIZE
;
739 txh
->txh_space_towrite
+= SPA_MAXBLOCKSIZE
;
741 txh
->txh_space_tounref
+= SPA_MAXBLOCKSIZE
;
745 if (dn
->dn_maxblkid
> 0 && name
) {
747 * access the name in this fat-zap so that we'll check
748 * for i/o errors to the leaf blocks, etc.
750 err
= zap_lookup(dn
->dn_objset
, dn
->dn_object
, name
,
758 err
= zap_count_write(dn
->dn_objset
, dn
->dn_object
, name
, add
,
759 &txh
->txh_space_towrite
, &txh
->txh_space_tooverwrite
);
762 * If the modified blocks are scattered to the four winds,
763 * we'll have to modify an indirect twig for each.
765 epbs
= dn
->dn_indblkshift
- SPA_BLKPTRSHIFT
;
766 for (nblocks
= dn
->dn_maxblkid
>> epbs
; nblocks
!= 0; nblocks
>>= epbs
)
767 if (dn
->dn_objset
->os_dsl_dataset
->ds_phys
->ds_prev_snap_obj
)
768 txh
->txh_space_towrite
+= 3 << dn
->dn_indblkshift
;
770 txh
->txh_space_tooverwrite
+= 3 << dn
->dn_indblkshift
;
774 dmu_tx_hold_bonus(dmu_tx_t
*tx
, uint64_t object
)
778 ASSERT(tx
->tx_txg
== 0);
780 txh
= dmu_tx_hold_object_impl(tx
, tx
->tx_objset
,
781 object
, THT_BONUS
, 0, 0);
783 dmu_tx_count_dnode(txh
);
787 dmu_tx_hold_space(dmu_tx_t
*tx
, uint64_t space
)
791 ASSERT(tx
->tx_txg
== 0);
793 txh
= dmu_tx_hold_object_impl(tx
, tx
->tx_objset
,
794 DMU_NEW_OBJECT
, THT_SPACE
, space
, 0);
796 txh
->txh_space_towrite
+= space
;
800 dmu_tx_holds(dmu_tx_t
*tx
, uint64_t object
)
806 * By asserting that the tx is assigned, we're counting the
807 * number of dn_tx_holds, which is the same as the number of
808 * dn_holds. Otherwise, we'd be counting dn_holds, but
809 * dn_tx_holds could be 0.
811 ASSERT(tx
->tx_txg
!= 0);
813 /* if (tx->tx_anyobj == TRUE) */
816 for (txh
= list_head(&tx
->tx_holds
); txh
;
817 txh
= list_next(&tx
->tx_holds
, txh
)) {
818 if (txh
->txh_dnode
&& txh
->txh_dnode
->dn_object
== object
)
827 dmu_tx_dirty_buf(dmu_tx_t
*tx
, dmu_buf_impl_t
*db
)
830 int match_object
= FALSE
, match_offset
= FALSE
;
836 ASSERT(tx
->tx_txg
!= 0);
837 ASSERT(tx
->tx_objset
== NULL
|| dn
->dn_objset
== tx
->tx_objset
);
838 ASSERT3U(dn
->dn_object
, ==, db
->db
.db_object
);
845 /* XXX No checking on the meta dnode for now */
846 if (db
->db
.db_object
== DMU_META_DNODE_OBJECT
) {
851 for (txh
= list_head(&tx
->tx_holds
); txh
;
852 txh
= list_next(&tx
->tx_holds
, txh
)) {
853 ASSERT3U(dn
->dn_assigned_txg
, ==, tx
->tx_txg
);
854 if (txh
->txh_dnode
== dn
&& txh
->txh_type
!= THT_NEWOBJECT
)
856 if (txh
->txh_dnode
== NULL
|| txh
->txh_dnode
== dn
) {
857 int datablkshift
= dn
->dn_datablkshift
?
858 dn
->dn_datablkshift
: SPA_MAXBLOCKSHIFT
;
859 int epbs
= dn
->dn_indblkshift
- SPA_BLKPTRSHIFT
;
860 int shift
= datablkshift
+ epbs
* db
->db_level
;
861 uint64_t beginblk
= shift
>= 64 ? 0 :
862 (txh
->txh_arg1
>> shift
);
863 uint64_t endblk
= shift
>= 64 ? 0 :
864 ((txh
->txh_arg1
+ txh
->txh_arg2
- 1) >> shift
);
865 uint64_t blkid
= db
->db_blkid
;
867 /* XXX txh_arg2 better not be zero... */
869 dprintf("found txh type %x beginblk=%llx endblk=%llx\n",
870 txh
->txh_type
, beginblk
, endblk
);
872 switch (txh
->txh_type
) {
874 if (blkid
>= beginblk
&& blkid
<= endblk
)
877 * We will let this hold work for the bonus
878 * or spill buffer so that we don't need to
879 * hold it when creating a new object.
881 if (blkid
== DMU_BONUS_BLKID
||
882 blkid
== DMU_SPILL_BLKID
)
885 * They might have to increase nlevels,
886 * thus dirtying the new TLIBs. Or the
887 * might have to change the block size,
888 * thus dirying the new lvl=0 blk=0.
895 * We will dirty all the level 1 blocks in
896 * the free range and perhaps the first and
897 * last level 0 block.
899 if (blkid
>= beginblk
&& (blkid
<= endblk
||
900 txh
->txh_arg2
== DMU_OBJECT_END
))
904 if (blkid
== DMU_SPILL_BLKID
)
908 if (blkid
== DMU_BONUS_BLKID
)
918 ASSERT(!"bad txh_type");
921 if (match_object
&& match_offset
) {
927 panic("dirtying dbuf obj=%llx lvl=%u blkid=%llx but not tx_held\n",
928 (u_longlong_t
)db
->db
.db_object
, db
->db_level
,
929 (u_longlong_t
)db
->db_blkid
);
934 dmu_tx_try_assign(dmu_tx_t
*tx
, txg_how_t txg_how
)
937 spa_t
*spa
= tx
->tx_pool
->dp_spa
;
938 uint64_t memory
, asize
, fsize
, usize
;
939 uint64_t towrite
, tofree
, tooverwrite
, tounref
, tohold
, fudge
;
944 DMU_TX_STAT_BUMP(dmu_tx_error
);
948 if (spa_suspended(spa
)) {
949 DMU_TX_STAT_BUMP(dmu_tx_suspended
);
952 * If the user has indicated a blocking failure mode
953 * then return ERESTART which will block in dmu_tx_wait().
954 * Otherwise, return EIO so that an error can get
955 * propagated back to the VOP calls.
957 * Note that we always honor the txg_how flag regardless
958 * of the failuremode setting.
960 if (spa_get_failmode(spa
) == ZIO_FAILURE_MODE_CONTINUE
&&
962 return (SET_ERROR(EIO
));
964 return (SET_ERROR(ERESTART
));
967 tx
->tx_txg
= txg_hold_open(tx
->tx_pool
, &tx
->tx_txgh
);
968 tx
->tx_needassign_txh
= NULL
;
971 * NB: No error returns are allowed after txg_hold_open, but
972 * before processing the dnode holds, due to the
973 * dmu_tx_unassign() logic.
976 towrite
= tofree
= tooverwrite
= tounref
= tohold
= fudge
= 0;
977 for (txh
= list_head(&tx
->tx_holds
); txh
;
978 txh
= list_next(&tx
->tx_holds
, txh
)) {
979 dnode_t
*dn
= txh
->txh_dnode
;
981 mutex_enter(&dn
->dn_mtx
);
982 if (dn
->dn_assigned_txg
== tx
->tx_txg
- 1) {
983 mutex_exit(&dn
->dn_mtx
);
984 tx
->tx_needassign_txh
= txh
;
985 DMU_TX_STAT_BUMP(dmu_tx_group
);
986 return (SET_ERROR(ERESTART
));
988 if (dn
->dn_assigned_txg
== 0)
989 dn
->dn_assigned_txg
= tx
->tx_txg
;
990 ASSERT3U(dn
->dn_assigned_txg
, ==, tx
->tx_txg
);
991 (void) refcount_add(&dn
->dn_tx_holds
, tx
);
992 mutex_exit(&dn
->dn_mtx
);
994 towrite
+= txh
->txh_space_towrite
;
995 tofree
+= txh
->txh_space_tofree
;
996 tooverwrite
+= txh
->txh_space_tooverwrite
;
997 tounref
+= txh
->txh_space_tounref
;
998 tohold
+= txh
->txh_memory_tohold
;
999 fudge
+= txh
->txh_fudge
;
1003 * If a snapshot has been taken since we made our estimates,
1004 * assume that we won't be able to free or overwrite anything.
1006 if (tx
->tx_objset
&&
1007 dsl_dataset_prev_snap_txg(tx
->tx_objset
->os_dsl_dataset
) >
1008 tx
->tx_lastsnap_txg
) {
1009 towrite
+= tooverwrite
;
1010 tooverwrite
= tofree
= 0;
1013 /* needed allocation: worst-case estimate of write space */
1014 asize
= spa_get_asize(tx
->tx_pool
->dp_spa
, towrite
+ tooverwrite
);
1015 /* freed space estimate: worst-case overwrite + free estimate */
1016 fsize
= spa_get_asize(tx
->tx_pool
->dp_spa
, tooverwrite
) + tofree
;
1017 /* convert unrefd space to worst-case estimate */
1018 usize
= spa_get_asize(tx
->tx_pool
->dp_spa
, tounref
);
1019 /* calculate memory footprint estimate */
1020 memory
= towrite
+ tooverwrite
+ tohold
;
1024 * Add in 'tohold' to account for our dirty holds on this memory
1025 * XXX - the "fudge" factor is to account for skipped blocks that
1026 * we missed because dnode_next_offset() misses in-core-only blocks.
1028 tx
->tx_space_towrite
= asize
+
1029 spa_get_asize(tx
->tx_pool
->dp_spa
, tohold
+ fudge
);
1030 tx
->tx_space_tofree
= tofree
;
1031 tx
->tx_space_tooverwrite
= tooverwrite
;
1032 tx
->tx_space_tounref
= tounref
;
1035 if (tx
->tx_dir
&& asize
!= 0) {
1036 int err
= dsl_dir_tempreserve_space(tx
->tx_dir
, memory
,
1037 asize
, fsize
, usize
, &tx
->tx_tempreserve_cookie
, tx
);
1042 DMU_TX_STAT_BUMP(dmu_tx_assigned
);
1048 dmu_tx_unassign(dmu_tx_t
*tx
)
1052 if (tx
->tx_txg
== 0)
1055 txg_rele_to_quiesce(&tx
->tx_txgh
);
1058 * Walk the transaction's hold list, removing the hold on the
1059 * associated dnode, and notifying waiters if the refcount drops to 0.
1061 for (txh
= list_head(&tx
->tx_holds
); txh
!= tx
->tx_needassign_txh
;
1062 txh
= list_next(&tx
->tx_holds
, txh
)) {
1063 dnode_t
*dn
= txh
->txh_dnode
;
1067 mutex_enter(&dn
->dn_mtx
);
1068 ASSERT3U(dn
->dn_assigned_txg
, ==, tx
->tx_txg
);
1070 if (refcount_remove(&dn
->dn_tx_holds
, tx
) == 0) {
1071 dn
->dn_assigned_txg
= 0;
1072 cv_broadcast(&dn
->dn_notxholds
);
1074 mutex_exit(&dn
->dn_mtx
);
1077 txg_rele_to_sync(&tx
->tx_txgh
);
1079 tx
->tx_lasttried_txg
= tx
->tx_txg
;
1084 * Assign tx to a transaction group. txg_how can be one of:
1086 * (1) TXG_WAIT. If the current open txg is full, waits until there's
1087 * a new one. This should be used when you're not holding locks.
1088 * It will only fail if we're truly out of space (or over quota).
1090 * (2) TXG_NOWAIT. If we can't assign into the current open txg without
1091 * blocking, returns immediately with ERESTART. This should be used
1092 * whenever you're holding locks. On an ERESTART error, the caller
1093 * should drop locks, do a dmu_tx_wait(tx), and try again.
1096 dmu_tx_assign(dmu_tx_t
*tx
, txg_how_t txg_how
)
1101 ASSERT(tx
->tx_txg
== 0);
1102 ASSERT(txg_how
== TXG_WAIT
|| txg_how
== TXG_NOWAIT
);
1103 ASSERT(!dsl_pool_sync_context(tx
->tx_pool
));
1105 before
= gethrtime();
1107 /* If we might wait, we must not hold the config lock. */
1108 ASSERT(txg_how
!= TXG_WAIT
|| !dsl_pool_config_held(tx
->tx_pool
));
1110 while ((err
= dmu_tx_try_assign(tx
, txg_how
)) != 0) {
1111 dmu_tx_unassign(tx
);
1113 if (err
!= ERESTART
|| txg_how
!= TXG_WAIT
)
1119 txg_rele_to_quiesce(&tx
->tx_txgh
);
1121 spa_tx_assign_add_nsecs(tx
->tx_pool
->dp_spa
, gethrtime() - before
);
1127 dmu_tx_wait(dmu_tx_t
*tx
)
1129 spa_t
*spa
= tx
->tx_pool
->dp_spa
;
1131 ASSERT(tx
->tx_txg
== 0);
1132 ASSERT(!dsl_pool_config_held(tx
->tx_pool
));
1135 * It's possible that the pool has become active after this thread
1136 * has tried to obtain a tx. If that's the case then his
1137 * tx_lasttried_txg would not have been assigned.
1139 if (spa_suspended(spa
) || tx
->tx_lasttried_txg
== 0) {
1140 txg_wait_synced(tx
->tx_pool
, spa_last_synced_txg(spa
) + 1);
1141 } else if (tx
->tx_needassign_txh
) {
1142 dnode_t
*dn
= tx
->tx_needassign_txh
->txh_dnode
;
1144 mutex_enter(&dn
->dn_mtx
);
1145 while (dn
->dn_assigned_txg
== tx
->tx_lasttried_txg
- 1)
1146 cv_wait(&dn
->dn_notxholds
, &dn
->dn_mtx
);
1147 mutex_exit(&dn
->dn_mtx
);
1148 tx
->tx_needassign_txh
= NULL
;
1150 txg_wait_open(tx
->tx_pool
, tx
->tx_lasttried_txg
+ 1);
1155 dmu_tx_willuse_space(dmu_tx_t
*tx
, int64_t delta
)
1158 if (tx
->tx_dir
== NULL
|| delta
== 0)
1162 ASSERT3U(refcount_count(&tx
->tx_space_written
) + delta
, <=,
1163 tx
->tx_space_towrite
);
1164 (void) refcount_add_many(&tx
->tx_space_written
, delta
, NULL
);
1166 (void) refcount_add_many(&tx
->tx_space_freed
, -delta
, NULL
);
1172 dmu_tx_commit(dmu_tx_t
*tx
)
1176 ASSERT(tx
->tx_txg
!= 0);
1179 * Go through the transaction's hold list and remove holds on
1180 * associated dnodes, notifying waiters if no holds remain.
1182 while ((txh
= list_head(&tx
->tx_holds
))) {
1183 dnode_t
*dn
= txh
->txh_dnode
;
1185 list_remove(&tx
->tx_holds
, txh
);
1186 kmem_free(txh
, sizeof (dmu_tx_hold_t
));
1189 mutex_enter(&dn
->dn_mtx
);
1190 ASSERT3U(dn
->dn_assigned_txg
, ==, tx
->tx_txg
);
1192 if (refcount_remove(&dn
->dn_tx_holds
, tx
) == 0) {
1193 dn
->dn_assigned_txg
= 0;
1194 cv_broadcast(&dn
->dn_notxholds
);
1196 mutex_exit(&dn
->dn_mtx
);
1200 if (tx
->tx_tempreserve_cookie
)
1201 dsl_dir_tempreserve_clear(tx
->tx_tempreserve_cookie
, tx
);
1203 if (!list_is_empty(&tx
->tx_callbacks
))
1204 txg_register_callbacks(&tx
->tx_txgh
, &tx
->tx_callbacks
);
1206 if (tx
->tx_anyobj
== FALSE
)
1207 txg_rele_to_sync(&tx
->tx_txgh
);
1209 list_destroy(&tx
->tx_callbacks
);
1210 list_destroy(&tx
->tx_holds
);
1212 dprintf("towrite=%llu written=%llu tofree=%llu freed=%llu\n",
1213 tx
->tx_space_towrite
, refcount_count(&tx
->tx_space_written
),
1214 tx
->tx_space_tofree
, refcount_count(&tx
->tx_space_freed
));
1215 refcount_destroy_many(&tx
->tx_space_written
,
1216 refcount_count(&tx
->tx_space_written
));
1217 refcount_destroy_many(&tx
->tx_space_freed
,
1218 refcount_count(&tx
->tx_space_freed
));
1220 kmem_free(tx
, sizeof (dmu_tx_t
));
1224 dmu_tx_abort(dmu_tx_t
*tx
)
1228 ASSERT(tx
->tx_txg
== 0);
1230 while ((txh
= list_head(&tx
->tx_holds
))) {
1231 dnode_t
*dn
= txh
->txh_dnode
;
1233 list_remove(&tx
->tx_holds
, txh
);
1234 kmem_free(txh
, sizeof (dmu_tx_hold_t
));
1240 * Call any registered callbacks with an error code.
1242 if (!list_is_empty(&tx
->tx_callbacks
))
1243 dmu_tx_do_callbacks(&tx
->tx_callbacks
, ECANCELED
);
1245 list_destroy(&tx
->tx_callbacks
);
1246 list_destroy(&tx
->tx_holds
);
1248 refcount_destroy_many(&tx
->tx_space_written
,
1249 refcount_count(&tx
->tx_space_written
));
1250 refcount_destroy_many(&tx
->tx_space_freed
,
1251 refcount_count(&tx
->tx_space_freed
));
1253 kmem_free(tx
, sizeof (dmu_tx_t
));
1257 dmu_tx_get_txg(dmu_tx_t
*tx
)
1259 ASSERT(tx
->tx_txg
!= 0);
1260 return (tx
->tx_txg
);
1264 dmu_tx_pool(dmu_tx_t
*tx
)
1266 ASSERT(tx
->tx_pool
!= NULL
);
1267 return (tx
->tx_pool
);
1272 dmu_tx_callback_register(dmu_tx_t
*tx
, dmu_tx_callback_func_t
*func
, void *data
)
1274 dmu_tx_callback_t
*dcb
;
1276 dcb
= kmem_alloc(sizeof (dmu_tx_callback_t
), KM_PUSHPAGE
);
1278 dcb
->dcb_func
= func
;
1279 dcb
->dcb_data
= data
;
1281 list_insert_tail(&tx
->tx_callbacks
, dcb
);
1285 * Call all the commit callbacks on a list, with a given error code.
1288 dmu_tx_do_callbacks(list_t
*cb_list
, int error
)
1290 dmu_tx_callback_t
*dcb
;
1292 while ((dcb
= list_head(cb_list
))) {
1293 list_remove(cb_list
, dcb
);
1294 dcb
->dcb_func(dcb
->dcb_data
, error
);
1295 kmem_free(dcb
, sizeof (dmu_tx_callback_t
));
1300 * Interface to hold a bunch of attributes.
1301 * used for creating new files.
1302 * attrsize is the total size of all attributes
1303 * to be added during object creation
1305 * For updating/adding a single attribute dmu_tx_hold_sa() should be used.
1309 * hold necessary attribute name for attribute registration.
1310 * should be a very rare case where this is needed. If it does
1311 * happen it would only happen on the first write to the file system.
1314 dmu_tx_sa_registration_hold(sa_os_t
*sa
, dmu_tx_t
*tx
)
1318 if (!sa
->sa_need_attr_registration
)
1321 for (i
= 0; i
!= sa
->sa_num_attrs
; i
++) {
1322 if (!sa
->sa_attr_table
[i
].sa_registered
) {
1323 if (sa
->sa_reg_attr_obj
)
1324 dmu_tx_hold_zap(tx
, sa
->sa_reg_attr_obj
,
1325 B_TRUE
, sa
->sa_attr_table
[i
].sa_name
);
1327 dmu_tx_hold_zap(tx
, DMU_NEW_OBJECT
,
1328 B_TRUE
, sa
->sa_attr_table
[i
].sa_name
);
1335 dmu_tx_hold_spill(dmu_tx_t
*tx
, uint64_t object
)
1340 txh
= dmu_tx_hold_object_impl(tx
, tx
->tx_objset
, object
,
1345 dn
= txh
->txh_dnode
;
1350 /* If blkptr doesn't exist then add space to towrite */
1351 if (!(dn
->dn_phys
->dn_flags
& DNODE_FLAG_SPILL_BLKPTR
)) {
1352 txh
->txh_space_towrite
+= SPA_MAXBLOCKSIZE
;
1356 bp
= &dn
->dn_phys
->dn_spill
;
1357 if (dsl_dataset_block_freeable(dn
->dn_objset
->os_dsl_dataset
,
1359 txh
->txh_space_tooverwrite
+= SPA_MAXBLOCKSIZE
;
1361 txh
->txh_space_towrite
+= SPA_MAXBLOCKSIZE
;
1362 if (!BP_IS_HOLE(bp
))
1363 txh
->txh_space_tounref
+= SPA_MAXBLOCKSIZE
;
1368 dmu_tx_hold_sa_create(dmu_tx_t
*tx
, int attrsize
)
1370 sa_os_t
*sa
= tx
->tx_objset
->os_sa
;
1372 dmu_tx_hold_bonus(tx
, DMU_NEW_OBJECT
);
1374 if (tx
->tx_objset
->os_sa
->sa_master_obj
== 0)
1377 if (tx
->tx_objset
->os_sa
->sa_layout_attr_obj
)
1378 dmu_tx_hold_zap(tx
, sa
->sa_layout_attr_obj
, B_TRUE
, NULL
);
1380 dmu_tx_hold_zap(tx
, sa
->sa_master_obj
, B_TRUE
, SA_LAYOUTS
);
1381 dmu_tx_hold_zap(tx
, sa
->sa_master_obj
, B_TRUE
, SA_REGISTRY
);
1382 dmu_tx_hold_zap(tx
, DMU_NEW_OBJECT
, B_TRUE
, NULL
);
1383 dmu_tx_hold_zap(tx
, DMU_NEW_OBJECT
, B_TRUE
, NULL
);
1386 dmu_tx_sa_registration_hold(sa
, tx
);
1388 if (attrsize
<= DN_MAX_BONUSLEN
&& !sa
->sa_force_spill
)
1391 (void) dmu_tx_hold_object_impl(tx
, tx
->tx_objset
, DMU_NEW_OBJECT
,
1398 * dmu_tx_hold_sa(dmu_tx_t *tx, sa_handle_t *, attribute, add, size)
1400 * variable_size is the total size of all variable sized attributes
1401 * passed to this function. It is not the total size of all
1402 * variable size attributes that *may* exist on this object.
1405 dmu_tx_hold_sa(dmu_tx_t
*tx
, sa_handle_t
*hdl
, boolean_t may_grow
)
1408 sa_os_t
*sa
= tx
->tx_objset
->os_sa
;
1410 ASSERT(hdl
!= NULL
);
1412 object
= sa_handle_object(hdl
);
1414 dmu_tx_hold_bonus(tx
, object
);
1416 if (tx
->tx_objset
->os_sa
->sa_master_obj
== 0)
1419 if (tx
->tx_objset
->os_sa
->sa_reg_attr_obj
== 0 ||
1420 tx
->tx_objset
->os_sa
->sa_layout_attr_obj
== 0) {
1421 dmu_tx_hold_zap(tx
, sa
->sa_master_obj
, B_TRUE
, SA_LAYOUTS
);
1422 dmu_tx_hold_zap(tx
, sa
->sa_master_obj
, B_TRUE
, SA_REGISTRY
);
1423 dmu_tx_hold_zap(tx
, DMU_NEW_OBJECT
, B_TRUE
, NULL
);
1424 dmu_tx_hold_zap(tx
, DMU_NEW_OBJECT
, B_TRUE
, NULL
);
1427 dmu_tx_sa_registration_hold(sa
, tx
);
1429 if (may_grow
&& tx
->tx_objset
->os_sa
->sa_layout_attr_obj
)
1430 dmu_tx_hold_zap(tx
, sa
->sa_layout_attr_obj
, B_TRUE
, NULL
);
1432 if (sa
->sa_force_spill
|| may_grow
|| hdl
->sa_spill
) {
1433 ASSERT(tx
->tx_txg
== 0);
1434 dmu_tx_hold_spill(tx
, object
);
1436 dmu_buf_impl_t
*db
= (dmu_buf_impl_t
*)hdl
->sa_bonus
;
1441 if (dn
->dn_have_spill
) {
1442 ASSERT(tx
->tx_txg
== 0);
1443 dmu_tx_hold_spill(tx
, object
);
1452 dmu_tx_ksp
= kstat_create("zfs", 0, "dmu_tx", "misc",
1453 KSTAT_TYPE_NAMED
, sizeof (dmu_tx_stats
) / sizeof (kstat_named_t
),
1454 KSTAT_FLAG_VIRTUAL
);
1456 if (dmu_tx_ksp
!= NULL
) {
1457 dmu_tx_ksp
->ks_data
= &dmu_tx_stats
;
1458 kstat_install(dmu_tx_ksp
);
1465 if (dmu_tx_ksp
!= NULL
) {
1466 kstat_delete(dmu_tx_ksp
);
1471 #if defined(_KERNEL) && defined(HAVE_SPL)
1472 EXPORT_SYMBOL(dmu_tx_create
);
1473 EXPORT_SYMBOL(dmu_tx_hold_write
);
1474 EXPORT_SYMBOL(dmu_tx_hold_free
);
1475 EXPORT_SYMBOL(dmu_tx_hold_zap
);
1476 EXPORT_SYMBOL(dmu_tx_hold_bonus
);
1477 EXPORT_SYMBOL(dmu_tx_abort
);
1478 EXPORT_SYMBOL(dmu_tx_assign
);
1479 EXPORT_SYMBOL(dmu_tx_wait
);
1480 EXPORT_SYMBOL(dmu_tx_commit
);
1481 EXPORT_SYMBOL(dmu_tx_get_txg
);
1482 EXPORT_SYMBOL(dmu_tx_callback_register
);
1483 EXPORT_SYMBOL(dmu_tx_do_callbacks
);
1484 EXPORT_SYMBOL(dmu_tx_hold_spill
);
1485 EXPORT_SYMBOL(dmu_tx_hold_sa_create
);
1486 EXPORT_SYMBOL(dmu_tx_hold_sa
);