2 * Copyright (c) 2013-2018 The DragonFly Project. All rights reserved.
4 * This code is derived from software contributed to The DragonFly Project
5 * by Matthew Dillon <dillon@dragonflybsd.org>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * 3. Neither the name of The DragonFly Project nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific, prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 #define HAMMER2_DOP_READ 1
38 #define HAMMER2_DOP_NEW 2
39 #define HAMMER2_DOP_NEWNZ 3
40 #define HAMMER2_DOP_READQ 4
43 * Implements an abstraction layer for synchronous and asynchronous
44 * buffered device I/O. Can be used as an OS-abstraction but the main
45 * purpose is to allow larger buffers to be used against hammer2_chain's
46 * using smaller allocations, without causing deadlocks.
48 * The DIOs also record temporary state with limited persistence. This
49 * feature is used to keep track of dedupable blocks.
51 static int hammer2_io_cleanup_callback(hammer2_io_t *dio, void *arg);
52 static void dio_write_stats_update(hammer2_io_t *dio, struct buf *bp);
55 hammer2_io_cmp(hammer2_io_t *io1, hammer2_io_t *io2)
57 if (io1->pbase < io2->pbase)
59 if (io1->pbase > io2->pbase)
64 RB_PROTOTYPE2(hammer2_io_tree, hammer2_io, rbnode, hammer2_io_cmp, off_t);
65 RB_GENERATE2(hammer2_io_tree, hammer2_io, rbnode, hammer2_io_cmp,
68 struct hammer2_cleanupcb_info {
69 struct hammer2_io_tree tmptree;
76 hammer2_io_mask(hammer2_io_t *dio, hammer2_off_t off, u_int bytes)
81 if (bytes < 1024) /* smaller chunks not supported */
85 * Calculate crc check mask for larger chunks
87 i = (((off & ~HAMMER2_OFF_MASK_RADIX) - dio->pbase) &
88 HAMMER2_PBUFMASK) >> 10;
89 if (i == 0 && bytes == HAMMER2_PBUFSIZE)
91 mask = ((uint64_t)1U << (bytes >> 10)) - 1;
98 #ifdef HAMMER2_IO_DEBUG
101 DIO_RECORD(hammer2_io_t *dio HAMMER2_IO_DEBUG_ARGS)
105 i = atomic_fetchadd_int(&dio->debug_index, 1) & HAMMER2_IO_DEBUG_MASK;
107 dio->debug_file[i] = file;
108 dio->debug_line[i] = line;
109 dio->debug_refs[i] = dio->refs;
110 dio->debug_td[i] = curthread;
115 #define DIO_RECORD(dio)
120 * Returns the DIO corresponding to the data|radix, creating it if necessary.
122 * If createit is 0, NULL can be returned indicating that the DIO does not
123 * exist. (btype) is ignored when createit is 0.
127 hammer2_io_alloc(hammer2_dev_t *hmp, hammer2_key_t data_off, uint8_t btype,
128 int createit, int *isgoodp)
139 psize = HAMMER2_PBUFSIZE;
140 pmask = ~(hammer2_off_t)(psize - 1);
141 lsize = 1 << (int)(data_off & HAMMER2_OFF_MASK_RADIX);
142 lbase = data_off & ~HAMMER2_OFF_MASK_RADIX;
143 pbase = lbase & pmask;
145 if (pbase == 0 || ((lbase + lsize - 1) & pmask) != pbase) {
146 kprintf("Illegal: %016jx %016jx+%08x / %016jx\n",
147 pbase, lbase, lsize, pmask);
149 KKASSERT(pbase != 0 && ((lbase + lsize - 1) & pmask) == pbase);
153 * Access/Allocate the DIO, bump dio->refs to prevent destruction.
155 * If DIO_GOOD is set the ref should prevent it from being cleared
156 * out from under us, we can set *isgoodp, and the caller can operate
157 * on the buffer without any further interaction.
159 hammer2_spin_sh(&hmp->io_spin);
160 dio = RB_LOOKUP(hammer2_io_tree, &hmp->iotree, pbase);
162 refs = atomic_fetchadd_64(&dio->refs, 1);
163 if ((refs & HAMMER2_DIO_MASK) == 0) {
164 atomic_add_int(&dio->hmp->iofree_count, -1);
166 if (refs & HAMMER2_DIO_GOOD)
168 hammer2_spin_unsh(&hmp->io_spin);
169 } else if (createit) {
171 hammer2_spin_unsh(&hmp->io_spin);
172 dio = kmalloc(sizeof(*dio), M_HAMMER2, M_INTWAIT | M_ZERO);
177 dio->refs = refs + 1;
179 hammer2_spin_ex(&hmp->io_spin);
180 xio = RB_INSERT(hammer2_io_tree, &hmp->iotree, dio);
182 atomic_add_int(&hammer2_dio_count, 1);
183 hammer2_spin_unex(&hmp->io_spin);
185 refs = atomic_fetchadd_64(&xio->refs, 1);
186 if ((refs & HAMMER2_DIO_MASK) == 0)
187 atomic_add_int(&xio->hmp->iofree_count, -1);
188 if (refs & HAMMER2_DIO_GOOD)
190 hammer2_spin_unex(&hmp->io_spin);
191 kfree(dio, M_HAMMER2);
195 hammer2_spin_unsh(&hmp->io_spin);
206 * Acquire the requested dio. If DIO_GOOD is not set we must instantiate
207 * a buffer. If set the buffer already exists and is good to go.
210 _hammer2_io_getblk(hammer2_dev_t *hmp, int btype, off_t lbase,
211 int lsize, int op HAMMER2_IO_DEBUG_ARGS)
222 bflags = ((btype == HAMMER2_BREF_TYPE_DATA) ? B_NOTMETA : 0);
225 KKASSERT((1 << (int)(lbase & HAMMER2_OFF_MASK_RADIX)) == lsize);
227 if (op == HAMMER2_DOP_READQ) {
228 dio = hammer2_io_alloc(hmp, lbase, btype, 0, &isgood);
231 op = HAMMER2_DOP_READ;
233 dio = hammer2_io_alloc(hmp, lbase, btype, 1, &isgood);
241 * Buffer is already good, handle the op and return.
243 if (orefs & HAMMER2_DIO_GOOD) {
249 case HAMMER2_DOP_NEW:
250 bzero(hammer2_io_data(dio, lbase), lsize);
252 case HAMMER2_DOP_NEWNZ:
253 atomic_set_long(&dio->refs, HAMMER2_DIO_DIRTY);
255 case HAMMER2_DOP_READ:
260 DIO_RECORD(dio HAMMER2_IO_DEBUG_CALL);
267 if (orefs & HAMMER2_DIO_INPROG) {
268 nrefs = orefs | HAMMER2_DIO_WAITING;
269 tsleep_interlock(dio, 0);
270 if (atomic_cmpset_64(&dio->refs, orefs, nrefs)) {
271 tsleep(dio, PINTERLOCKED, "h2dio", hz);
275 nrefs = orefs | HAMMER2_DIO_INPROG;
276 if (atomic_cmpset_64(&dio->refs, orefs, nrefs)) {
283 * We break to here if GOOD is not set and we acquired INPROG for
286 KKASSERT(dio->bp == NULL);
287 if (btype == HAMMER2_BREF_TYPE_DATA)
288 hce = hammer2_cluster_data_read;
290 hce = hammer2_cluster_meta_read;
293 if (dio->pbase == (lbase & ~HAMMER2_OFF_MASK_RADIX) &&
294 dio->psize == lsize) {
296 case HAMMER2_DOP_NEW:
297 case HAMMER2_DOP_NEWNZ:
298 dio->bp = getblk(dio->hmp->devvp,
299 dio->pbase, dio->psize,
301 if (op == HAMMER2_DOP_NEW) {
303 bzero(dio->bp->b_data, dio->psize);
305 atomic_set_long(&dio->refs, HAMMER2_DIO_DIRTY);
307 case HAMMER2_DOP_READ:
309 KKASSERT(dio->bp == NULL);
312 * Synchronous cluster I/O for now.
314 peof = (dio->pbase + HAMMER2_SEGMASK64) &
316 error = cluster_readx(dio->hmp->devvp,
320 HAMMER2_PBUFSIZE*hce,
323 error = breadnx(dio->hmp->devvp, dio->pbase,
325 NULL, NULL, 0, &dio->bp);
331 * Synchronous cluster I/O for now.
333 peof = (dio->pbase + HAMMER2_SEGMASK64) &
335 error = cluster_readx(dio->hmp->devvp,
336 peof, dio->pbase, dio->psize,
338 dio->psize, HAMMER2_PBUFSIZE*hce,
341 error = breadnx(dio->hmp->devvp, dio->pbase,
343 NULL, NULL, 0, &dio->bp);
350 case HAMMER2_DOP_NEW:
352 bzero(hammer2_io_data(dio, lbase), lsize);
354 case HAMMER2_DOP_NEWNZ:
355 atomic_set_long(&dio->refs, HAMMER2_DIO_DIRTY);
357 case HAMMER2_DOP_READ:
363 * Tell the kernel that the buffer cache is not
364 * meta-data based on the btype. This allows
365 * swapcache to distinguish between data and
369 case HAMMER2_BREF_TYPE_DATA:
370 dio->bp->b_flags |= B_NOTMETA;
380 BUF_KERNPROC(dio->bp);
381 dio->bp->b_flags &= ~B_AGE;
382 /* dio->bp->b_debug_info2 = dio; */
387 * Clear INPROG and WAITING, set GOOD wake up anyone waiting.
392 nrefs = orefs & ~(HAMMER2_DIO_INPROG | HAMMER2_DIO_WAITING);
394 nrefs |= HAMMER2_DIO_GOOD;
395 if (atomic_cmpset_64(&dio->refs, orefs, nrefs)) {
396 if (orefs & HAMMER2_DIO_WAITING)
403 /* XXX error handling */
404 DIO_RECORD(dio HAMMER2_IO_DEBUG_CALL);
410 * Release our ref on *diop.
412 * On the 1->0 transition we clear DIO_GOOD, set DIO_INPROG, and dispose
413 * of dio->bp. Then we clean up DIO_INPROG and DIO_WAITING.
416 _hammer2_io_putblk(hammer2_io_t **diop HAMMER2_IO_DEBUG_ARGS)
430 DIO_RECORD(dio HAMMER2_IO_DEBUG_CALL);
432 KKASSERT((dio->refs & HAMMER2_DIO_MASK) != 0);
437 * On the 1->0 transition clear GOOD and set INPROG, and break.
438 * On any other transition we can return early.
444 if ((orefs & HAMMER2_DIO_MASK) == 1 &&
445 (orefs & HAMMER2_DIO_INPROG) == 0) {
447 * Lastdrop case, INPROG can be set. GOOD must be
448 * cleared to prevent the getblk shortcut.
451 nrefs &= ~(HAMMER2_DIO_GOOD | HAMMER2_DIO_DIRTY);
452 nrefs |= HAMMER2_DIO_INPROG;
453 if (atomic_cmpset_64(&dio->refs, orefs, nrefs))
455 } else if ((orefs & HAMMER2_DIO_MASK) == 1) {
457 * Lastdrop case, INPROG already set. We must
458 * wait for INPROG to clear.
460 nrefs = orefs | HAMMER2_DIO_WAITING;
461 tsleep_interlock(dio, 0);
462 if (atomic_cmpset_64(&dio->refs, orefs, nrefs)) {
463 tsleep(dio, PINTERLOCKED, "h2dio", hz);
471 if (atomic_cmpset_64(&dio->refs, orefs, nrefs))
480 * Lastdrop (1->0 transition). INPROG has been set, GOOD and DIRTY
481 * have been cleared. iofree_count has not yet been incremented,
482 * note that another accessor race will decrement iofree_count so
483 * we have to increment it regardless.
485 * We can now dispose of the buffer, and should do it before calling
486 * io_complete() in case there's a race against a new reference
487 * which causes io_complete() to chain and instantiate the bp again.
494 if ((orefs & HAMMER2_DIO_GOOD) && bp) {
496 * Non-errored disposal of bp
498 if (orefs & HAMMER2_DIO_DIRTY) {
499 dio_write_stats_update(dio, bp);
502 * Allows dirty buffers to accumulate and
503 * possibly be canceled (e.g. by a 'rm'),
504 * by default we will burst-write later.
506 * We generally do NOT want to issue an actual
507 * b[a]write() or cluster_write() here. Due to
508 * the way chains are locked, buffers may be cycled
509 * in and out quite often and disposal here can cause
510 * multiple writes or write-read stalls.
512 * If FLUSH is set we do want to issue the actual
513 * write. This typically occurs in the write-behind
514 * case when writing to large files.
518 if (dio->refs & HAMMER2_DIO_FLUSH) {
519 if ((hce = hammer2_cluster_write) != 0) {
520 peof = (pbase + HAMMER2_SEGMASK64) &
522 bp->b_flags |= B_CLUSTEROK;
523 cluster_write(bp, peof, psize, hce);
525 bp->b_flags &= ~B_CLUSTEROK;
529 bp->b_flags &= ~B_CLUSTEROK;
532 } else if (bp->b_flags & (B_ERROR | B_INVAL | B_RELBUF)) {
539 * Errored disposal of bp
545 * Update iofree_count before disposing of the dio
548 atomic_add_int(&hmp->iofree_count, 1);
551 * Clear INPROG, GOOD, and WAITING (GOOD should already be clear).
553 * Also clear FLUSH as it was handled above.
558 nrefs = orefs & ~(HAMMER2_DIO_INPROG | HAMMER2_DIO_GOOD |
559 HAMMER2_DIO_WAITING | HAMMER2_DIO_FLUSH);
560 if (atomic_cmpset_64(&dio->refs, orefs, nrefs)) {
561 if (orefs & HAMMER2_DIO_WAITING)
569 * We cache free buffers so re-use cases can use a shared lock, but
570 * if too many build up we have to clean them out.
572 dio_limit = hammer2_dio_limit;
575 if (dio_limit > 1024*1024)
576 dio_limit = 1024*1024;
577 if (hmp->iofree_count > dio_limit) {
578 struct hammer2_cleanupcb_info info;
580 RB_INIT(&info.tmptree);
581 hammer2_spin_ex(&hmp->io_spin);
582 if (hmp->iofree_count > dio_limit) {
583 info.count = hmp->iofree_count / 5;
584 RB_SCAN(hammer2_io_tree, &hmp->iotree, NULL,
585 hammer2_io_cleanup_callback, &info);
587 hammer2_spin_unex(&hmp->io_spin);
588 hammer2_io_cleanup(hmp, &info.tmptree);
593 * Cleanup any dio's with (INPROG | refs) == 0.
595 * Called to clean up cached DIOs on umount after all activity has been
600 hammer2_io_cleanup_callback(hammer2_io_t *dio, void *arg)
602 struct hammer2_cleanupcb_info *info = arg;
605 if ((dio->refs & (HAMMER2_DIO_MASK | HAMMER2_DIO_INPROG)) == 0) {
609 act = dio->act - (ticks - dio->ticks) / hz - 1;
616 KKASSERT(dio->bp == NULL);
617 if (info->count > 0) {
618 RB_REMOVE(hammer2_io_tree, &dio->hmp->iotree, dio);
619 xio = RB_INSERT(hammer2_io_tree, &info->tmptree, dio);
620 KKASSERT(xio == NULL);
628 hammer2_io_cleanup(hammer2_dev_t *hmp, struct hammer2_io_tree *tree)
632 while ((dio = RB_ROOT(tree)) != NULL) {
633 RB_REMOVE(hammer2_io_tree, tree, dio);
634 KKASSERT(dio->bp == NULL &&
635 (dio->refs & (HAMMER2_DIO_MASK | HAMMER2_DIO_INPROG)) == 0);
636 if (dio->refs & HAMMER2_DIO_DIRTY) {
637 kprintf("hammer2_io_cleanup: Dirty buffer "
638 "%016jx/%d (bp=%p)\n",
639 dio->pbase, dio->psize, dio->bp);
641 kfree(dio, M_HAMMER2);
642 atomic_add_int(&hammer2_dio_count, -1);
643 atomic_add_int(&hmp->iofree_count, -1);
648 * Returns a pointer to the requested data.
651 hammer2_io_data(hammer2_io_t *dio, off_t lbase)
657 KKASSERT(bp != NULL);
659 off = (lbase & ~HAMMER2_OFF_MASK_RADIX) - bp->b_loffset;
660 KKASSERT(off >= 0 && off < bp->b_bufsize);
661 return(bp->b_data + off);
665 hammer2_io_new(hammer2_dev_t *hmp, int btype, off_t lbase, int lsize,
668 *diop = hammer2_io_getblk(hmp, btype, lbase, lsize, HAMMER2_DOP_NEW);
669 return ((*diop)->error);
673 hammer2_io_newnz(hammer2_dev_t *hmp, int btype, off_t lbase, int lsize,
676 *diop = hammer2_io_getblk(hmp, btype, lbase, lsize, HAMMER2_DOP_NEWNZ);
677 return ((*diop)->error);
681 _hammer2_io_bread(hammer2_dev_t *hmp, int btype, off_t lbase, int lsize,
682 hammer2_io_t **diop HAMMER2_IO_DEBUG_ARGS)
684 #ifdef HAMMER2_IO_DEBUG
688 *diop = _hammer2_io_getblk(hmp, btype, lbase, lsize,
689 HAMMER2_DOP_READ HAMMER2_IO_DEBUG_CALL);
690 #ifdef HAMMER2_IO_DEBUG
691 if ((dio = *diop) != NULL) {
692 int i = (dio->debug_index - 1) & HAMMER2_IO_DEBUG_MASK;
693 dio->debug_data[i] = debug_data;
696 return ((*diop)->error);
700 _hammer2_io_getquick(hammer2_dev_t *hmp, off_t lbase,
701 int lsize HAMMER2_IO_DEBUG_ARGS)
705 dio = _hammer2_io_getblk(hmp, 0, lbase, lsize,
706 HAMMER2_DOP_READQ HAMMER2_IO_DEBUG_CALL);
711 _hammer2_io_bawrite(hammer2_io_t **diop HAMMER2_IO_DEBUG_ARGS)
713 atomic_set_64(&(*diop)->refs, HAMMER2_DIO_DIRTY |
715 _hammer2_io_putblk(diop HAMMER2_IO_DEBUG_CALL);
719 _hammer2_io_bdwrite(hammer2_io_t **diop HAMMER2_IO_DEBUG_ARGS)
721 atomic_set_64(&(*diop)->refs, HAMMER2_DIO_DIRTY);
722 _hammer2_io_putblk(diop HAMMER2_IO_DEBUG_CALL);
726 _hammer2_io_bwrite(hammer2_io_t **diop HAMMER2_IO_DEBUG_ARGS)
728 atomic_set_64(&(*diop)->refs, HAMMER2_DIO_DIRTY |
730 _hammer2_io_putblk(diop HAMMER2_IO_DEBUG_CALL);
731 return (0); /* XXX */
735 hammer2_io_setdirty(hammer2_io_t *dio)
737 atomic_set_64(&dio->refs, HAMMER2_DIO_DIRTY);
741 * This routine is called when a MODIFIED chain is being DESTROYED,
742 * in an attempt to allow the related buffer cache buffer to be
743 * invalidated and discarded instead of flushing it to disk.
745 * At the moment this case is only really useful for file meta-data.
746 * File data is already handled via the logical buffer cache associated
747 * with the vnode, and will be discarded if it was never flushed to disk.
748 * File meta-data may include inodes, directory entries, and indirect blocks.
751 * However, our DIO buffers are PBUFSIZE'd (64KB), and the area being
752 * invalidated might be smaller. Most of the meta-data structures above
753 * are in the 'smaller' category. For now, don't try to invalidate the
757 hammer2_io_inval(hammer2_io_t *dio, hammer2_off_t data_off, u_int bytes)
763 _hammer2_io_brelse(hammer2_io_t **diop HAMMER2_IO_DEBUG_ARGS)
765 _hammer2_io_putblk(diop HAMMER2_IO_DEBUG_CALL);
769 _hammer2_io_bqrelse(hammer2_io_t **diop HAMMER2_IO_DEBUG_ARGS)
771 _hammer2_io_putblk(diop HAMMER2_IO_DEBUG_CALL);
775 * Set dedup validation bits in a DIO. We do not need the buffer cache
776 * buffer for this. This must be done concurrent with setting bits in
777 * the freemap so as to interlock with bulkfree's clearing of those bits.
780 hammer2_io_dedup_set(hammer2_dev_t *hmp, hammer2_blockref_t *bref)
787 dio = hammer2_io_alloc(hmp, bref->data_off, bref->type, 1, &isgood);
788 lsize = 1 << (int)(bref->data_off & HAMMER2_OFF_MASK_RADIX);
789 mask = hammer2_dedup_mask(dio, bref->data_off, lsize);
790 atomic_clear_64(&dio->dedup_valid, mask);
791 atomic_set_64(&dio->dedup_alloc, mask);
792 hammer2_io_putblk(&dio);
796 * Clear dedup validation bits in a DIO. This is typically done when
797 * a modified chain is destroyed or by the bulkfree code. No buffer
798 * is needed for this operation. If the DIO no longer exists it is
799 * equivalent to the bits not being set.
802 hammer2_io_dedup_delete(hammer2_dev_t *hmp, uint8_t btype,
803 hammer2_off_t data_off, u_int bytes)
809 if ((data_off & ~HAMMER2_OFF_MASK_RADIX) == 0)
811 if (btype != HAMMER2_BREF_TYPE_DATA)
813 dio = hammer2_io_alloc(hmp, data_off, btype, 0, &isgood);
815 if (data_off < dio->pbase ||
816 (data_off & ~HAMMER2_OFF_MASK_RADIX) + bytes >
817 dio->pbase + dio->psize) {
818 panic("hammer2_io_dedup_delete: DATAOFF BAD "
819 "%016jx/%d %016jx\n",
820 data_off, bytes, dio->pbase);
822 mask = hammer2_dedup_mask(dio, data_off, bytes);
823 atomic_clear_64(&dio->dedup_alloc, mask);
824 atomic_clear_64(&dio->dedup_valid, mask);
825 hammer2_io_putblk(&dio);
830 * Assert that dedup allocation bits in a DIO are not set. This operation
831 * does not require a buffer. The DIO does not need to exist.
834 hammer2_io_dedup_assert(hammer2_dev_t *hmp, hammer2_off_t data_off, u_int bytes)
839 dio = hammer2_io_alloc(hmp, data_off, HAMMER2_BREF_TYPE_DATA,
842 KASSERT((dio->dedup_alloc &
843 hammer2_dedup_mask(dio, data_off, bytes)) == 0,
844 ("hammer2_dedup_assert: %016jx/%d %016jx/%016jx",
847 hammer2_dedup_mask(dio, data_off, bytes),
849 hammer2_io_putblk(&dio);
855 dio_write_stats_update(hammer2_io_t *dio, struct buf *bp)
857 if (bp->b_flags & B_DELWRI)
859 hammer2_adjwritecounter(dio->btype, dio->psize);
863 hammer2_io_bkvasync(hammer2_io_t *dio)
865 KKASSERT(dio->bp != NULL);
870 * Ref a dio that is already owned
873 _hammer2_io_ref(hammer2_io_t *dio HAMMER2_IO_DEBUG_ARGS)
875 DIO_RECORD(dio HAMMER2_IO_DEBUG_CALL);
876 atomic_add_64(&dio->refs, 1);