X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fsa.c;h=37b815f94e8dcfe25216c73ab4be3c8973e2d238;hb=60101509ee73c6e61e50c0a4079097f31bb39f4b;hp=4cb4546b251109e105820a4bcdc721372e68f22c;hpb=572e285762521df27fe5b026f409ba1a21abb7ac;p=zfs.git diff --git a/module/zfs/sa.c b/module/zfs/sa.c index 4cb4546..37b815f 100644 --- a/module/zfs/sa.c +++ b/module/zfs/sa.c @@ -398,6 +398,8 @@ sa_attr_op(sa_handle_t *hdl, sa_bulk_attr_t *bulk, int count, if (error) return (error); break; + default: + break; } } return (error); @@ -640,7 +642,7 @@ sa_build_layouts(sa_handle_t *hdl, sa_bulk_attr_t *attr_desc, int attr_count, int buf_space; sa_attr_type_t *attrs, *attrs_start; int i, lot_count; - int hdrsize, spillhdrsize; + int hdrsize, spillhdrsize = 0; int used; dmu_object_type_t bonustype; sa_lot_t *lot; @@ -811,7 +813,7 @@ sa_attr_table_setup(objset_t *os, sa_attr_reg_t *reg_attrs, int count) { sa_os_t *sa = os->os_sa; uint64_t sa_attr_count = 0; - uint64_t sa_reg_count; + uint64_t sa_reg_count = 0; int error = 0; uint64_t attr_value; sa_attr_table_t *tb; @@ -1103,16 +1105,16 @@ sa_tear_down(objset_t *os) sa_free_attr_table(sa); cookie = NULL; - while (layout = avl_destroy_nodes(&sa->sa_layout_hash_tree, &cookie)) { + while ((layout = avl_destroy_nodes(&sa->sa_layout_hash_tree, &cookie))){ sa_idx_tab_t *tab; - while (tab = list_head(&layout->lot_idx_tab)) { + while ((tab = list_head(&layout->lot_idx_tab))) { ASSERT(refcount_count(&tab->sa_refcount)); sa_idx_tab_rele(os, tab); } } cookie = NULL; - while (layout = avl_destroy_nodes(&sa->sa_layout_num_tree, &cookie)) { + while ((layout = avl_destroy_nodes(&sa->sa_layout_num_tree, &cookie))){ kmem_free(layout->lot_attrs, sizeof (sa_attr_type_t) * layout->lot_attr_count); kmem_free(layout, sizeof (sa_lot_t)); @@ -1204,9 +1206,9 @@ sa_byteswap(sa_handle_t *hdl, sa_buf_type_t buftype) { sa_hdr_phys_t *sa_hdr_phys = SA_GET_HDR(hdl, buftype); dmu_buf_impl_t *db; - sa_os_t *sa = hdl->sa_os->os_sa; int num_lengths = 1; int i; + ASSERTV(sa_os_t *sa = hdl->sa_os->os_sa); ASSERT(MUTEX_HELD(&sa->sa_lock)); if (sa_hdr_phys->sa_magic == SA_MAGIC) @@ -1307,7 +1309,7 @@ sa_idx_tab_rele(objset_t *os, void *arg) static void sa_idx_tab_hold(objset_t *os, sa_idx_tab_t *idx_tab) { - sa_os_t *sa = os->os_sa; + ASSERTV(sa_os_t *sa = os->os_sa); ASSERT(MUTEX_HELD(&sa->sa_lock)); (void) refcount_add(&idx_tab->sa_refcount, NULL); @@ -1343,10 +1345,10 @@ sa_handle_get_from_db(objset_t *os, dmu_buf_t *db, void *userp, sa_handle_type_t hdl_type, sa_handle_t **handlepp) { int error = 0; - dmu_object_info_t doi; sa_handle_t *handle; - #ifdef ZFS_DEBUG + dmu_object_info_t doi; + dmu_object_info_from_db(db, &doi); ASSERT(doi.doi_bonus_type == DMU_OT_SA || doi.doi_bonus_type == DMU_OT_ZNODE); @@ -1385,7 +1387,7 @@ sa_handle_get(objset_t *objset, uint64_t objid, void *userp, dmu_buf_t *db; int error; - if (error = dmu_bonus_hold(objset, objid, NULL, &db)) + if ((error = dmu_bonus_hold(objset, objid, NULL, &db))) return (error); return (sa_handle_get_from_db(objset, db, userp, hdl_type, @@ -1478,8 +1480,8 @@ sa_find_idx_tab(objset_t *os, dmu_object_type_t bonustype, void *data) /* Verify header size is consistent with layout information */ ASSERT(tb); - ASSERT(IS_SA_BONUSTYPE(bonustype) && - SA_HDR_SIZE_MATCH_LAYOUT(hdr, tb) || !IS_SA_BONUSTYPE(bonustype) || + ASSERT((IS_SA_BONUSTYPE(bonustype) && + SA_HDR_SIZE_MATCH_LAYOUT(hdr, tb)) || !IS_SA_BONUSTYPE(bonustype) || (IS_SA_BONUSTYPE(bonustype) && hdr->sa_layout_info == 0)); /* @@ -1545,12 +1547,12 @@ sa_attr_register_sync(sa_handle_t *hdl, dmu_tx_t *tx) mutex_enter(&sa->sa_lock); - if (!sa->sa_need_attr_registration || sa->sa_master_obj == NULL) { + if (!sa->sa_need_attr_registration || sa->sa_master_obj == 0) { mutex_exit(&sa->sa_lock); return; } - if (sa->sa_reg_attr_obj == NULL) { + if (sa->sa_reg_attr_obj == 0) { sa->sa_reg_attr_obj = zap_create(hdl->sa_os, DMU_OT_SA_ATTR_REGISTRATION, DMU_OT_NONE, 0, tx); VERIFY(zap_add(hdl->sa_os, sa->sa_master_obj, @@ -1617,7 +1619,7 @@ sa_modify_attrs(sa_handle_t *hdl, sa_attr_type_t newattr, sa_bulk_attr_t *attr_desc; void *old_data[2]; int bonus_attr_count = 0; - int bonus_data_size, spill_data_size; + int bonus_data_size = 0, spill_data_size = 0; int spill_attr_count = 0; int error; uint16_t length;