diff options
author | Matthew Ahrens <[email protected]> | 2013-03-08 10:41:28 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-10-31 14:58:04 -0700 |
commit | 2e528b49f8a0f8f2f51536a00fdf3ea9343bf302 (patch) | |
tree | 5c7c906ca4a8a6f52d6aafbf4eddefc8e872e42f /module/zfs/zap_micro.c | |
parent | 7011fb6004b2227ff9e89894ed69ab83d36c1696 (diff) |
Illumos #3598
3598 want to dtrace when errors are generated in zfs
Reviewed by: Dan Kimmel <[email protected]>
Reviewed by: Adam Leventhal <[email protected]>
Reviewed by: Christopher Siden <[email protected]>
Approved by: Garrett D'Amore <[email protected]>
References:
https://www.illumos.org/issues/3598
illumos/illumos-gate@be6fd75a69ae679453d9cda5bff3326111e6d1ca
Ported-by: Richard Yao <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue #1775
Porting notes:
1. include/sys/zfs_context.h has been modified to render some new
macros inert until dtrace is available on Linux.
2. Linux-specific changes have been adapted to use SET_ERROR().
3. I'm NOT happy about this change. It does nothing but ugly
up the code under Linux. Unfortunately we need to take it to
avoid more merge conflicts in the future. -Brian
Diffstat (limited to 'module/zfs/zap_micro.c')
-rw-r--r-- | module/zfs/zap_micro.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/module/zfs/zap_micro.c b/module/zfs/zap_micro.c index 4da783647..7aa00280b 100644 --- a/module/zfs/zap_micro.c +++ b/module/zfs/zap_micro.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ #include <sys/zio.h> @@ -780,7 +780,7 @@ zap_lookup_norm(objset_t *os, uint64_t zapobj, const char *name, zn = zap_name_alloc(zap, name, mt); if (zn == NULL) { zap_unlockdir(zap); - return (ENOTSUP); + return (SET_ERROR(ENOTSUP)); } if (!zap->zap_ismicro) { @@ -789,12 +789,12 @@ zap_lookup_norm(objset_t *os, uint64_t zapobj, const char *name, } else { mze = mze_find(zn); if (mze == NULL) { - err = ENOENT; + err = SET_ERROR(ENOENT); } else { if (num_integers < 1) { - err = EOVERFLOW; + err = SET_ERROR(EOVERFLOW); } else if (integer_size != 8) { - err = EINVAL; + err = SET_ERROR(EINVAL); } else { *(uint64_t *)buf = MZE_PHYS(zap, mze)->mze_value; @@ -826,7 +826,7 @@ zap_prefetch_uint64(objset_t *os, uint64_t zapobj, const uint64_t *key, zn = zap_name_alloc_uint64(zap, key, key_numints); if (zn == NULL) { zap_unlockdir(zap); - return (ENOTSUP); + return (SET_ERROR(ENOTSUP)); } fzap_prefetch(zn); @@ -849,7 +849,7 @@ zap_lookup_uint64(objset_t *os, uint64_t zapobj, const uint64_t *key, zn = zap_name_alloc_uint64(zap, key, key_numints); if (zn == NULL) { zap_unlockdir(zap); - return (ENOTSUP); + return (SET_ERROR(ENOTSUP)); } err = fzap_lookup(zn, integer_size, num_integers, buf, @@ -884,14 +884,14 @@ zap_length(objset_t *os, uint64_t zapobj, const char *name, zn = zap_name_alloc(zap, name, MT_EXACT); if (zn == NULL) { zap_unlockdir(zap); - return (ENOTSUP); + return (SET_ERROR(ENOTSUP)); } if (!zap->zap_ismicro) { err = fzap_length(zn, integer_size, num_integers); } else { mze = mze_find(zn); if (mze == NULL) { - err = ENOENT; + err = SET_ERROR(ENOENT); } else { if (integer_size) *integer_size = 8; @@ -918,7 +918,7 @@ zap_length_uint64(objset_t *os, uint64_t zapobj, const uint64_t *key, zn = zap_name_alloc_uint64(zap, key, key_numints); if (zn == NULL) { zap_unlockdir(zap); - return (ENOTSUP); + return (SET_ERROR(ENOTSUP)); } err = fzap_length(zn, integer_size, num_integers); zap_name_free(zn); @@ -987,7 +987,7 @@ zap_add(objset_t *os, uint64_t zapobj, const char *key, zn = zap_name_alloc(zap, key, MT_EXACT); if (zn == NULL) { zap_unlockdir(zap); - return (ENOTSUP); + return (SET_ERROR(ENOTSUP)); } if (!zap->zap_ismicro) { err = fzap_add(zn, integer_size, num_integers, val, tx); @@ -1001,7 +1001,7 @@ zap_add(objset_t *os, uint64_t zapobj, const char *key, } else { mze = mze_find(zn); if (mze != NULL) { - err = EEXIST; + err = SET_ERROR(EEXIST); } else { mzap_addent(zn, *intval); } @@ -1028,7 +1028,7 @@ zap_add_uint64(objset_t *os, uint64_t zapobj, const uint64_t *key, zn = zap_name_alloc_uint64(zap, key, key_numints); if (zn == NULL) { zap_unlockdir(zap); - return (ENOTSUP); + return (SET_ERROR(ENOTSUP)); } err = fzap_add(zn, integer_size, num_integers, val, tx); zap = zn->zn_zap; /* fzap_add() may change zap */ @@ -1065,7 +1065,7 @@ zap_update(objset_t *os, uint64_t zapobj, const char *name, zn = zap_name_alloc(zap, name, MT_EXACT); if (zn == NULL) { zap_unlockdir(zap); - return (ENOTSUP); + return (SET_ERROR(ENOTSUP)); } if (!zap->zap_ismicro) { err = fzap_update(zn, integer_size, num_integers, val, tx); @@ -1110,7 +1110,7 @@ zap_update_uint64(objset_t *os, uint64_t zapobj, const uint64_t *key, zn = zap_name_alloc_uint64(zap, key, key_numints); if (zn == NULL) { zap_unlockdir(zap); - return (ENOTSUP); + return (SET_ERROR(ENOTSUP)); } err = fzap_update(zn, integer_size, num_integers, val, tx); zap = zn->zn_zap; /* fzap_update() may change zap */ @@ -1141,14 +1141,14 @@ zap_remove_norm(objset_t *os, uint64_t zapobj, const char *name, zn = zap_name_alloc(zap, name, mt); if (zn == NULL) { zap_unlockdir(zap); - return (ENOTSUP); + return (SET_ERROR(ENOTSUP)); } if (!zap->zap_ismicro) { err = fzap_remove(zn, tx); } else { mze = mze_find(zn); if (mze == NULL) { - err = ENOENT; + err = SET_ERROR(ENOENT); } else { zap->zap_m.zap_num_entries--; bzero(&zap->zap_m.zap_phys->mz_chunk[mze->mze_chunkid], @@ -1175,7 +1175,7 @@ zap_remove_uint64(objset_t *os, uint64_t zapobj, const uint64_t *key, zn = zap_name_alloc_uint64(zap, key, key_numints); if (zn == NULL) { zap_unlockdir(zap); - return (ENOTSUP); + return (SET_ERROR(ENOTSUP)); } err = fzap_remove(zn, tx); zap_name_free(zn); @@ -1253,7 +1253,7 @@ zap_cursor_retrieve(zap_cursor_t *zc, zap_attribute_t *za) mzap_ent_t *mze; if (zc->zc_hash == -1ULL) - return (ENOENT); + return (SET_ERROR(ENOENT)); if (zc->zc_zap == NULL) { int hb; @@ -1279,8 +1279,6 @@ zap_cursor_retrieve(zap_cursor_t *zc, zap_attribute_t *za) if (!zc->zc_zap->zap_ismicro) { err = fzap_cursor_retrieve(zc->zc_zap, zc, za); } else { - err = ENOENT; - mze_tofind.mze_hash = zc->zc_hash; mze_tofind.mze_cd = zc->zc_cd; @@ -1303,6 +1301,7 @@ zap_cursor_retrieve(zap_cursor_t *zc, zap_attribute_t *za) err = 0; } else { zc->zc_hash = -1ULL; + err = SET_ERROR(ENOENT); } } rw_exit(&zc->zc_zap->zap_rwlock); @@ -1336,7 +1335,7 @@ zap_cursor_move_to_key(zap_cursor_t *zc, const char *name, matchtype_t mt) zn = zap_name_alloc(zc->zc_zap, name, mt); if (zn == NULL) { rw_exit(&zc->zc_zap->zap_rwlock); - return (ENOTSUP); + return (SET_ERROR(ENOTSUP)); } if (!zc->zc_zap->zap_ismicro) { @@ -1344,7 +1343,7 @@ zap_cursor_move_to_key(zap_cursor_t *zc, const char *name, matchtype_t mt) } else { mze = mze_find(zn); if (mze == NULL) { - err = ENOENT; + err = SET_ERROR(ENOENT); goto out; } zc->zc_hash = mze->mze_hash; |