usr/src/uts/common/fs/zfs/dmu_tx.c
changeset 11550 e63888bb788a
parent 10922 e2081f502306
child 11935 538c866aaac6
equal deleted inserted replaced
11549:908439ccd9a7 11550:e63888bb788a
    17  * information: Portions Copyright [yyyy] [name of copyright owner]
    17  * information: Portions Copyright [yyyy] [name of copyright owner]
    18  *
    18  *
    19  * CDDL HEADER END
    19  * CDDL HEADER END
    20  */
    20  */
    21 /*
    21 /*
    22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
    22  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
    23  * Use is subject to license terms.
    23  * Use is subject to license terms.
    24  */
    24  */
    25 
    25 
    26 #include <sys/dmu.h>
    26 #include <sys/dmu.h>
    27 #include <sys/dmu_impl.h>
    27 #include <sys/dmu_impl.h>
   516 		tochk = MIN(epb - blkoff, nblks);
   516 		tochk = MIN(epb - blkoff, nblks);
   517 
   517 
   518 		dbuf = dbuf_hold_level(dn, 1, blkid >> epbs, FTAG);
   518 		dbuf = dbuf_hold_level(dn, 1, blkid >> epbs, FTAG);
   519 
   519 
   520 		txh->txh_memory_tohold += dbuf->db.db_size;
   520 		txh->txh_memory_tohold += dbuf->db.db_size;
   521 		if (txh->txh_memory_tohold > DMU_MAX_ACCESS) {
   521 
   522 			txh->txh_tx->tx_err = E2BIG;
   522 		/*
   523 			dbuf_rele(dbuf, FTAG);
   523 		 * We don't check memory_tohold against DMU_MAX_ACCESS because
   524 			break;
   524 		 * memory_tohold is an over-estimation (especially the >L1
   525 		}
   525 		 * indirect blocks), so it could fail.  Callers should have
       
   526 		 * already verified that they will not be holding too much
       
   527 		 * memory.
       
   528 		 */
       
   529 
   526 		err = dbuf_read(dbuf, NULL, DB_RF_HAVESTRUCT | DB_RF_CANFAIL);
   530 		err = dbuf_read(dbuf, NULL, DB_RF_HAVESTRUCT | DB_RF_CANFAIL);
   527 		if (err != 0) {
   531 		if (err != 0) {
   528 			txh->txh_tx->tx_err = err;
   532 			txh->txh_tx->tx_err = err;
   529 			dbuf_rele(dbuf, FTAG);
   533 			dbuf_rele(dbuf, FTAG);
   530 			break;
   534 			break;