usr/src/uts/common/fs/zfs/zil.c
changeset 9493 9933d599bc93
parent 9396 f41cf682d0d3
child 9701 cc5b64682e64
equal deleted inserted replaced
9492:107d21fddddb 9493:9933d599bc93
   720 	ASSERT(!BP_IS_GANG(zio->io_bp));
   720 	ASSERT(!BP_IS_GANG(zio->io_bp));
   721 	ASSERT(!BP_IS_HOLE(zio->io_bp));
   721 	ASSERT(!BP_IS_HOLE(zio->io_bp));
   722 	ASSERT(zio->io_bp->blk_fill == 0);
   722 	ASSERT(zio->io_bp->blk_fill == 0);
   723 
   723 
   724 	/*
   724 	/*
   725 	 * Now that we've written this log block, we have a stable pointer
   725 	 * Ensure the lwb buffer pointer is cleared before releasing
   726 	 * to the next block in the chain, so it's OK to let the txg in
   726 	 * the txg. If we have had an allocation failure and
   727 	 * which we allocated the next block sync.
   727 	 * the txg is waiting to sync then we want want zil_sync()
   728 	 */
   728 	 * to remove the lwb so that it's not picked up as the next new
   729 	txg_rele_to_sync(&lwb->lwb_txgh);
   729 	 * one in zil_commit_writer(). zil_sync() will only remove
   730 
   730 	 * the lwb if lwb_buf is null.
       
   731 	 */
   731 	zio_buf_free(lwb->lwb_buf, lwb->lwb_sz);
   732 	zio_buf_free(lwb->lwb_buf, lwb->lwb_sz);
   732 	mutex_enter(&zilog->zl_lock);
   733 	mutex_enter(&zilog->zl_lock);
   733 	lwb->lwb_buf = NULL;
   734 	lwb->lwb_buf = NULL;
   734 	if (zio->io_error)
   735 	if (zio->io_error)
   735 		zilog->zl_log_error = B_TRUE;
   736 		zilog->zl_log_error = B_TRUE;
   736 	mutex_exit(&zilog->zl_lock);
   737 	mutex_exit(&zilog->zl_lock);
       
   738 
       
   739 	/*
       
   740 	 * Now that we've written this log block, we have a stable pointer
       
   741 	 * to the next block in the chain, so it's OK to let the txg in
       
   742 	 * which we allocated the next block sync.
       
   743 	 */
       
   744 	txg_rele_to_sync(&lwb->lwb_txgh);
   737 }
   745 }
   738 
   746 
   739 /*
   747 /*
   740  * Initialize the io for a log block.
   748  * Initialize the io for a log block.
   741  */
   749  */