Mercurial > illumos > illumos-gate
changeset 9873:8ddc892eca6e
6847229 assertion failed: refcount_count(&tx->tx_space_written) + delta <= tx->tx_space_towrite in dmu_tx.c
author | Sanjeev Bagewadi <Sanjeev.Bagewadi@Sun.COM> |
---|---|
date | Tue, 16 Jun 2009 13:11:47 +0530 |
parents | bb47b7225612 |
children | 443951628139 |
files | usr/src/uts/common/fs/zfs/dmu_tx.c usr/src/uts/common/fs/zfs/sys/zap.h usr/src/uts/common/fs/zfs/zap_micro.c |
diffstat | 3 files changed, 25 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/dmu_tx.c Tue Jun 16 11:06:44 2009 +0530 +++ b/usr/src/uts/common/fs/zfs/dmu_tx.c Tue Jun 16 13:11:47 2009 +0530 @@ -697,8 +697,7 @@ } err = zap_count_write(&dn->dn_objset->os, dn->dn_object, name, add, - &txh->txh_space_towrite, &txh->txh_space_tooverwrite, - txh->txh_dnode->dn_datablkshift); + &txh->txh_space_towrite, &txh->txh_space_tooverwrite); /* * If the modified blocks are scattered to the four winds,
--- a/usr/src/uts/common/fs/zfs/sys/zap.h Tue Jun 16 11:06:44 2009 +0530 +++ b/usr/src/uts/common/fs/zfs/sys/zap.h Tue Jun 16 13:11:47 2009 +0530 @@ -182,8 +182,7 @@ boolean_t *normalization_conflictp); int zap_count_write(objset_t *os, uint64_t zapobj, const char *name, - int add, uint64_t *towrite, uint64_t *tooverwrite, - uint64_t dn_datablkshift); + int add, uint64_t *towrite, uint64_t *tooverwrite); /* * Create an attribute with the given name and value.
--- a/usr/src/uts/common/fs/zfs/zap_micro.c Tue Jun 16 11:06:44 2009 +0530 +++ b/usr/src/uts/common/fs/zfs/zap_micro.c Tue Jun 16 13:11:47 2009 +0530 @@ -1068,7 +1068,7 @@ int zap_count_write(objset_t *os, uint64_t zapobj, const char *name, int add, - uint64_t *towrite, uint64_t *tooverwrite, uint64_t dn_datablkshift) + uint64_t *towrite, uint64_t *tooverwrite) { zap_t *zap; int err = 0; @@ -1113,28 +1113,28 @@ *towrite += (3 + (add ? 4 : 0)) * SPA_MAXBLOCKSIZE; } } else { - if (!add) { - if (dmu_buf_freeable(zap->zap_dbuf)) - *tooverwrite += SPA_MAXBLOCKSIZE; - else - *towrite += SPA_MAXBLOCKSIZE; - } else { - /* - * We are here if we are adding and (name != NULL). - * It is hard to find out if this add will promote this - * microzap to fatzap. Hence, we assume the worst case - * and account for the blocks assuming this microzap - * would be promoted to a fatzap. - * - * 1 block overwritten : header block - * 4 new blocks written : 2 new split leaf, 2 grown - * ptrtbl blocks - */ - if (dmu_buf_freeable(zap->zap_dbuf)) - *tooverwrite += 1 << dn_datablkshift; - else - *towrite += 1 << dn_datablkshift; - *towrite += 4 << dn_datablkshift; + /* + * We are here if (name != NULL) and this is a micro-zap. + * We account for the header block depending on whether it + * is freeable. + * + * Incase of an add-operation it is hard to find out + * if this add will promote this microzap to fatzap. + * Hence, we consider the worst case and account for the + * blocks assuming this microzap would be promoted to a + * fatzap. + * + * 1 block overwritten : header block + * 4 new blocks written : 2 new split leaf, 2 grown + * ptrtbl blocks + */ + if (dmu_buf_freeable(zap->zap_dbuf)) + *tooverwrite += SPA_MAXBLOCKSIZE; + else + *towrite += SPA_MAXBLOCKSIZE; + + if (add) { + *towrite += 4 * SPA_MAXBLOCKSIZE; } }