Use SET_ERROR for constant non-zero return codes

Update many return and assignment statements to follow the convention
of using the SET_ERROR macro when returning a hard-coded non-zero
value from a function. This aids debugging by recording the error
codes in the debug log.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Closes #6441
This commit is contained in:
Ned Bass
2017-08-02 21:16:12 -07:00
committed by Brian Behlendorf
parent 6710381680
commit ecb2b7dc7f
18 changed files with 46 additions and 46 deletions
+3 -3
View File
@@ -1288,11 +1288,11 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag, int slots,
if ((flag & DNODE_MUST_BE_FREE) && !dnode_is_free(db, idx, slots)) {
dbuf_rele(db, FTAG);
return (ENOSPC);
return (SET_ERROR(ENOSPC));
} else if ((flag & DNODE_MUST_BE_ALLOCATED) &&
!dnode_is_allocated(db, idx)) {
dbuf_rele(db, FTAG);
return (ENOENT);
return (SET_ERROR(ENOENT));
}
dnh = &children_dnodes->dnc_children[idx];
@@ -1308,7 +1308,7 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag, int slots,
mutex_exit(&dn->dn_mtx);
zrl_remove(&dnh->dnh_zrlock);
dbuf_rele(db, FTAG);
return (type == DMU_OT_NONE ? ENOENT : EEXIST);
return (SET_ERROR(type == DMU_OT_NONE ? ENOENT : EEXIST));
}
if (refcount_add(&dn->dn_holds, tag) == 1)
dbuf_add_ref(db, dnh);