diff options
author | Tony Hutter <[email protected]> | 2018-04-09 14:24:46 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-04-09 14:24:46 -0700 |
commit | 4f301661dfe7e90574ad634f8b7fe8da7e6b4064 (patch) | |
tree | b68c6ff4d5177d5d26092e601f16d48c0aaf7b14 /module/zfs/zap_micro.c | |
parent | 3b0d99289a8e473b059605a83d4ce0bd505ec3d3 (diff) |
Revert "Handle zap_add() failures in mixed ... "
This reverts commit cc63068e95ee725cce03b1b7ce50179825a6cda5.
Under certain circumstances this change can result in an ENOSPC
error when adding new files to a directory. See #7401 for full
details.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Issue #7401
Cloes #7416
Diffstat (limited to 'module/zfs/zap_micro.c')
-rw-r--r-- | module/zfs/zap_micro.c | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/module/zfs/zap_micro.c b/module/zfs/zap_micro.c index ad9a62161..b81a48a0f 100644 --- a/module/zfs/zap_micro.c +++ b/module/zfs/zap_micro.c @@ -363,41 +363,6 @@ mze_find_unused_cd(zap_t *zap, uint64_t hash) return (cd); } -/* - * Each mzap entry requires at max : 4 chunks - * 3 chunks for names + 1 chunk for value. - */ -#define MZAP_ENT_CHUNKS (1 + ZAP_LEAF_ARRAY_NCHUNKS(MZAP_NAME_LEN) + \ - ZAP_LEAF_ARRAY_NCHUNKS(sizeof (uint64_t))) - -/* - * Check if the current entry keeps the colliding entries under the fatzap leaf - * size. - */ -static boolean_t -mze_canfit_fzap_leaf(zap_name_t *zn, uint64_t hash) -{ - zap_t *zap = zn->zn_zap; - mzap_ent_t mze_tofind; - mzap_ent_t *mze; - avl_index_t idx; - avl_tree_t *avl = &zap->zap_m.zap_avl; - uint32_t mzap_ents = 0; - - mze_tofind.mze_hash = hash; - mze_tofind.mze_cd = 0; - - for (mze = avl_find(avl, &mze_tofind, &idx); - mze && mze->mze_hash == hash; mze = AVL_NEXT(avl, mze)) { - mzap_ents++; - } - - /* Include the new entry being added */ - mzap_ents++; - - return (ZAP_LEAF_NUMCHUNKS_DEF > (mzap_ents * MZAP_ENT_CHUNKS)); -} - static void mze_remove(zap_t *zap, mzap_ent_t *mze) { @@ -1225,8 +1190,7 @@ zap_add_impl(zap_t *zap, const char *key, err = fzap_add(zn, integer_size, num_integers, val, tag, tx); zap = zn->zn_zap; /* fzap_add() may change zap */ } else if (integer_size != 8 || num_integers != 1 || - strlen(key) >= MZAP_NAME_LEN || - !mze_canfit_fzap_leaf(zn, zn->zn_hash)) { + strlen(key) >= MZAP_NAME_LEN) { err = mzap_upgrade(&zn->zn_zap, tag, tx, 0); if (err == 0) { err = fzap_add(zn, integer_size, num_integers, val, |