diff options
Diffstat (limited to 'module')
94 files changed, 358 insertions, 284 deletions
diff --git a/module/avl/avl.c b/module/avl/avl.c index c9727c643..a9634d701 100644 --- a/module/avl/avl.c +++ b/module/avl/avl.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + /* diff --git a/module/avl/include/sys/avl.h b/module/avl/include/sys/avl.h index 02263a5a0..b2f35f79a 100644 --- a/module/avl/include/sys/avl.h +++ b/module/avl/include/sys/avl.h @@ -26,7 +26,7 @@ #ifndef _AVL_H #define _AVL_H -#pragma ident "%Z%%M% %I% %E% SMI" + /* * This is a private header file. Applications should not directly include diff --git a/module/avl/include/sys/avl_impl.h b/module/avl/include/sys/avl_impl.h index 620685f37..fddf76906 100644 --- a/module/avl/include/sys/avl_impl.h +++ b/module/avl/include/sys/avl_impl.h @@ -27,7 +27,7 @@ #ifndef _AVL_IMPL_H #define _AVL_IMPL_H -#pragma ident "%Z%%M% %I% %E% SMI" + /* * This is a private header file. Applications should not directly include diff --git a/module/nvpair/include/sys/nvpair.h b/module/nvpair/include/sys/nvpair.h index 9e768541f..14a45956f 100644 --- a/module/nvpair/include/sys/nvpair.h +++ b/module/nvpair/include/sys/nvpair.h @@ -26,7 +26,7 @@ #ifndef _SYS_NVPAIR_H #define _SYS_NVPAIR_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/types.h> #include <sys/errno.h> diff --git a/module/nvpair/include/sys/nvpair_impl.h b/module/nvpair/include/sys/nvpair_impl.h index f12dbbfe6..b851ddd54 100644 --- a/module/nvpair/include/sys/nvpair_impl.h +++ b/module/nvpair/include/sys/nvpair_impl.h @@ -27,7 +27,7 @@ #ifndef _NVPAIR_IMPL_H #define _NVPAIR_IMPL_H -#pragma ident "%Z%%M% %I% %E% SMI" + #ifdef __cplusplus extern "C" { diff --git a/module/nvpair/nvpair.c b/module/nvpair/nvpair.c index cee02a04b..a3e624d40 100644 --- a/module/nvpair/nvpair.c +++ b/module/nvpair/nvpair.c @@ -24,7 +24,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/stropts.h> #include <sys/debug.h> @@ -1560,10 +1560,10 @@ nvlist_lookup_nvpair_ei_sep(nvlist_t *nvl, const char *name, const char sep, { nvpair_t *nvp; const char *np; - char *sepp; + char *sepp = NULL; char *idxp, *idxep; nvlist_t **nva; - long idx; + long idx = 0; int n; if (ip) diff --git a/module/unicode/include/sys/u8_textprep.h b/module/unicode/include/sys/u8_textprep.h index e30f064b2..f8b5bed6e 100644 --- a/module/unicode/include/sys/u8_textprep.h +++ b/module/unicode/include/sys/u8_textprep.h @@ -26,7 +26,7 @@ #ifndef _SYS_U8_TEXTPREP_H #define _SYS_U8_TEXTPREP_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/isa_defs.h> #include <sys/types.h> diff --git a/module/unicode/include/sys/u8_textprep_data.h b/module/unicode/include/sys/u8_textprep_data.h index de6866096..03f71f26c 100644 --- a/module/unicode/include/sys/u8_textprep_data.h +++ b/module/unicode/include/sys/u8_textprep_data.h @@ -68,7 +68,7 @@ #ifndef _SYS_U8_TEXTPREP_DATA_H #define _SYS_U8_TEXTPREP_DATA_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/types.h> diff --git a/module/unicode/u8_textprep.c b/module/unicode/u8_textprep.c index 635f00d44..2532769c8 100644 --- a/module/unicode/u8_textprep.c +++ b/module/unicode/u8_textprep.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + /* diff --git a/module/unicode/uconv.c b/module/unicode/uconv.c index fd65fc99b..b996e1f60 100644 --- a/module/unicode/uconv.c +++ b/module/unicode/uconv.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + /* * Unicode encoding conversion functions among UTF-8, UTF-16, and UTF-32. diff --git a/module/zcommon/include/sys/fm/fs/zfs.h b/module/zcommon/include/sys/fm/fs/zfs.h index 66ca9c5d7..41b936a73 100644 --- a/module/zcommon/include/sys/fm/fs/zfs.h +++ b/module/zcommon/include/sys/fm/fs/zfs.h @@ -26,7 +26,7 @@ #ifndef _SYS_FM_FS_ZFS_H #define _SYS_FM_FS_ZFS_H -#pragma ident "%Z%%M% %I% %E% SMI" + #ifdef __cplusplus extern "C" { diff --git a/module/zcommon/include/zfs_comutil.h b/module/zcommon/include/zfs_comutil.h index f517044a8..b52e31e88 100644 --- a/module/zcommon/include/zfs_comutil.h +++ b/module/zcommon/include/zfs_comutil.h @@ -26,7 +26,7 @@ #ifndef _ZFS_COMUTIL_H #define _ZFS_COMUTIL_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/fs/zfs.h> #include <sys/types.h> diff --git a/module/zcommon/include/zfs_deleg.h b/module/zcommon/include/zfs_deleg.h index 561b73e63..ae63584ad 100644 --- a/module/zcommon/include/zfs_deleg.h +++ b/module/zcommon/include/zfs_deleg.h @@ -26,7 +26,7 @@ #ifndef _ZFS_DELEG_H #define _ZFS_DELEG_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/fs/zfs.h> diff --git a/module/zcommon/include/zfs_namecheck.h b/module/zcommon/include/zfs_namecheck.h index ec85e62f7..ab83cdf1d 100644 --- a/module/zcommon/include/zfs_namecheck.h +++ b/module/zcommon/include/zfs_namecheck.h @@ -26,7 +26,7 @@ #ifndef _ZFS_NAMECHECK_H #define _ZFS_NAMECHECK_H -#pragma ident "%Z%%M% %I% %E% SMI" + #ifdef __cplusplus extern "C" { diff --git a/module/zcommon/include/zfs_prop.h b/module/zcommon/include/zfs_prop.h index da5ae4309..bcc1b50c3 100644 --- a/module/zcommon/include/zfs_prop.h +++ b/module/zcommon/include/zfs_prop.h @@ -26,7 +26,7 @@ #ifndef _ZFS_PROP_H #define _ZFS_PROP_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/fs/zfs.h> #include <sys/types.h> diff --git a/module/zcommon/zfs_comutil.c b/module/zcommon/zfs_comutil.c index 74517a3f6..2b9869f18 100644 --- a/module/zcommon/zfs_comutil.c +++ b/module/zcommon/zfs_comutil.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + /* * This file is intended for functions that ought to be common between user diff --git a/module/zcommon/zfs_deleg.c b/module/zcommon/zfs_deleg.c index 1b94a2856..507842adc 100644 --- a/module/zcommon/zfs_deleg.c +++ b/module/zcommon/zfs_deleg.c @@ -24,7 +24,7 @@ */ -#pragma ident "%Z%%M% %I% %E% SMI" + #if defined(_KERNEL) #include <sys/systm.h> diff --git a/module/zcommon/zfs_namecheck.c b/module/zcommon/zfs_namecheck.c index a9d109be2..4926eac82 100644 --- a/module/zcommon/zfs_namecheck.c +++ b/module/zcommon/zfs_namecheck.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + /* * Common name validation routines for ZFS. These routines are shared by the diff --git a/module/zcommon/zfs_prop.c b/module/zcommon/zfs_prop.c index effd2dba7..b273c6ef9 100644 --- a/module/zcommon/zfs_prop.c +++ b/module/zcommon/zfs_prop.c @@ -372,15 +372,15 @@ zfs_prop_user(const char *name) * (strings) and internal representation (uint64_t). */ int -zfs_prop_string_to_index(zfs_prop_t prop, const char *string, uint64_t *index) +zfs_prop_string_to_index(zfs_prop_t prop, const char *string, uint64_t *idx) { - return (zprop_string_to_index(prop, string, index, ZFS_TYPE_DATASET)); + return (zprop_string_to_index(prop, string, idx, ZFS_TYPE_DATASET)); } int -zfs_prop_index_to_string(zfs_prop_t prop, uint64_t index, const char **string) +zfs_prop_index_to_string(zfs_prop_t prop, uint64_t idx, const char **string) { - return (zprop_index_to_string(prop, index, string, ZFS_TYPE_DATASET)); + return (zprop_index_to_string(prop, idx, string, ZFS_TYPE_DATASET)); } /* diff --git a/module/zcommon/zpool_prop.c b/module/zcommon/zpool_prop.c index f5efe18d2..562165b7a 100644 --- a/module/zcommon/zpool_prop.c +++ b/module/zcommon/zpool_prop.c @@ -152,16 +152,16 @@ zpool_prop_default_numeric(zpool_prop_t prop) int zpool_prop_string_to_index(zpool_prop_t prop, const char *string, - uint64_t *index) + uint64_t *idx) { - return (zprop_string_to_index(prop, string, index, ZFS_TYPE_POOL)); + return (zprop_string_to_index(prop, string, idx, ZFS_TYPE_POOL)); } int -zpool_prop_index_to_string(zpool_prop_t prop, uint64_t index, +zpool_prop_index_to_string(zpool_prop_t prop, uint64_t idx, const char **string) { - return (zprop_index_to_string(prop, index, string, ZFS_TYPE_POOL)); + return (zprop_index_to_string(prop, idx, string, ZFS_TYPE_POOL)); } #ifndef _KERNEL diff --git a/module/zcommon/zprop_common.c b/module/zcommon/zprop_common.c index bd267e2e6..48d58f302 100644 --- a/module/zcommon/zprop_common.c +++ b/module/zcommon/zprop_common.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + /* * Common routines used by zfs and zpool property management. @@ -158,7 +158,7 @@ int zprop_iter_common(zprop_func func, void *cb, boolean_t show_all, boolean_t ordered, zfs_type_t type) { - int i, num_props, size, prop; + int i, j, num_props, size, prop; zprop_desc_t *prop_tbl; zprop_desc_t **order; @@ -173,7 +173,7 @@ zprop_iter_common(zprop_func func, void *cb, boolean_t show_all, return (ZPROP_CONT); #endif - for (int j = 0; j < num_props; j++) + for (j = 0; j < num_props; j++) order[j] = &prop_tbl[j]; if (ordered) { @@ -261,7 +261,7 @@ zprop_name_to_prop(const char *propname, zfs_type_t type) } int -zprop_string_to_index(int prop, const char *string, uint64_t *index, +zprop_string_to_index(int prop, const char *string, uint64_t *idx, zfs_type_t type) { zprop_desc_t *prop_tbl; @@ -278,7 +278,7 @@ zprop_string_to_index(int prop, const char *string, uint64_t *index, for (i = 0; idx_tbl[i].pi_name != NULL; i++) { if (strcmp(string, idx_tbl[i].pi_name) == 0) { - *index = idx_tbl[i].pi_value; + *idx = idx_tbl[i].pi_value; return (0); } } @@ -287,7 +287,7 @@ zprop_string_to_index(int prop, const char *string, uint64_t *index, } int -zprop_index_to_string(int prop, uint64_t index, const char **string, +zprop_index_to_string(int prop, uint64_t idx, const char **string, zfs_type_t type) { zprop_desc_t *prop_tbl; @@ -303,7 +303,7 @@ zprop_index_to_string(int prop, uint64_t index, const char **string, return (-1); for (i = 0; idx_tbl[i].pi_name != NULL; i++) { - if (idx_tbl[i].pi_value == index) { + if (idx_tbl[i].pi_value == idx) { *string = idx_tbl[i].pi_name; return (0); } diff --git a/module/zfs/arc.c b/module/zfs/arc.c index dc2ba588c..dc75baf61 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -1609,12 +1609,12 @@ arc_evict(arc_state_t *state, uint64_t spa, int64_t bytes, boolean_t recycle, if (mru_over > 0 && arc_mru_ghost->arcs_lsize[type] > 0) { int64_t todelete = MIN(arc_mru_ghost->arcs_lsize[type], mru_over); - arc_evict_ghost(arc_mru_ghost, NULL, todelete); + arc_evict_ghost(arc_mru_ghost, 0, todelete); } else if (arc_mfu_ghost->arcs_lsize[type] > 0) { int64_t todelete = MIN(arc_mfu_ghost->arcs_lsize[type], arc_mru_ghost->arcs_size + arc_mfu_ghost->arcs_size - arc_c); - arc_evict_ghost(arc_mfu_ghost, NULL, todelete); + arc_evict_ghost(arc_mfu_ghost, 0, todelete); } } @@ -1706,13 +1706,13 @@ arc_adjust(void) if (adjustment > 0 && arc_mru->arcs_lsize[ARC_BUFC_DATA] > 0) { delta = MIN(arc_mru->arcs_lsize[ARC_BUFC_DATA], adjustment); - (void) arc_evict(arc_mru, NULL, delta, FALSE, ARC_BUFC_DATA); + (void) arc_evict(arc_mru, 0, delta, FALSE, ARC_BUFC_DATA); adjustment -= delta; } if (adjustment > 0 && arc_mru->arcs_lsize[ARC_BUFC_METADATA] > 0) { delta = MIN(arc_mru->arcs_lsize[ARC_BUFC_METADATA], adjustment); - (void) arc_evict(arc_mru, NULL, delta, FALSE, + (void) arc_evict(arc_mru, 0, delta, FALSE, ARC_BUFC_METADATA); } @@ -1724,14 +1724,14 @@ arc_adjust(void) if (adjustment > 0 && arc_mfu->arcs_lsize[ARC_BUFC_DATA] > 0) { delta = MIN(adjustment, arc_mfu->arcs_lsize[ARC_BUFC_DATA]); - (void) arc_evict(arc_mfu, NULL, delta, FALSE, ARC_BUFC_DATA); + (void) arc_evict(arc_mfu, 0, delta, FALSE, ARC_BUFC_DATA); adjustment -= delta; } if (adjustment > 0 && arc_mfu->arcs_lsize[ARC_BUFC_METADATA] > 0) { int64_t delta = MIN(adjustment, arc_mfu->arcs_lsize[ARC_BUFC_METADATA]); - (void) arc_evict(arc_mfu, NULL, delta, FALSE, + (void) arc_evict(arc_mfu, 0, delta, FALSE, ARC_BUFC_METADATA); } @@ -1743,7 +1743,7 @@ arc_adjust(void) if (adjustment > 0 && arc_mru_ghost->arcs_size > 0) { delta = MIN(arc_mru_ghost->arcs_size, adjustment); - arc_evict_ghost(arc_mru_ghost, NULL, delta); + arc_evict_ghost(arc_mru_ghost, 0, delta); } adjustment = @@ -1751,7 +1751,7 @@ arc_adjust(void) if (adjustment > 0 && arc_mfu_ghost->arcs_size > 0) { delta = MIN(arc_mfu_ghost->arcs_size, adjustment); - arc_evict_ghost(arc_mfu_ghost, NULL, delta); + arc_evict_ghost(arc_mfu_ghost, 0, delta); } } @@ -2171,7 +2171,7 @@ arc_get_data_buf(arc_buf_t *buf) state = (arc_mru->arcs_lsize[type] >= size && mfu_space > arc_mfu->arcs_size) ? arc_mru : arc_mfu; } - if ((buf->b_data = arc_evict(state, NULL, size, TRUE, type)) == NULL) { + if ((buf->b_data = arc_evict(state, 0, size, TRUE, type)) == NULL) { if (type == ARC_BUFC_METADATA) { buf->b_data = zio_buf_alloc(size); arc_space_consume(size, ARC_SPACE_DATA); @@ -2524,7 +2524,7 @@ arc_read_nolock(zio_t *pio, spa_t *spa, blkptr_t *bp, uint32_t *arc_flags, const zbookmark_t *zb) { arc_buf_hdr_t *hdr; - arc_buf_t *buf; + arc_buf_t *buf = NULL; kmutex_t *hash_lock; zio_t *rzio; uint64_t guid = spa_guid(spa); @@ -2922,7 +2922,7 @@ arc_release(arc_buf_t *buf, void *tag) arc_buf_hdr_t *hdr; kmutex_t *hash_lock; l2arc_buf_hdr_t *l2hdr; - uint64_t buf_size; + uint64_t buf_size = 0; rw_enter(&buf->b_lock, RW_WRITER); hdr = buf->b_hdr; @@ -3862,7 +3862,7 @@ out: * Free buffers that were tagged for destruction. */ static void -l2arc_do_free_on_write() +l2arc_do_free_on_write(void) { list_t *buflist; l2arc_data_free_t *df, *df_prev; @@ -4042,7 +4042,7 @@ l2arc_read_done(zio_t *zio) static list_t * l2arc_list_locked(int list_num, kmutex_t **lock) { - list_t *list; + list_t *list = NULL; ASSERT(list_num >= 0 && list_num <= 3); @@ -4215,11 +4215,12 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz) list_t *list; uint64_t passed_sz, write_sz, buf_sz, headroom; void *buf_data; - kmutex_t *hash_lock, *list_lock; + kmutex_t *hash_lock, *list_lock = NULL; boolean_t have_lock, full; l2arc_write_callback_t *cb; zio_t *pio, *wzio; uint64_t guid = spa_guid(spa); + int try; ASSERT(dev->l2ad_vdev != NULL); @@ -4233,7 +4234,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz) * Copy buffers for L2ARC writing. */ mutex_enter(&l2arc_buflist_mtx); - for (int try = 0; try <= 3; try++) { + for (try = 0; try <= 3; try++) { list = l2arc_list_locked(try, &list_lock); passed_sz = 0; diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index 6221f95e0..8257e40f9 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -110,11 +110,13 @@ dbuf_find(dnode_t *dn, uint8_t level, uint64_t blkid) { dbuf_hash_table_t *h = &dbuf_hash_table; objset_impl_t *os = dn->dn_objset; - uint64_t obj = dn->dn_object; - uint64_t hv = DBUF_HASH(os, obj, level, blkid); - uint64_t idx = hv & h->hash_table_mask; + uint64_t obj, hv, idx; dmu_buf_impl_t *db; + obj = dn->dn_object; + hv = DBUF_HASH(os, obj, level, blkid); + idx = hv & h->hash_table_mask; + mutex_enter(DBUF_HASH_MUTEX(h, idx)); for (db = h->hash_table[idx]; db != NULL; db = db->db_hash_next) { if (DBUF_EQUAL(db, os, obj, level, blkid)) { @@ -143,11 +145,13 @@ dbuf_hash_insert(dmu_buf_impl_t *db) objset_impl_t *os = db->db_objset; uint64_t obj = db->db.db_object; int level = db->db_level; - uint64_t blkid = db->db_blkid; - uint64_t hv = DBUF_HASH(os, obj, level, blkid); - uint64_t idx = hv & h->hash_table_mask; + uint64_t blkid, hv, idx; dmu_buf_impl_t *dbf; + blkid = db->db_blkid; + hv = DBUF_HASH(os, obj, level, blkid); + idx = hv & h->hash_table_mask; + mutex_enter(DBUF_HASH_MUTEX(h, idx)); for (dbf = h->hash_table[idx]; dbf != NULL; dbf = dbf->db_hash_next) { if (DBUF_EQUAL(dbf, os, obj, level, blkid)) { @@ -177,11 +181,13 @@ static void dbuf_hash_remove(dmu_buf_impl_t *db) { dbuf_hash_table_t *h = &dbuf_hash_table; - uint64_t hv = DBUF_HASH(db->db_objset, db->db.db_object, - db->db_level, db->db_blkid); - uint64_t idx = hv & h->hash_table_mask; + uint64_t hv, idx; dmu_buf_impl_t *dbf, **dbp; + hv = DBUF_HASH(db->db_objset, db->db.db_object, + db->db_level, db->db_blkid); + idx = hv & h->hash_table_mask; + /* * We musn't hold db_mtx to maintin lock ordering: * DBUF_HASH_MUTEX > db_mtx. @@ -1736,8 +1742,7 @@ dbuf_create_bonus(dnode_t *dn) void dbuf_add_ref(dmu_buf_impl_t *db, void *tag) { - int64_t holds = refcount_add(&db->db_holds, tag); - ASSERT(holds > 1); + VERIFY(refcount_add(&db->db_holds, tag) > 1); } #pragma weak dmu_buf_rele = dbuf_rele @@ -2326,17 +2331,15 @@ dbuf_write_done(zio_t *zio, arc_buf_t *buf, void *vdb) ASSERT(arc_released(db->db_buf)); } } else { - dnode_t *dn = db->db_dnode; - ASSERT(list_head(&dr->dt.di.dr_children) == NULL); - ASSERT3U(db->db.db_size, ==, 1<<dn->dn_phys->dn_indblkshift); + ASSERT3U(db->db.db_size, ==, + 1<<db->db_dnode->dn_phys->dn_indblkshift); if (!BP_IS_HOLE(db->db_blkptr)) { - int epbs = - dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT; ASSERT3U(BP_GET_LSIZE(db->db_blkptr), ==, db->db.db_size); - ASSERT3U(dn->dn_phys->dn_maxblkid - >> (db->db_level * epbs), >=, db->db_blkid); + ASSERT3U(db->db_dnode->dn_phys->dn_maxblkid >> (db->db_level * + (db->db_dnode->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT)), + >=, db->db_blkid); arc_set_callback(db->db_buf, dbuf_do_evict, db); } mutex_destroy(&dr->dt.di.dr_mtx); diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c index b6205bd50..ea2bcb940 100644 --- a/module/zfs/dmu.c +++ b/module/zfs/dmu.c @@ -181,7 +181,7 @@ dmu_bonus_hold(objset_t *os, uint64_t object, void *tag, dmu_buf_t **dbp) */ static int dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, - uint64_t length, int read, void *tag, int *numbufsp, dmu_buf_t ***dbpp) + uint64_t length, int rd, void *tag, int *numbufsp, dmu_buf_t ***dbpp) { dsl_pool_t *dp = NULL; dmu_buf_t **dbp; @@ -231,7 +231,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, return (EIO); } /* initiate async i/o */ - if (read) { + if (rd) { rw_exit(&dn->dn_struct_rwlock); (void) dbuf_read(db, zio, flags); rw_enter(&dn->dn_struct_rwlock, RW_READER); @@ -251,7 +251,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, } /* wait for other io to complete */ - if (read) { + if (rd) { for (i = 0; i < nblks; i++) { dmu_buf_impl_t *db = (dmu_buf_impl_t *)dbp[i]; mutex_enter(&db->db_mtx); @@ -275,7 +275,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, static int dmu_buf_hold_array(objset_t *os, uint64_t object, uint64_t offset, - uint64_t length, int read, void *tag, int *numbufsp, dmu_buf_t ***dbpp) + uint64_t length, int rd, void *tag, int *numbufsp, dmu_buf_t ***dbpp) { dnode_t *dn; int err; @@ -284,7 +284,7 @@ dmu_buf_hold_array(objset_t *os, uint64_t object, uint64_t offset, if (err) return (err); - err = dmu_buf_hold_array_by_dnode(dn, offset, length, read, tag, + err = dmu_buf_hold_array_by_dnode(dn, offset, length, rd, tag, numbufsp, dbpp); dnode_rele(dn, FTAG); @@ -294,12 +294,12 @@ dmu_buf_hold_array(objset_t *os, uint64_t object, uint64_t offset, int dmu_buf_hold_array_by_bonus(dmu_buf_t *db, uint64_t offset, - uint64_t length, int read, void *tag, int *numbufsp, dmu_buf_t ***dbpp) + uint64_t length, int rd, void *tag, int *numbufsp, dmu_buf_t ***dbpp) { dnode_t *dn = ((dmu_buf_impl_t *)db)->db_dnode; int err; - err = dmu_buf_hold_array_by_dnode(dn, offset, length, read, tag, + err = dmu_buf_hold_array_by_dnode(dn, offset, length, rd, tag, numbufsp, dbpp); return (err); diff --git a/module/zfs/dmu_object.c b/module/zfs/dmu_object.c index 1b9247d66..8f1ecf197 100644 --- a/module/zfs/dmu_object.c +++ b/module/zfs/dmu_object.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/dmu.h> #include <sys/dmu_objset.h> diff --git a/module/zfs/dmu_objset.c b/module/zfs/dmu_objset.c index b4dc06b3f..5aa5be88b 100644 --- a/module/zfs/dmu_objset.c +++ b/module/zfs/dmu_objset.c @@ -843,6 +843,8 @@ dmu_objset_sync_dnodes(list_t *list, dmu_tx_t *tx) static void ready(zio_t *zio, arc_buf_t *abuf, void *arg) { + int i; + blkptr_t *bp = zio->io_bp; blkptr_t *bp_orig = &zio->io_bp_orig; objset_impl_t *os = arg; @@ -856,7 +858,7 @@ ready(zio_t *zio, arc_buf_t *abuf, void *arg) * Update rootbp fill count. */ bp->blk_fill = 1; /* count the meta-dnode */ - for (int i = 0; i < dnp->dn_nblkptr; i++) + for (i = 0; i < dnp->dn_nblkptr; i++) bp->blk_fill += dnp->dn_blkptr[i].blk_fill; if (zio->io_flags & ZIO_FLAG_IO_REWRITE) { @@ -960,11 +962,11 @@ dmu_objset_fsid_guid(objset_t *os) } void -dmu_objset_fast_stat(objset_t *os, dmu_objset_stats_t *stat) +dmu_objset_fast_stat(objset_t *os, dmu_objset_stats_t *st) { - stat->dds_type = os->os->os_phys->os_type; + st->dds_type = os->os->os_phys->os_type; if (os->os->os_dsl_dataset) - dsl_dataset_fast_stat(os->os->os_dsl_dataset, stat); + dsl_dataset_fast_stat(os->os->os_dsl_dataset, st); } void diff --git a/module/zfs/dmu_send.c b/module/zfs/dmu_send.c index 6043df0aa..84edbaf37 100644 --- a/module/zfs/dmu_send.c +++ b/module/zfs/dmu_send.c @@ -958,6 +958,28 @@ dmu_recv_abort_cleanup(dmu_recv_cookie_t *drc) } /* + * Compute checksum of drr_begin record + */ +static void +dmu_recv_stream_cksum(dmu_recv_cookie_t *drc, struct restorearg *ra) +{ + dmu_replay_record_t *drr; + + drr = kmem_zalloc(sizeof (dmu_replay_record_t), KM_SLEEP); + + drr->drr_type = DRR_BEGIN; + drr->drr_u.drr_begin = *drc->drc_drrb; + if (ra->byteswap) { + fletcher_4_incremental_byteswap(drr, + sizeof (dmu_replay_record_t), &(ra->cksum)); + } else { + fletcher_4_incremental_native(drr, + sizeof (dmu_replay_record_t), &(ra->cksum)); + } + kmem_free(drr, sizeof (dmu_replay_record_t)); +} + +/* * NB: callers *must* call dmu_recv_end() if this succeeds. */ int @@ -971,22 +993,7 @@ dmu_recv_stream(dmu_recv_cookie_t *drc, vnode_t *vp, offset_t *voffp) if (drc->drc_drrb->drr_magic == BSWAP_64(DMU_BACKUP_MAGIC)) ra.byteswap = TRUE; - { - /* compute checksum of drr_begin record */ - dmu_replay_record_t *drr; - drr = kmem_zalloc(sizeof (dmu_replay_record_t), KM_SLEEP); - - drr->drr_type = DRR_BEGIN; - drr->drr_u.drr_begin = *drc->drc_drrb; - if (ra.byteswap) { - fletcher_4_incremental_byteswap(drr, - sizeof (dmu_replay_record_t), &ra.cksum); - } else { - fletcher_4_incremental_native(drr, - sizeof (dmu_replay_record_t), &ra.cksum); - } - kmem_free(drr, sizeof (dmu_replay_record_t)); - } + dmu_recv_stream_cksum(drc, &ra); if (ra.byteswap) { struct drr_begin *drrb = drc->drc_drrb; diff --git a/module/zfs/dmu_traverse.c b/module/zfs/dmu_traverse.c index 197284e1e..e4cb35bd1 100644 --- a/module/zfs/dmu_traverse.c +++ b/module/zfs/dmu_traverse.c @@ -309,7 +309,7 @@ traverse_impl(spa_t *spa, uint64_t objset, blkptr_t *rootbp, uint64_t txg_start, int flags, blkptr_cb_t func, void *arg) { struct traverse_data td; - struct prefetch_data pd = { 0 }; + struct prefetch_data pd; zbookmark_t czb; int err; @@ -323,7 +323,10 @@ traverse_impl(spa_t *spa, uint64_t objset, blkptr_t *rootbp, td.td_flags = flags; pd.pd_blks_max = 100; + pd.pd_blks_fetched = 0; pd.pd_flags = flags; + pd.pd_cancel = B_FALSE; + pd.pd_exited = B_FALSE; mutex_init(&pd.pd_mtx, NULL, MUTEX_DEFAULT, NULL); cv_init(&pd.pd_cv, NULL, CV_DEFAULT, NULL); diff --git a/module/zfs/dmu_zfetch.c b/module/zfs/dmu_zfetch.c index 4d79fe98e..6b5d58528 100644 --- a/module/zfs/dmu_zfetch.c +++ b/module/zfs/dmu_zfetch.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/zfs_context.h> #include <sys/dnode.h> @@ -411,7 +411,7 @@ top: if (zs) { if (reset) { - zstream_t *remove = zs; + zstream_t *rm = zs; rc = 0; mutex_exit(&zs->zst_lock); @@ -423,7 +423,7 @@ top: */ for (zs = list_head(&zf->zf_stream); zs; zs = list_next(&zf->zf_stream, zs)) { - if (zs == remove) { + if (zs == rm) { dmu_zfetch_stream_remove(zf, zs); mutex_destroy(&zs->zst_lock); kmem_free(zs, sizeof (zstream_t)); diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c index 601c46d2c..78b2c15d2 100644 --- a/module/zfs/dnode.c +++ b/module/zfs/dnode.c @@ -40,7 +40,9 @@ static int free_range_compar(const void *node1, const void *node2); static kmem_cache_t *dnode_cache; +#ifndef NDEBUG static dnode_phys_t dnode_phys_zero; +#endif int zfs_default_bs = SPA_MINBLOCKSHIFT; int zfs_default_ibs = DN_MAX_INDBLKSHIFT; @@ -133,7 +135,6 @@ dnode_verify(dnode_t *dn) } if (dn->dn_phys->dn_type != DMU_OT_NONE || dn->dn_allocated_txg != 0) { int i; - ASSERT3U(dn->dn_indblkshift, >=, 0); ASSERT3U(dn->dn_indblkshift, <=, SPA_MAXBLOCKSHIFT); if (dn->dn_datablkshift) { ASSERT3U(dn->dn_datablkshift, >=, SPA_MINBLOCKSHIFT); @@ -521,11 +522,12 @@ dnode_buf_pageout(dmu_buf_t *db, void *arg) for (i = 0; i < epb; i++) { dnode_t *dn = children_dnodes[i]; - int n; if (dn == NULL) continue; #ifdef ZFS_DEBUG + { + int n; /* * If there are holds on this dnode, then there should * be holds on the dnode's containing dbuf as well; thus @@ -538,6 +540,7 @@ dnode_buf_pageout(dmu_buf_t *db, void *arg) for (n = 0; n < TXG_SIZE; n++) ASSERT(!list_link_active(&dn->dn_dirty_link[n])); + } #endif children_dnodes[i] = NULL; dnode_destroy(dn); @@ -612,10 +615,10 @@ dnode_hold_impl(objset_impl_t *os, uint64_t object, int flag, } if ((dn = children_dnodes[idx]) == NULL) { - dnode_phys_t *dnp = (dnode_phys_t *)db->db.db_data+idx; + dnode_phys_t *dnpp = (dnode_phys_t *)db->db.db_data+idx; dnode_t *winner; - dn = dnode_create(os, dnp, db, object); + dn = dnode_create(os, dnpp, db, object); winner = atomic_cas_ptr(&children_dnodes[idx], NULL, dn); if (winner != NULL) { dnode_destroy(dn); diff --git a/module/zfs/dnode_sync.c b/module/zfs/dnode_sync.c index b47034dc9..01be9bf57 100644 --- a/module/zfs/dnode_sync.c +++ b/module/zfs/dnode_sync.c @@ -317,8 +317,10 @@ dnode_sync_free_range(dnode_t *dn, uint64_t blkid, uint64_t nblks, dmu_tx_t *tx) ASSERT3U(blkid + nblks, <=, dn->dn_phys->dn_nblkptr); (void) free_blocks(dn, bp + blkid, nblks, tx); if (trunc) { +#ifndef NDEBUG uint64_t off = (dn->dn_phys->dn_maxblkid + 1) * (dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT); +#endif dn->dn_phys->dn_maxblkid = (blkid ? blkid - 1 : 0); ASSERT(off < dn->dn_phys->dn_maxblkid || dn->dn_phys->dn_maxblkid == 0 || @@ -347,8 +349,10 @@ dnode_sync_free_range(dnode_t *dn, uint64_t blkid, uint64_t nblks, dmu_tx_t *tx) dbuf_rele(db, FTAG); } if (trunc) { +#ifndef NDEBUG uint64_t off = (dn->dn_phys->dn_maxblkid + 1) * (dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT); +#endif dn->dn_phys->dn_maxblkid = (blkid ? blkid - 1 : 0); ASSERT(off < dn->dn_phys->dn_maxblkid || dn->dn_phys->dn_maxblkid == 0 || diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c index 0f904784a..a11f226a0 100644 --- a/module/zfs/dsl_dataset.c +++ b/module/zfs/dsl_dataset.c @@ -78,11 +78,13 @@ parent_delta(dsl_dataset_t *ds, int64_t delta) void dsl_dataset_block_born(dsl_dataset_t *ds, blkptr_t *bp, dmu_tx_t *tx) { - int used = bp_get_dasize(tx->tx_pool->dp_spa, bp); - int compressed = BP_GET_PSIZE(bp); - int uncompressed = BP_GET_UCSIZE(bp); + int used, compressed, uncompressed; int64_t delta; + used = bp_get_dasize(tx->tx_pool->dp_spa, bp); + compressed = BP_GET_PSIZE(bp); + uncompressed = BP_GET_UCSIZE(bp); + dprintf_bp(bp, "born, ds=%p\n", ds); ASSERT(dmu_tx_is_syncing(tx)); @@ -351,7 +353,7 @@ dsl_dataset_get_ref(dsl_pool_t *dp, uint64_t dsobj, void *tag, return (err); ds = dmu_buf_get_user(dbuf); if (ds == NULL) { - dsl_dataset_t *winner; + dsl_dataset_t *winner = NULL; ds = kmem_zalloc(sizeof (dsl_dataset_t), KM_SLEEP); ds->ds_dbuf = dbuf; @@ -2000,10 +2002,8 @@ dsl_dataset_space(dsl_dataset_t *ds, boolean_t dsl_dataset_modified_since_lastsnap(dsl_dataset_t *ds) { - dsl_pool_t *dp = ds->ds_dir->dd_pool; - - ASSERT(RW_LOCK_HELD(&dp->dp_config_rwlock) || - dsl_pool_sync_context(dp)); + ASSERT(RW_LOCK_HELD(&(ds->ds_dir->dd_pool)->dp_config_rwlock) || + dsl_pool_sync_context(ds->ds_dir->dd_pool)); if (ds->ds_prev == NULL) return (B_FALSE); if (ds->ds_phys->ds_bp.blk_birth > diff --git a/module/zfs/dsl_deleg.c b/module/zfs/dsl_deleg.c index 24f68b89d..0c522fbfa 100644 --- a/module/zfs/dsl_deleg.c +++ b/module/zfs/dsl_deleg.c @@ -66,7 +66,7 @@ * The ZAP OBJ is referred to as the jump object. */ -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/dmu.h> #include <sys/dmu_objset.h> diff --git a/module/zfs/dsl_dir.c b/module/zfs/dsl_dir.c index c4fcf9882..06b460c0c 100644 --- a/module/zfs/dsl_dir.c +++ b/module/zfs/dsl_dir.c @@ -48,11 +48,10 @@ static void dsl_dir_evict(dmu_buf_t *db, void *arg) { dsl_dir_t *dd = arg; - dsl_pool_t *dp = dd->dd_pool; int t; for (t = 0; t < TXG_SIZE; t++) { - ASSERT(!txg_list_member(&dp->dp_dirty_dirs, dd, t)); + ASSERT(!txg_list_member(&dd->dd_pool->dp_dirty_dirs, dd, t)); ASSERT(dd->dd_tempreserved[t] == 0); ASSERT(dd->dd_space_towrite[t] == 0); } @@ -953,11 +952,13 @@ dsl_dir_diduse_space(dsl_dir_t *dd, dd_used_t type, dd->dd_phys->dd_used_breakdown[type] >= -used); dd->dd_phys->dd_used_breakdown[type] += used; #ifdef DEBUG - dd_used_t t; - uint64_t u = 0; - for (t = 0; t < DD_USED_NUM; t++) - u += dd->dd_phys->dd_used_breakdown[t]; - ASSERT3U(u, ==, dd->dd_phys->dd_used_bytes); + { + dd_used_t t; + uint64_t u = 0; + for (t = 0; t < DD_USED_NUM; t++) + u += dd->dd_phys->dd_used_breakdown[t]; + ASSERT3U(u, ==, dd->dd_phys->dd_used_bytes); + } #endif } if (needlock) diff --git a/module/zfs/dsl_prop.c b/module/zfs/dsl_prop.c index 212acbbc5..7f49c5060 100644 --- a/module/zfs/dsl_prop.c +++ b/module/zfs/dsl_prop.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/dmu.h> #include <sys/dmu_objset.h> @@ -370,7 +370,7 @@ dsl_prop_set_sync(void *arg1, void *arg2, cred_t *cr, dmu_tx_t *tx) if (psa->numints == 0) { int err = zap_remove(mos, zapobj, psa->name, tx); - ASSERT(err == 0 || err == ENOENT); + VERIFY(0 == err || ENOENT == err); if (isint) { VERIFY(0 == dsl_prop_get_ds(ds, psa->name, 8, 1, &intval, NULL)); diff --git a/module/zfs/dsl_scrub.c b/module/zfs/dsl_scrub.c index 783604101..f9ea6bcfd 100644 --- a/module/zfs/dsl_scrub.c +++ b/module/zfs/dsl_scrub.c @@ -927,6 +927,7 @@ dsl_pool_scrub_clean_cb(dsl_pool_t *dp, boolean_t needs_io; int zio_flags = ZIO_FLAG_SCRUB_THREAD | ZIO_FLAG_RAW | ZIO_FLAG_CANFAIL; int zio_priority; + int d; ASSERT(bp->blk_birth > dp->dp_scrub_min_txg); @@ -951,7 +952,7 @@ dsl_pool_scrub_clean_cb(dsl_pool_t *dp, if (zb->zb_level == -1 && BP_GET_TYPE(bp) != DMU_OT_OBJSET) zio_flags |= ZIO_FLAG_SPECULATIVE; - for (int d = 0; d < BP_GET_NDVAS(bp); d++) { + for (d = 0; d < BP_GET_NDVAS(bp); d++) { vdev_t *vd = vdev_lookup_top(spa, DVA_GET_VDEV(&bp->blk_dva[d])); diff --git a/module/zfs/dsl_synctask.c b/module/zfs/dsl_synctask.c index 9bb9c4580..828911170 100644 --- a/module/zfs/dsl_synctask.c +++ b/module/zfs/dsl_synctask.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/dmu.h> #include <sys/dmu_tx.h> diff --git a/module/zfs/fletcher.c b/module/zfs/fletcher.c index edda3c9a9..ca3ba2407 100644 --- a/module/zfs/fletcher.c +++ b/module/zfs/fletcher.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/types.h> #include <sys/sysmacros.h> diff --git a/module/zfs/gzip.c b/module/zfs/gzip.c index b257d4af7..aa0254806 100644 --- a/module/zfs/gzip.c +++ b/module/zfs/gzip.c @@ -24,7 +24,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/debug.h> #include <sys/types.h> diff --git a/module/zfs/include/sys/dmu_tx.h b/module/zfs/include/sys/dmu_tx.h index 2727daaaa..2fc1fee17 100644 --- a/module/zfs/include/sys/dmu_tx.h +++ b/module/zfs/include/sys/dmu_tx.h @@ -26,7 +26,7 @@ #ifndef _SYS_DMU_TX_H #define _SYS_DMU_TX_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/inttypes.h> #include <sys/dmu.h> diff --git a/module/zfs/include/sys/dmu_zfetch.h b/module/zfs/include/sys/dmu_zfetch.h index c94bced93..f65209c28 100644 --- a/module/zfs/include/sys/dmu_zfetch.h +++ b/module/zfs/include/sys/dmu_zfetch.h @@ -26,7 +26,7 @@ #ifndef _DFETCH_H #define _DFETCH_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/zfs_context.h> diff --git a/module/zfs/include/sys/dsl_deleg.h b/module/zfs/include/sys/dsl_deleg.h index a29e44e67..b9d420084 100644 --- a/module/zfs/include/sys/dsl_deleg.h +++ b/module/zfs/include/sys/dsl_deleg.h @@ -26,7 +26,7 @@ #ifndef _SYS_DSL_DELEG_H #define _SYS_DSL_DELEG_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/dmu.h> #include <sys/dsl_pool.h> diff --git a/module/zfs/include/sys/dsl_prop.h b/module/zfs/include/sys/dsl_prop.h index d66caa86c..88243017f 100644 --- a/module/zfs/include/sys/dsl_prop.h +++ b/module/zfs/include/sys/dsl_prop.h @@ -26,7 +26,7 @@ #ifndef _SYS_DSL_PROP_H #define _SYS_DSL_PROP_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/dmu.h> #include <sys/dsl_pool.h> diff --git a/module/zfs/include/sys/dsl_synctask.h b/module/zfs/include/sys/dsl_synctask.h index 4995bfe5a..b02243e85 100644 --- a/module/zfs/include/sys/dsl_synctask.h +++ b/module/zfs/include/sys/dsl_synctask.h @@ -26,7 +26,7 @@ #ifndef _SYS_DSL_SYNCTASK_H #define _SYS_DSL_SYNCTASK_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/txg.h> #include <sys/zfs_context.h> diff --git a/module/zfs/include/sys/metaslab_impl.h b/module/zfs/include/sys/metaslab_impl.h index 5980cbc84..936da8c45 100644 --- a/module/zfs/include/sys/metaslab_impl.h +++ b/module/zfs/include/sys/metaslab_impl.h @@ -26,7 +26,7 @@ #ifndef _SYS_METASLAB_IMPL_H #define _SYS_METASLAB_IMPL_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/metaslab.h> #include <sys/space_map.h> diff --git a/module/zfs/include/sys/refcount.h b/module/zfs/include/sys/refcount.h index d3fe7b1f8..c58ee8f55 100644 --- a/module/zfs/include/sys/refcount.h +++ b/module/zfs/include/sys/refcount.h @@ -26,7 +26,7 @@ #ifndef _SYS_REFCOUNT_H #define _SYS_REFCOUNT_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/inttypes.h> #include <sys/list.h> diff --git a/module/zfs/include/sys/rrwlock.h b/module/zfs/include/sys/rrwlock.h index 19a43c97f..798a015d1 100644 --- a/module/zfs/include/sys/rrwlock.h +++ b/module/zfs/include/sys/rrwlock.h @@ -26,7 +26,7 @@ #ifndef _SYS_RR_RW_LOCK_H #define _SYS_RR_RW_LOCK_H -#pragma ident "%Z%%M% %I% %E% SMI" + #ifdef __cplusplus extern "C" { diff --git a/module/zfs/include/sys/spa.h b/module/zfs/include/sys/spa.h index 029123dfe..09388a244 100644 --- a/module/zfs/include/sys/spa.h +++ b/module/zfs/include/sys/spa.h @@ -526,7 +526,7 @@ extern void vdev_cache_stat_fini(void); /* Initialization and termination */ extern void spa_init(int flags); extern void spa_fini(void); -extern void spa_boot_init(); +extern void spa_boot_init(void); /* properties */ extern int spa_prop_set(spa_t *spa, nvlist_t *nvp); diff --git a/module/zfs/include/sys/spa_boot.h b/module/zfs/include/sys/spa_boot.h index b56073b97..4e3d75b35 100644 --- a/module/zfs/include/sys/spa_boot.h +++ b/module/zfs/include/sys/spa_boot.h @@ -26,7 +26,7 @@ #ifndef _SYS_SPA_BOOT_H #define _SYS_SPA_BOOT_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/nvpair.h> diff --git a/module/zfs/include/sys/txg.h b/module/zfs/include/sys/txg.h index 23bdff211..ccc2cc5c6 100644 --- a/module/zfs/include/sys/txg.h +++ b/module/zfs/include/sys/txg.h @@ -26,7 +26,7 @@ #ifndef _SYS_TXG_H #define _SYS_TXG_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/spa.h> #include <sys/zfs_context.h> diff --git a/module/zfs/include/sys/uberblock.h b/module/zfs/include/sys/uberblock.h index 93d936ae4..7fef35541 100644 --- a/module/zfs/include/sys/uberblock.h +++ b/module/zfs/include/sys/uberblock.h @@ -27,7 +27,7 @@ #ifndef _SYS_UBERBLOCK_H #define _SYS_UBERBLOCK_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/spa.h> #include <sys/vdev.h> diff --git a/module/zfs/include/sys/unique.h b/module/zfs/include/sys/unique.h index 2ef3093ed..d97175286 100644 --- a/module/zfs/include/sys/unique.h +++ b/module/zfs/include/sys/unique.h @@ -26,7 +26,7 @@ #ifndef _SYS_UNIQUE_H #define _SYS_UNIQUE_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/zfs_context.h> diff --git a/module/zfs/include/sys/vdev_file.h b/module/zfs/include/sys/vdev_file.h index cd4967357..b4d40f9df 100644 --- a/module/zfs/include/sys/vdev_file.h +++ b/module/zfs/include/sys/vdev_file.h @@ -27,7 +27,7 @@ #ifndef _SYS_VDEV_FILE_H #define _SYS_VDEV_FILE_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/vdev.h> diff --git a/module/zfs/include/sys/zap.h b/module/zfs/include/sys/zap.h index f88cc068b..b8e1d81e8 100644 --- a/module/zfs/include/sys/zap.h +++ b/module/zfs/include/sys/zap.h @@ -26,7 +26,7 @@ #ifndef _SYS_ZAP_H #define _SYS_ZAP_H -#pragma ident "%Z%%M% %I% %E% SMI" + /* * ZAP - ZFS Attribute Processor diff --git a/module/zfs/include/sys/zap_impl.h b/module/zfs/include/sys/zap_impl.h index 0dc02ab6b..152b9c0c3 100644 --- a/module/zfs/include/sys/zap_impl.h +++ b/module/zfs/include/sys/zap_impl.h @@ -26,7 +26,7 @@ #ifndef _SYS_ZAP_IMPL_H #define _SYS_ZAP_IMPL_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/zap.h> #include <sys/zfs_context.h> diff --git a/module/zfs/include/sys/zap_leaf.h b/module/zfs/include/sys/zap_leaf.h index 14144e059..e47987e5a 100644 --- a/module/zfs/include/sys/zap_leaf.h +++ b/module/zfs/include/sys/zap_leaf.h @@ -26,7 +26,7 @@ #ifndef _SYS_ZAP_LEAF_H #define _SYS_ZAP_LEAF_H -#pragma ident "%Z%%M% %I% %E% SMI" + #ifdef __cplusplus extern "C" { diff --git a/module/zfs/include/sys/zfs_context.h b/module/zfs/include/sys/zfs_context.h index a5be3e130..574e209bf 100644 --- a/module/zfs/include/sys/zfs_context.h +++ b/module/zfs/include/sys/zfs_context.h @@ -26,7 +26,7 @@ #ifndef _SYS_ZFS_CONTEXT_H #define _SYS_ZFS_CONTEXT_H -#pragma ident "%Z%%M% %I% %E% SMI" + #ifdef __cplusplus extern "C" { diff --git a/module/zfs/include/sys/zfs_ctldir.h b/module/zfs/include/sys/zfs_ctldir.h index ce29625d1..e486967bf 100644 --- a/module/zfs/include/sys/zfs_ctldir.h +++ b/module/zfs/include/sys/zfs_ctldir.h @@ -26,7 +26,7 @@ #ifndef _ZFS_CTLDIR_H #define _ZFS_CTLDIR_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/pathname.h> #include <sys/vnode.h> diff --git a/module/zfs/include/sys/zfs_debug.h b/module/zfs/include/sys/zfs_debug.h index 450ac1c81..02d9da131 100644 --- a/module/zfs/include/sys/zfs_debug.h +++ b/module/zfs/include/sys/zfs_debug.h @@ -26,7 +26,7 @@ #ifndef _SYS_ZFS_DEBUG_H #define _SYS_ZFS_DEBUG_H -#pragma ident "%Z%%M% %I% %E% SMI" + #ifdef __cplusplus extern "C" { diff --git a/module/zfs/include/sys/zfs_dir.h b/module/zfs/include/sys/zfs_dir.h index ebb66e8ae..5679873ea 100644 --- a/module/zfs/include/sys/zfs_dir.h +++ b/module/zfs/include/sys/zfs_dir.h @@ -26,7 +26,7 @@ #ifndef _SYS_FS_ZFS_DIR_H #define _SYS_FS_ZFS_DIR_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/pathname.h> #include <sys/dmu.h> diff --git a/module/zfs/include/sys/zfs_fuid.h b/module/zfs/include/sys/zfs_fuid.h index 810ffc81a..3e8d36c3d 100644 --- a/module/zfs/include/sys/zfs_fuid.h +++ b/module/zfs/include/sys/zfs_fuid.h @@ -26,7 +26,7 @@ #ifndef _SYS_FS_ZFS_FUID_H #define _SYS_FS_ZFS_FUID_H -#pragma ident "%Z%%M% %I% %E% SMI" + #ifdef _KERNEL #include <sys/kidmap.h> diff --git a/module/zfs/include/sys/zfs_ioctl.h b/module/zfs/include/sys/zfs_ioctl.h index 1692608bb..9147e4097 100644 --- a/module/zfs/include/sys/zfs_ioctl.h +++ b/module/zfs/include/sys/zfs_ioctl.h @@ -26,7 +26,7 @@ #ifndef _SYS_ZFS_IOCTL_H #define _SYS_ZFS_IOCTL_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/cred.h> #include <sys/dmu.h> diff --git a/module/zfs/include/sys/zfs_rlock.h b/module/zfs/include/sys/zfs_rlock.h index f302b663e..722c341e2 100644 --- a/module/zfs/include/sys/zfs_rlock.h +++ b/module/zfs/include/sys/zfs_rlock.h @@ -26,7 +26,7 @@ #ifndef _SYS_FS_ZFS_RLOCK_H #define _SYS_FS_ZFS_RLOCK_H -#pragma ident "%Z%%M% %I% %E% SMI" + #ifdef __cplusplus extern "C" { diff --git a/module/zfs/include/sys/zfs_znode.h b/module/zfs/include/sys/zfs_znode.h index 9192abcd7..7baba54c8 100644 --- a/module/zfs/include/sys/zfs_znode.h +++ b/module/zfs/include/sys/zfs_znode.h @@ -46,17 +46,17 @@ extern "C" { * Additional file level attributes, that are stored * in the upper half of zp_flags */ -#define ZFS_READONLY 0x0000000100000000 -#define ZFS_HIDDEN 0x0000000200000000 -#define ZFS_SYSTEM 0x0000000400000000 -#define ZFS_ARCHIVE 0x0000000800000000 -#define ZFS_IMMUTABLE 0x0000001000000000 -#define ZFS_NOUNLINK 0x0000002000000000 -#define ZFS_APPENDONLY 0x0000004000000000 -#define ZFS_NODUMP 0x0000008000000000 -#define ZFS_OPAQUE 0x0000010000000000 -#define ZFS_AV_QUARANTINED 0x0000020000000000 -#define ZFS_AV_MODIFIED 0x0000040000000000 +#define ZFS_READONLY 0x0000000100000000ull +#define ZFS_HIDDEN 0x0000000200000000ull +#define ZFS_SYSTEM 0x0000000400000000ull +#define ZFS_ARCHIVE 0x0000000800000000ull +#define ZFS_IMMUTABLE 0x0000001000000000ull +#define ZFS_NOUNLINK 0x0000002000000000ull +#define ZFS_APPENDONLY 0x0000004000000000ull +#define ZFS_NODUMP 0x0000008000000000ull +#define ZFS_OPAQUE 0x0000010000000000ull +#define ZFS_AV_QUARANTINED 0x0000020000000000ull +#define ZFS_AV_MODIFIED 0x0000040000000000ull #define ZFS_ATTR_SET(zp, attr, value) \ { \ @@ -304,8 +304,8 @@ extern int zfs_rezget(znode_t *); extern void zfs_zinactive(znode_t *); extern void zfs_znode_delete(znode_t *, dmu_tx_t *); extern void zfs_znode_free(znode_t *); -extern void zfs_remove_op_tables(); -extern int zfs_create_op_tables(); +extern void zfs_remove_op_tables(void); +extern int zfs_create_op_tables(void); extern int zfs_sync(vfs_t *vfsp, short flag, cred_t *cr); extern dev_t zfs_cmpldev(uint64_t); extern int zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value); diff --git a/module/zfs/include/sys/zil.h b/module/zfs/include/sys/zil.h index b69323cfa..6a0f101d1 100644 --- a/module/zfs/include/sys/zil.h +++ b/module/zfs/include/sys/zil.h @@ -334,7 +334,7 @@ typedef void zil_parse_blk_func_t(zilog_t *zilog, blkptr_t *bp, void *arg, uint64_t txg); typedef void zil_parse_lr_func_t(zilog_t *zilog, lr_t *lr, void *arg, uint64_t txg); -typedef int zil_replay_func_t(); +typedef int zil_replay_func_t(void *, char *, boolean_t); typedef int zil_get_data_t(void *arg, lr_write_t *lr, char *dbuf, zio_t *zio); extern uint64_t zil_parse(zilog_t *zilog, zil_parse_blk_func_t *parse_blk_func, diff --git a/module/zfs/include/sys/zio_compress.h b/module/zfs/include/sys/zio_compress.h index 66ee8d45b..9470eccb4 100644 --- a/module/zfs/include/sys/zio_compress.h +++ b/module/zfs/include/sys/zio_compress.h @@ -27,7 +27,7 @@ #ifndef _SYS_ZIO_COMPRESS_H #define _SYS_ZIO_COMPRESS_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/zio.h> diff --git a/module/zfs/include/sys/zvol.h b/module/zfs/include/sys/zvol.h index 06adc667e..74ebc83e0 100644 --- a/module/zfs/include/sys/zvol.h +++ b/module/zfs/include/sys/zvol.h @@ -27,7 +27,7 @@ #ifndef _SYS_ZVOL_H #define _SYS_ZVOL_H -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/zfs_context.h> diff --git a/module/zfs/lzjb.c b/module/zfs/lzjb.c index 7fcde8475..ea8fabd6f 100644 --- a/module/zfs/lzjb.c +++ b/module/zfs/lzjb.c @@ -24,7 +24,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + /* * We keep our own copy of this algorithm for 2 main reasons: @@ -51,7 +51,7 @@ lzjb_compress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n) { uchar_t *src = s_start; uchar_t *dst = d_start; - uchar_t *cpy, *copymap; + uchar_t *cpy, *copymap = NULL; int copymask = 1 << (NBBY - 1); int mlen, offset; uint16_t *hp; @@ -104,7 +104,7 @@ lzjb_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n) uchar_t *src = s_start; uchar_t *dst = d_start; uchar_t *d_end = (uchar_t *)d_start + d_len; - uchar_t *cpy, copymap; + uchar_t *cpy, copymap = 0; int copymask = 1 << (NBBY - 1); while (dst < d_end) { diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c index 412832968..4dc83a381 100644 --- a/module/zfs/metaslab.c +++ b/module/zfs/metaslab.c @@ -980,7 +980,7 @@ metaslab_alloc(spa_t *spa, metaslab_class_t *mc, uint64_t psize, blkptr_t *bp, { dva_t *dva = bp->blk_dva; dva_t *hintdva = hintbp->blk_dva; - int error = 0; + int d, error = 0; ASSERT(bp->blk_birth == 0); @@ -995,7 +995,7 @@ metaslab_alloc(spa_t *spa, metaslab_class_t *mc, uint64_t psize, blkptr_t *bp, ASSERT(BP_GET_NDVAS(bp) == 0); ASSERT(hintbp == NULL || ndvas <= BP_GET_NDVAS(hintbp)); - for (int d = 0; d < ndvas; d++) { + for (d = 0; d < ndvas; d++) { error = metaslab_alloc_dva(spa, mc, psize, dva, d, hintdva, txg, flags); if (error) { @@ -1021,14 +1021,14 @@ void metaslab_free(spa_t *spa, const blkptr_t *bp, uint64_t txg, boolean_t now) { const dva_t *dva = bp->blk_dva; - int ndvas = BP_GET_NDVAS(bp); + int d, ndvas = BP_GET_NDVAS(bp); ASSERT(!BP_IS_HOLE(bp)); ASSERT(!now || bp->blk_birth >= spa->spa_syncing_txg); spa_config_enter(spa, SCL_FREE, FTAG, RW_READER); - for (int d = 0; d < ndvas; d++) + for (d = 0; d < ndvas; d++) metaslab_free_dva(spa, &dva[d], txg, now); spa_config_exit(spa, SCL_FREE, FTAG); @@ -1039,7 +1039,7 @@ metaslab_claim(spa_t *spa, const blkptr_t *bp, uint64_t txg) { const dva_t *dva = bp->blk_dva; int ndvas = BP_GET_NDVAS(bp); - int error = 0; + int d, error = 0; ASSERT(!BP_IS_HOLE(bp)); @@ -1054,7 +1054,7 @@ metaslab_claim(spa_t *spa, const blkptr_t *bp, uint64_t txg) spa_config_enter(spa, SCL_ALLOC, FTAG, RW_READER); - for (int d = 0; d < ndvas; d++) + for (d = 0; d < ndvas; d++) if ((error = metaslab_claim_dva(spa, &dva[d], txg)) != 0) break; diff --git a/module/zfs/refcount.c b/module/zfs/refcount.c index 2a52cb16d..6c359ffea 100644 --- a/module/zfs/refcount.c +++ b/module/zfs/refcount.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/zfs_context.h> #include <sys/refcount.h> @@ -113,7 +113,7 @@ refcount_count(refcount_t *rc) int64_t refcount_add_many(refcount_t *rc, uint64_t number, void *holder) { - reference_t *ref; + reference_t *ref = NULL; int64_t count; if (reference_tracking_enable) { diff --git a/module/zfs/rrwlock.c b/module/zfs/rrwlock.c index 710685dbc..1bb8a285b 100644 --- a/module/zfs/rrwlock.c +++ b/module/zfs/rrwlock.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/refcount.h> #include <sys/rrwlock.h> @@ -118,7 +118,7 @@ rrn_find_and_remove(rrwlock_t *rrl) rrw_node_t *prev = NULL; if (refcount_count(&rrl->rr_linked_rcount) == 0) - return (NULL); + return (B_FALSE); for (rn = tsd_get(rrw_tsd_key); rn != NULL; rn = rn->rn_next) { if (rn->rn_rrl == rrl) { diff --git a/module/zfs/sha256.c b/module/zfs/sha256.c index ca7076cb6..691920aa6 100644 --- a/module/zfs/sha256.c +++ b/module/zfs/sha256.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/zfs_context.h> #include <sys/zio.h> diff --git a/module/zfs/spa.c b/module/zfs/spa.c index 8182eae4b..1ec801130 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -278,7 +278,7 @@ spa_prop_validate(spa_t *spa, nvlist_t *props) { nvpair_t *elem; int error = 0, reset_bootfs = 0; - uint64_t objnum; + uint64_t objnum = 0; elem = NULL; while ((elem = nvlist_next_nvpair(props, elem)) != NULL) { @@ -397,6 +397,8 @@ spa_prop_validate(spa_t *spa, nvlist_t *props) strcmp(slash, "/..") == 0) error = EINVAL; break; + default: + break; } if (error) @@ -536,6 +538,8 @@ spa_get_errlists(spa_t *spa, avl_tree_t *last, avl_tree_t *scrub) static void spa_activate(spa_t *spa, int mode) { + int t, q; + ASSERT(spa->spa_state == POOL_STATE_UNINITIALIZED); spa->spa_state = POOL_STATE_ACTIVE; @@ -544,8 +548,8 @@ spa_activate(spa_t *spa, int mode) spa->spa_normal_class = metaslab_class_create(); spa->spa_log_class = metaslab_class_create(); - for (int t = 0; t < ZIO_TYPES; t++) { - for (int q = 0; q < ZIO_TASKQ_TYPES; q++) { + for (t = 0; t < ZIO_TYPES; t++) { + for (q = 0; q < ZIO_TASKQ_TYPES; q++) { spa->spa_zio_taskq[t][q] = taskq_create("spa_zio", zio_taskq_threads[t][q], maxclsyspri, 50, INT_MAX, TASKQ_PREPOPULATE); @@ -574,6 +578,8 @@ spa_activate(spa_t *spa, int mode) static void spa_deactivate(spa_t *spa) { + int t, q; + ASSERT(spa->spa_sync_on == B_FALSE); ASSERT(spa->spa_dsl_pool == NULL); ASSERT(spa->spa_root_vdev == NULL); @@ -585,8 +591,8 @@ spa_deactivate(spa_t *spa) list_destroy(&spa->spa_config_dirty_list); list_destroy(&spa->spa_state_dirty_list); - for (int t = 0; t < ZIO_TYPES; t++) { - for (int q = 0; q < ZIO_TASKQ_TYPES; q++) { + for (t = 0; t < ZIO_TYPES; t++) { + for (q = 0; q < ZIO_TASKQ_TYPES; q++) { taskq_destroy(spa->spa_zio_taskq[t][q]); spa->spa_zio_taskq[t][q] = NULL; } @@ -870,7 +876,7 @@ spa_load_l2cache(spa_t *spa) uint_t nl2cache; int i, j, oldnvdevs; uint64_t guid, size; - vdev_t *vd, **oldvdevs, **newvdevs; + vdev_t *vd, **oldvdevs, **newvdevs = NULL; spa_aux_vdev_t *sav = &spa->spa_l2cache; ASSERT(spa_config_held(spa, SCL_ALL, RW_WRITER) == SCL_ALL); @@ -1446,6 +1452,7 @@ spa_load(spa_t *spa, nvlist_t *config, spa_load_state_t state, int mosconfig) if (spa_writeable(spa)) { dmu_tx_t *tx; int need_update = B_FALSE; + int c; ASSERT(state != SPA_LOAD_TRYIMPORT); @@ -1475,7 +1482,7 @@ spa_load(spa_t *spa, nvlist_t *config, spa_load_state_t state, int mosconfig) state == SPA_LOAD_IMPORT) need_update = B_TRUE; - for (int c = 0; c < rvd->vdev_children; c++) + for (c = 0; c < rvd->vdev_children; c++) if (rvd->vdev_child[c]->vdev_ms_array == 0) need_update = B_TRUE; @@ -2794,6 +2801,7 @@ spa_vdev_add(spa_t *spa, nvlist_t *nvroot) vdev_t *vd, *tvd; nvlist_t **spares, **l2cache; uint_t nspares, nl2cache; + int c; txg = spa_vdev_enter(spa); @@ -2828,7 +2836,7 @@ spa_vdev_add(spa_t *spa, nvlist_t *nvroot) /* * Transfer each new top-level vdev from vd to rvd. */ - for (int c = 0; c < vd->vdev_children; c++) { + for (c = 0; c < vd->vdev_children; c++) { tvd = vd->vdev_child[c]; vdev_remove_child(vd, tvd); tvd->vdev_id = rvd->vdev_children; @@ -3088,8 +3096,9 @@ spa_vdev_detach(spa_t *spa, uint64_t guid, uint64_t pguid, int replace_done) vdev_t *rvd = spa->spa_root_vdev; vdev_t *vd, *pvd, *cvd, *tvd; boolean_t unspare = B_FALSE; - uint64_t unspare_guid; + uint64_t unspare_guid = 0; size_t len; + int t; txg = spa_vdev_enter(spa); @@ -3252,7 +3261,7 @@ spa_vdev_detach(spa_t *spa, uint64_t guid, uint64_t pguid, int replace_done) * But first make sure we're not on any *other* txg's DTL list, to * prevent vd from being accessed after it's freed. */ - for (int t = 0; t < TXG_SIZE; t++) + for (t = 0; t < TXG_SIZE; t++) (void) txg_list_remove_this(&tvd->vdev_dtl_list, vd, t); vd->vdev_detached = B_TRUE; vdev_dirty(tvd, VDD_DTL, vd, txg); @@ -3290,7 +3299,9 @@ spa_vdev_detach(spa_t *spa, uint64_t guid, uint64_t pguid, int replace_done) static nvlist_t * spa_nvlist_lookup_by_guid(nvlist_t **nvpp, int count, uint64_t target_guid) { - for (int i = 0; i < count; i++) { + int i; + + for (i = 0; i < count; i++) { uint64_t guid; VERIFY(nvlist_lookup_uint64(nvpp[i], ZPOOL_CONFIG_GUID, @@ -3308,11 +3319,12 @@ spa_vdev_remove_aux(nvlist_t *config, char *name, nvlist_t **dev, int count, nvlist_t *dev_to_remove) { nvlist_t **newdev = NULL; + int i, j; if (count > 1) newdev = kmem_alloc((count - 1) * sizeof (void *), KM_SLEEP); - for (int i = 0, j = 0; i < count; i++) { + for (i = 0, j = 0; i < count; i++) { if (dev[i] == dev_to_remove) continue; VERIFY(nvlist_dup(dev[i], &newdev[j++], KM_SLEEP) == 0); @@ -3321,7 +3333,7 @@ spa_vdev_remove_aux(nvlist_t *config, char *name, nvlist_t **dev, int count, VERIFY(nvlist_remove(config, name, DATA_TYPE_NVLIST_ARRAY) == 0); VERIFY(nvlist_add_nvlist_array(config, name, newdev, count - 1) == 0); - for (int i = 0; i < count - 1; i++) + for (i = 0; i < count - 1; i++) nvlist_free(newdev[i]); if (count > 1) @@ -3575,6 +3587,8 @@ spa_scrub(spa_t *spa, pool_scrub_type_t type) static void spa_async_remove(spa_t *spa, vdev_t *vd) { + int c; + if (vd->vdev_remove_wanted) { vd->vdev_remove_wanted = 0; vdev_set_state(vd, B_FALSE, VDEV_STATE_REMOVED, VDEV_AUX_NONE); @@ -3582,26 +3596,28 @@ spa_async_remove(spa_t *spa, vdev_t *vd) vdev_state_dirty(vd->vdev_top); } - for (int c = 0; c < vd->vdev_children; c++) + for (c = 0; c < vd->vdev_children; c++) spa_async_remove(spa, vd->vdev_child[c]); } static void spa_async_probe(spa_t *spa, vdev_t *vd) { + int c; + if (vd->vdev_probe_wanted) { vd->vdev_probe_wanted = 0; vdev_reopen(vd); /* vdev_open() does the actual probe */ } - for (int c = 0; c < vd->vdev_children; c++) + for (c = 0; c < vd->vdev_children; c++) spa_async_probe(spa, vd->vdev_child[c]); } static void spa_async_thread(spa_t *spa) { - int tasks; + int tasks, i; ASSERT(spa->spa_sync_on); @@ -3625,9 +3641,9 @@ spa_async_thread(spa_t *spa) if (tasks & SPA_ASYNC_REMOVE) { spa_vdev_state_enter(spa); spa_async_remove(spa, spa->spa_root_vdev); - for (int i = 0; i < spa->spa_l2cache.sav_count; i++) + for (i = 0; i < spa->spa_l2cache.sav_count; i++) spa_async_remove(spa, spa->spa_l2cache.sav_vdevs[i]); - for (int i = 0; i < spa->spa_spares.sav_count; i++) + for (i = 0; i < spa->spa_spares.sav_count; i++) spa_async_remove(spa, spa->spa_spares.sav_vdevs[i]); (void) spa_vdev_state_exit(spa, NULL, 0); } diff --git a/module/zfs/spa_boot.c b/module/zfs/spa_boot.c index 49e9e5019..053903cac 100644 --- a/module/zfs/spa_boot.c +++ b/module/zfs/spa_boot.c @@ -24,7 +24,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/spa.h> #include <sys/sunddi.h> diff --git a/module/zfs/spa_errlog.c b/module/zfs/spa_errlog.c index c642bd768..79256a4c0 100644 --- a/module/zfs/spa_errlog.c +++ b/module/zfs/spa_errlog.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + /* * Routines to manage the on-disk persistent error log. diff --git a/module/zfs/spa_history.c b/module/zfs/spa_history.c index c997240c1..3f67d70f7 100644 --- a/module/zfs/spa_history.c +++ b/module/zfs/spa_history.c @@ -24,7 +24,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/spa.h> #include <sys/spa_impl.h> @@ -176,7 +176,7 @@ spa_history_write(spa_t *spa, void *buf, uint64_t len, spa_history_phys_t *shpp, } static char * -spa_history_zone() +spa_history_zone(void) { #ifdef _KERNEL return (curproc->p_zone->zone_name); diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c index 485e83fce..c09ef8749 100644 --- a/module/zfs/spa_misc.c +++ b/module/zfs/spa_misc.c @@ -255,7 +255,9 @@ int zfs_recover = 0; static void spa_config_lock_init(spa_t *spa) { - for (int i = 0; i < SCL_LOCKS; i++) { + int i; + + for (i = 0; i < SCL_LOCKS; i++) { spa_config_lock_t *scl = &spa->spa_config_lock[i]; mutex_init(&scl->scl_lock, NULL, MUTEX_DEFAULT, NULL); cv_init(&scl->scl_cv, NULL, CV_DEFAULT, NULL); @@ -268,7 +270,9 @@ spa_config_lock_init(spa_t *spa) static void spa_config_lock_destroy(spa_t *spa) { - for (int i = 0; i < SCL_LOCKS; i++) { + int i; + + for (i = 0; i < SCL_LOCKS; i++) { spa_config_lock_t *scl = &spa->spa_config_lock[i]; mutex_destroy(&scl->scl_lock); cv_destroy(&scl->scl_cv); @@ -281,7 +285,9 @@ spa_config_lock_destroy(spa_t *spa) int spa_config_tryenter(spa_t *spa, int locks, void *tag, krw_t rw) { - for (int i = 0; i < SCL_LOCKS; i++) { + int i; + + for (i = 0; i < SCL_LOCKS; i++) { spa_config_lock_t *scl = &spa->spa_config_lock[i]; if (!(locks & (1 << i))) continue; @@ -310,7 +316,9 @@ spa_config_tryenter(spa_t *spa, int locks, void *tag, krw_t rw) void spa_config_enter(spa_t *spa, int locks, void *tag, krw_t rw) { - for (int i = 0; i < SCL_LOCKS; i++) { + int i; + + for (i = 0; i < SCL_LOCKS; i++) { spa_config_lock_t *scl = &spa->spa_config_lock[i]; if (!(locks & (1 << i))) continue; @@ -336,7 +344,9 @@ spa_config_enter(spa_t *spa, int locks, void *tag, krw_t rw) void spa_config_exit(spa_t *spa, int locks, void *tag) { - for (int i = SCL_LOCKS - 1; i >= 0; i--) { + int i; + + for (i = SCL_LOCKS - 1; i >= 0; i--) { spa_config_lock_t *scl = &spa->spa_config_lock[i]; if (!(locks & (1 << i))) continue; @@ -355,9 +365,9 @@ spa_config_exit(spa_t *spa, int locks, void *tag) int spa_config_held(spa_t *spa, int locks, krw_t rw) { - int locks_held = 0; + int i, locks_held = 0; - for (int i = 0; i < SCL_LOCKS; i++) { + for (i = 0; i < SCL_LOCKS; i++) { spa_config_lock_t *scl = &spa->spa_config_lock[i]; if (!(locks & (1 << i))) continue; @@ -1340,7 +1350,7 @@ spa_busy(void) } void -spa_boot_init() +spa_boot_init(void) { spa_config_load(); } diff --git a/module/zfs/txg.c b/module/zfs/txg.c index e3c0e2a13..d87b053ed 100644 --- a/module/zfs/txg.c +++ b/module/zfs/txg.c @@ -154,12 +154,12 @@ txg_thread_exit(tx_state_t *tx, callb_cpr_t *cpr, kthread_t **tpp) } static void -txg_thread_wait(tx_state_t *tx, callb_cpr_t *cpr, kcondvar_t *cv, uint64_t time) +txg_thread_wait(tx_state_t *tx, callb_cpr_t *cpr, kcondvar_t *cv, uint64_t wt) { CALLB_CPR_SAFE_BEGIN(cpr); - if (time) - (void) cv_timedwait(cv, &tx->tx_sync_lock, lbolt + time); + if (wt) + (void) cv_timedwait(cv, &tx->tx_sync_lock, lbolt + wt); else cv_wait(cv, &tx->tx_sync_lock); diff --git a/module/zfs/uberblock.c b/module/zfs/uberblock.c index 34d7e0c3a..68d9b1fc2 100644 --- a/module/zfs/uberblock.c +++ b/module/zfs/uberblock.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/zfs_context.h> #include <sys/uberblock_impl.h> diff --git a/module/zfs/unique.c b/module/zfs/unique.c index fbe7b619a..8c1d2e2f9 100644 --- a/module/zfs/unique.c +++ b/module/zfs/unique.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/zfs_context.h> #include <sys/avl.h> diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c index dea90e149..c29db347d 100644 --- a/module/zfs/vdev.c +++ b/module/zfs/vdev.c @@ -279,6 +279,7 @@ static vdev_t * vdev_alloc_common(spa_t *spa, uint_t id, uint64_t guid, vdev_ops_t *ops) { vdev_t *vd; + int t; vd = kmem_zalloc(sizeof (vdev_t), KM_SLEEP); @@ -316,7 +317,7 @@ vdev_alloc_common(spa_t *spa, uint_t id, uint64_t guid, vdev_ops_t *ops) mutex_init(&vd->vdev_dtl_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&vd->vdev_stat_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&vd->vdev_probe_lock, NULL, MUTEX_DEFAULT, NULL); - for (int t = 0; t < DTL_TYPES; t++) { + for (t = 0; t < DTL_TYPES; t++) { space_map_create(&vd->vdev_dtl[t], 0, -1ULL, 0, &vd->vdev_dtl_lock); } @@ -511,7 +512,7 @@ vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vdev_t *parent, uint_t id, void vdev_free(vdev_t *vd) { - int c; + int c, t; spa_t *spa = vd->vdev_spa; /* @@ -570,7 +571,7 @@ vdev_free(vdev_t *vd) txg_list_destroy(&vd->vdev_dtl_list); mutex_enter(&vd->vdev_dtl_lock); - for (int t = 0; t < DTL_TYPES; t++) { + for (t = 0; t < DTL_TYPES; t++) { space_map_unload(&vd->vdev_dtl[t]); space_map_destroy(&vd->vdev_dtl[t]); } @@ -882,6 +883,7 @@ vdev_probe(vdev_t *vd, zio_t *zio) spa_t *spa = vd->vdev_spa; vdev_probe_stats_t *vps = NULL; zio_t *pio; + int l; ASSERT(vd->vdev_ops->vdev_op_leaf); @@ -947,7 +949,7 @@ vdev_probe(vdev_t *vd, zio_t *zio) return (NULL); } - for (int l = 1; l < VDEV_LABELS; l++) { + for (l = 1; l < VDEV_LABELS; l++) { zio_nowait(zio_read_phys(pio, vd, vdev_label_offset(vd->vdev_psize, l, offsetof(vdev_label_t, vl_pad)), @@ -1429,11 +1431,11 @@ vdev_dtl_reassess(vdev_t *vd, uint64_t txg, uint64_t scrub_txg, int scrub_done) { spa_t *spa = vd->vdev_spa; avl_tree_t reftree; - int minref; + int c, t, minref; ASSERT(spa_config_held(spa, SCL_ALL, RW_READER) != 0); - for (int c = 0; c < vd->vdev_children; c++) + for (c = 0; c < vd->vdev_children; c++) vdev_dtl_reassess(vd->vdev_child[c], txg, scrub_txg, scrub_done); @@ -1491,7 +1493,7 @@ vdev_dtl_reassess(vdev_t *vd, uint64_t txg, uint64_t scrub_txg, int scrub_done) } mutex_enter(&vd->vdev_dtl_lock); - for (int t = 0; t < DTL_TYPES; t++) { + for (t = 0; t < DTL_TYPES; t++) { if (t == DTL_SCRUB) continue; /* leaf vdevs only */ if (t == DTL_PARTIAL) @@ -1501,7 +1503,7 @@ vdev_dtl_reassess(vdev_t *vd, uint64_t txg, uint64_t scrub_txg, int scrub_done) else minref = vd->vdev_children; /* any kind of mirror */ space_map_ref_create(&reftree); - for (int c = 0; c < vd->vdev_children; c++) { + for (c = 0; c < vd->vdev_children; c++) { vdev_t *cvd = vd->vdev_child[c]; mutex_enter(&cvd->vdev_dtl_lock); space_map_ref_add_map(&reftree, &cvd->vdev_dtl[t], 1); @@ -1558,8 +1560,7 @@ vdev_dtl_sync(vdev_t *vd, uint64_t txg) if (vd->vdev_detached) { if (smo->smo_object != 0) { - int err = dmu_object_free(mos, smo->smo_object, tx); - ASSERT3U(err, ==, 0); + VERIFY(0 == dmu_object_free(mos, smo->smo_object, tx)); smo->smo_object = 0; } dmu_tx_commit(tx); @@ -1644,6 +1645,7 @@ vdev_resilver_needed(vdev_t *vd, uint64_t *minp, uint64_t *maxp) boolean_t needed = B_FALSE; uint64_t thismin = UINT64_MAX; uint64_t thismax = 0; + int c; if (vd->vdev_children == 0) { mutex_enter(&vd->vdev_dtl_lock); @@ -1659,7 +1661,7 @@ vdev_resilver_needed(vdev_t *vd, uint64_t *minp, uint64_t *maxp) } mutex_exit(&vd->vdev_dtl_lock); } else { - for (int c = 0; c < vd->vdev_children; c++) { + for (c = 0; c < vd->vdev_children; c++) { vdev_t *cvd = vd->vdev_child[c]; uint64_t cmin, cmax; @@ -1681,10 +1683,12 @@ vdev_resilver_needed(vdev_t *vd, uint64_t *minp, uint64_t *maxp) void vdev_load(vdev_t *vd) { + int c; + /* * Recursively load all children. */ - for (int c = 0; c < vd->vdev_children; c++) + for (c = 0; c < vd->vdev_children; c++) vdev_load(vd->vdev_child[c]); /* @@ -1959,6 +1963,7 @@ void vdev_clear(spa_t *spa, vdev_t *vd) { vdev_t *rvd = spa->spa_root_vdev; + int c; ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL); @@ -1969,7 +1974,7 @@ vdev_clear(spa_t *spa, vdev_t *vd) vd->vdev_stat.vs_write_errors = 0; vd->vdev_stat.vs_checksum_errors = 0; - for (int c = 0; c < vd->vdev_children; c++) + for (c = 0; c < vd->vdev_children; c++) vdev_clear(spa, vd->vdev_child[c]); /* @@ -2056,6 +2061,7 @@ void vdev_get_stats(vdev_t *vd, vdev_stat_t *vs) { vdev_t *rvd = vd->vdev_spa->spa_root_vdev; + int c, t; mutex_enter(&vd->vdev_stat_lock); bcopy(&vd->vdev_stat, vs, sizeof (*vs)); @@ -2070,12 +2076,12 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t *vs) * over all top-level vdevs (i.e. the direct children of the root). */ if (vd == rvd) { - for (int c = 0; c < rvd->vdev_children; c++) { + for (c = 0; c < rvd->vdev_children; c++) { vdev_t *cvd = rvd->vdev_child[c]; vdev_stat_t *cvs = &cvd->vdev_stat; mutex_enter(&vd->vdev_stat_lock); - for (int t = 0; t < ZIO_TYPES; t++) { + for (t = 0; t < ZIO_TYPES; t++) { vs->vs_ops[t] += cvs->vs_ops[t]; vs->vs_bytes[t] += cvs->vs_bytes[t]; } diff --git a/module/zfs/vdev_cache.c b/module/zfs/vdev_cache.c index 9b3a9f5a2..b02821b66 100644 --- a/module/zfs/vdev_cache.c +++ b/module/zfs/vdev_cache.c @@ -246,7 +246,6 @@ vdev_cache_read(zio_t *zio) vdev_cache_t *vc = &zio->io_vd->vdev_cache; vdev_cache_entry_t *ve, ve_search; uint64_t cache_offset = P2ALIGN(zio->io_offset, VCBS); - uint64_t cache_phase = P2PHASE(zio->io_offset, VCBS); zio_t *fio; ASSERT(zio->io_type == ZIO_TYPE_READ); @@ -263,7 +262,7 @@ vdev_cache_read(zio_t *zio) if (P2BOUNDARY(zio->io_offset, zio->io_size, VCBS)) return (EXDEV); - ASSERT(cache_phase + zio->io_size <= VCBS); + ASSERT(P2PHASE(zio->io_offset, VCBS) + zio->io_size <= VCBS); mutex_enter(&vc->vc_lock); diff --git a/module/zfs/vdev_label.c b/module/zfs/vdev_label.c index f61de3c4e..4d4c8ba95 100644 --- a/module/zfs/vdev_label.c +++ b/module/zfs/vdev_label.c @@ -335,7 +335,7 @@ vdev_label_read_config(vdev_t *vd) nvlist_t *config = NULL; vdev_phys_t *vp; zio_t *zio; - int flags = + int l, flags = ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE; ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL); @@ -345,7 +345,7 @@ vdev_label_read_config(vdev_t *vd) vp = zio_buf_alloc(sizeof (vdev_phys_t)); - for (int l = 0; l < VDEV_LABELS; l++) { + for (l = 0; l < VDEV_LABELS; l++) { zio = zio_root(spa, NULL, NULL, flags); @@ -458,6 +458,8 @@ vdev_inuse(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason, case VDEV_LABEL_SPARE: return (spa_has_spare(spa, device_guid)); + default: + break; } } @@ -489,6 +491,7 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason) nvlist_t *label; vdev_phys_t *vp; vdev_boot_header_t *vb; + vdev_t *pvd; uberblock_t *ub; zio_t *zio; char *buf; @@ -496,10 +499,11 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason) int error; uint64_t spare_guid, l2cache_guid; int flags = ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL; + int c, l, n; ASSERT(spa_config_held(spa, SCL_ALL, RW_WRITER) == SCL_ALL); - for (int c = 0; c < vd->vdev_children; c++) + for (c = 0; c < vd->vdev_children; c++) if ((error = vdev_label_init(vd->vdev_child[c], crtxg, reason)) != 0) return (error); @@ -532,7 +536,7 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason) vd->vdev_guid += guid_delta; - for (vdev_t *pvd = vd; pvd != NULL; pvd = pvd->vdev_parent) + for (pvd = vd; pvd != NULL; pvd = pvd->vdev_parent) pvd->vdev_guid_sum += guid_delta; /* @@ -551,7 +555,7 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason) vd->vdev_guid += guid_delta; - for (vdev_t *pvd = vd; pvd != NULL; pvd = pvd->vdev_parent) + for (pvd = vd; pvd != NULL; pvd = pvd->vdev_parent) pvd->vdev_guid_sum += guid_delta; /* @@ -652,7 +656,7 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason) */ zio = zio_root(spa, NULL, NULL, flags); - for (int l = 0; l < VDEV_LABELS; l++) { + for (l = 0; l < VDEV_LABELS; l++) { vdev_label_write(zio, vd, l, vp, offsetof(vdev_label_t, vl_vdev_phys), @@ -662,7 +666,7 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason) offsetof(vdev_label_t, vl_boot_header), sizeof (vdev_boot_header_t), NULL, NULL, flags); - for (int n = 0; n < VDEV_UBERBLOCK_COUNT(vd); n++) { + for (n = 0; n < VDEV_UBERBLOCK_COUNT(vd); n++) { vdev_label_write(zio, vd, l, ub, VDEV_UBERBLOCK_OFFSET(vd, n), VDEV_UBERBLOCK_SIZE(vd), NULL, NULL, flags); @@ -759,6 +763,7 @@ vdev_uberblock_load(zio_t *zio, vdev_t *vd, uberblock_t *ubbest) vdev_t *rvd = spa->spa_root_vdev; int flags = ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE; + int c, l, n; if (vd == rvd) { ASSERT(zio == NULL); @@ -769,12 +774,12 @@ vdev_uberblock_load(zio_t *zio, vdev_t *vd, uberblock_t *ubbest) ASSERT(zio != NULL); - for (int c = 0; c < vd->vdev_children; c++) + for (c = 0; c < vd->vdev_children; c++) vdev_uberblock_load(zio, vd->vdev_child[c], ubbest); if (vd->vdev_ops->vdev_op_leaf && vdev_readable(vd)) { - for (int l = 0; l < VDEV_LABELS; l++) { - for (int n = 0; n < VDEV_UBERBLOCK_COUNT(vd); n++) { + for (l = 0; l < VDEV_LABELS; l++) { + for (n = 0; n < VDEV_UBERBLOCK_COUNT(vd); n++) { vdev_label_read(zio, vd, l, zio_buf_alloc(VDEV_UBERBLOCK_SIZE(vd)), VDEV_UBERBLOCK_OFFSET(vd, n), @@ -810,9 +815,9 @@ static void vdev_uberblock_sync(zio_t *zio, uberblock_t *ub, vdev_t *vd, int flags) { uberblock_t *ubbuf; - int n; + int c, l, n; - for (int c = 0; c < vd->vdev_children; c++) + for (c = 0; c < vd->vdev_children; c++) vdev_uberblock_sync(zio, ub, vd->vdev_child[c], flags); if (!vd->vdev_ops->vdev_op_leaf) @@ -827,7 +832,7 @@ vdev_uberblock_sync(zio_t *zio, uberblock_t *ub, vdev_t *vd, int flags) bzero(ubbuf, VDEV_UBERBLOCK_SIZE(vd)); *ubbuf = *ub; - for (int l = 0; l < VDEV_LABELS; l++) + for (l = 0; l < VDEV_LABELS; l++) vdev_label_write(zio, vd, l, ubbuf, VDEV_UBERBLOCK_OFFSET(vd, n), VDEV_UBERBLOCK_SIZE(vd), vdev_uberblock_sync_done, zio->io_private, @@ -842,10 +847,11 @@ vdev_uberblock_sync_list(vdev_t **svd, int svdcount, uberblock_t *ub, int flags) spa_t *spa = svd[0]->vdev_spa; zio_t *zio; uint64_t good_writes = 0; + int v; zio = zio_root(spa, NULL, &good_writes, flags); - for (int v = 0; v < svdcount; v++) + for (v = 0; v < svdcount; v++) vdev_uberblock_sync(zio, ub, svd[v], flags); (void) zio_wait(zio); @@ -857,7 +863,7 @@ vdev_uberblock_sync_list(vdev_t **svd, int svdcount, uberblock_t *ub, int flags) */ zio = zio_root(spa, NULL, NULL, flags); - for (int v = 0; v < svdcount; v++) + for (v = 0; v < svdcount; v++) zio_flush(zio, svd[v]); (void) zio_wait(zio); @@ -910,8 +916,9 @@ vdev_label_sync(zio_t *zio, vdev_t *vd, int l, uint64_t txg, int flags) vdev_phys_t *vp; char *buf; size_t buflen; + int c; - for (int c = 0; c < vd->vdev_children; c++) + for (c = 0; c < vd->vdev_children; c++) vdev_label_sync(zio, vd->vdev_child[c], l, txg, flags); if (!vd->vdev_ops->vdev_op_leaf) diff --git a/module/zfs/vdev_mirror.c b/module/zfs/vdev_mirror.c index fff7e0842..c38cd6800 100644 --- a/module/zfs/vdev_mirror.c +++ b/module/zfs/vdev_mirror.c @@ -308,9 +308,9 @@ vdev_mirror_io_start(zio_t *zio) static int vdev_mirror_worst_error(mirror_map_t *mm) { - int error[2] = { 0, 0 }; + int c, error[2] = { 0, 0 }; - for (int c = 0; c < mm->mm_children; c++) { + for (c = 0; c < mm->mm_children; c++) { mirror_child_t *mc = &mm->mm_child[c]; int s = mc->mc_speculative; error[s] = zio_worst_error(error[s], mc->mc_error); diff --git a/module/zfs/vdev_queue.c b/module/zfs/vdev_queue.c index 4e3c20acd..db3cca979 100644 --- a/module/zfs/vdev_queue.c +++ b/module/zfs/vdev_queue.c @@ -288,12 +288,13 @@ void vdev_queue_io_done(zio_t *zio) { vdev_queue_t *vq = &zio->io_vd->vdev_queue; + int i; mutex_enter(&vq->vq_lock); avl_remove(&vq->vq_pending_tree, zio); - for (int i = 0; i < zfs_vdev_ramp_rate; i++) { + for (i = 0; i < zfs_vdev_ramp_rate; i++) { zio_t *nio = vdev_queue_io_to_issue(vq, zfs_vdev_max_pending); if (nio == NULL) break; diff --git a/module/zfs/vdev_raidz.c b/module/zfs/vdev_raidz.c index ad997f528..a4ed98a8a 100644 --- a/module/zfs/vdev_raidz.c +++ b/module/zfs/vdev_raidz.c @@ -775,9 +775,9 @@ static uint64_t raidz_corrected_pq; static int vdev_raidz_worst_error(raidz_map_t *rm) { - int error = 0; + int c, error = 0; - for (int c = 0; c < rm->rm_cols; c++) + for (c = 0; c < rm->rm_cols; c++) error = zio_worst_error(error, rm->rm_col[c].rc_error); return (error); @@ -789,7 +789,7 @@ vdev_raidz_io_done(zio_t *zio) vdev_t *vd = zio->io_vd; vdev_t *cvd; raidz_map_t *rm = zio->io_vsd; - raidz_col_t *rc, *rc1; + raidz_col_t *rc = NULL, *rc1; int unexpected_errors = 0; int parity_errors = 0; int parity_untried = 0; diff --git a/module/zfs/zap.c b/module/zfs/zap.c index ca859ec35..afaebaae3 100644 --- a/module/zfs/zap.c +++ b/module/zfs/zap.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + /* @@ -476,7 +476,7 @@ zap_open_leaf(uint64_t blkid, dmu_buf_t *db) ASSERT3U(ZAP_LEAF_HASH_NUMENTRIES(l), >, ZAP_LEAF_NUMCHUNKS(l) / 3); /* The chunks should begin at the end of the hash table */ - ASSERT3P(&ZAP_LEAF_CHUNK(l, 0), ==, + ASSERT3P(&ZAP_LEAF_CHUNK(l, 0), ==, (zap_leaf_chunk_t *) &l->l_phys->l_hash[ZAP_LEAF_HASH_NUMENTRIES(l)]); /* The chunks should end at the end of the block */ diff --git a/module/zfs/zap_leaf.c b/module/zfs/zap_leaf.c index da498b6bc..3726df5c0 100644 --- a/module/zfs/zap_leaf.c +++ b/module/zfs/zap_leaf.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + /* * The 512-byte leaf is broken into 32 16-byte chunks. @@ -220,7 +220,7 @@ zap_leaf_array_create(zap_leaf_t *l, const char *buf, uint16_t chunk_head; uint16_t *chunkp = &chunk_head; int byten = 0; - uint64_t value; + uint64_t value = 0; int shift = (integer_size-1)*8; int len = num_integers; diff --git a/module/zfs/zap_micro.c b/module/zfs/zap_micro.c index b602f3984..cbdb3170a 100644 --- a/module/zfs/zap_micro.c +++ b/module/zfs/zap_micro.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/spa.h> #include <sys/dmu.h> diff --git a/module/zfs/zfs_byteswap.c b/module/zfs/zfs_byteswap.c index cd36696f9..d5f3013df 100644 --- a/module/zfs/zfs_byteswap.c +++ b/module/zfs/zfs_byteswap.c @@ -50,7 +50,7 @@ zfs_ace_byteswap(void *buf, size_t size, boolean_t zfs_layout) { caddr_t end; caddr_t ptr; - zfs_ace_t *zacep; + zfs_ace_t *zacep = NULL; ace_t *acep; uint16_t entry_type; size_t entry_size; diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index e7c5ddc26..7a7bc172b 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -142,7 +142,7 @@ history_str_get(zfs_cmd_t *zc) { char *buf; - if (zc->zc_history == NULL) + if (zc->zc_history == 0) return (NULL); buf = kmem_alloc(HIS_MAX_RECORD_LEN, KM_SLEEP); @@ -1272,7 +1272,7 @@ zfs_ioc_objset_zplprops(zfs_cmd_t *zc) * which we aren't supposed to do with a DS_MODE_USER * hold, because it could be inconsistent. */ - if (zc->zc_nvlist_dst != NULL && + if (zc->zc_nvlist_dst != 0 && !zc->zc_objset_stats.dds_inconsistent && dmu_objset_type(os) == DMU_OST_ZFS) { nvlist_t *nv; @@ -1710,7 +1710,7 @@ zfs_ioc_pool_get_props(zfs_cmd_t *zc) spa_close(spa, FTAG); } - if (error == 0 && zc->zc_nvlist_dst != NULL) + if (error == 0 && zc->zc_nvlist_dst != 0) error = put_nvlist(zc, nvp); else error = EFAULT; @@ -2083,7 +2083,7 @@ zfs_ioc_create(zfs_cmd_t *zc) strchr(zc->zc_name, '%')) return (EINVAL); - if (zc->zc_nvlist_src != NULL && + if (zc->zc_nvlist_src != 0 && (error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size, &nvprops)) != 0) return (error); @@ -2227,7 +2227,7 @@ zfs_ioc_snapshot(zfs_cmd_t *zc) if (snapshot_namecheck(zc->zc_value, NULL, NULL) != 0) return (EINVAL); - if (zc->zc_nvlist_src != NULL && + if (zc->zc_nvlist_src != 0 && (error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size, &nvprops)) != 0) return (error); @@ -2482,7 +2482,7 @@ zfs_ioc_recv(zfs_cmd_t *zc) *tosnap = '\0'; tosnap++; - if (zc->zc_nvlist_src != NULL && + if (zc->zc_nvlist_src != 0 && (error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size, &props)) != 0) return (error); diff --git a/module/zfs/zfs_replay.c b/module/zfs/zfs_replay.c index 85b79703a..819ba2886 100644 --- a/module/zfs/zfs_replay.c +++ b/module/zfs/zfs_replay.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/types.h> #include <sys/param.h> diff --git a/module/zfs/zio.c b/module/zfs/zio.c index 124dcae86..89c72ad18 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -355,6 +355,7 @@ void zio_add_child(zio_t *pio, zio_t *cio) { zio_link_t *zl = kmem_cache_alloc(zio_link_cache, KM_SLEEP); + int w; /* * Logical I/Os can have logical, gang, or vdev children. @@ -372,7 +373,7 @@ zio_add_child(zio_t *pio, zio_t *cio) ASSERT(pio->io_state[ZIO_WAIT_DONE] == 0); - for (int w = 0; w < ZIO_WAIT_TYPES; w++) + for (w = 0; w < ZIO_WAIT_TYPES; w++) pio->io_children[cio->io_child_type][w] += !cio->io_state[w]; list_insert_head(&pio->io_child_list, zl); @@ -919,8 +920,8 @@ zio_write_bp_init(zio_t *zio) */ if (bp->blk_birth == zio->io_txg && BP_GET_PSIZE(bp) == csize && pass > SYNC_PASS_REWRITE) { - ASSERT(csize != 0); uint32_t gang_stages = zio->io_pipeline & ZIO_GANG_STAGES; + ASSERT(csize != 0); zio->io_pipeline = ZIO_REWRITE_PIPELINE | gang_stages; zio->io_flags |= ZIO_FLAG_IO_REWRITE; } else { @@ -978,8 +979,9 @@ zio_taskq_member(zio_t *zio, enum zio_taskq_type q) { kthread_t *executor = zio->io_executor; spa_t *spa = zio->io_spa; + zio_type_t t; - for (zio_type_t t = 0; t < ZIO_TYPES; t++) + for (t = 0; t < ZIO_TYPES; t++) if (taskq_member(spa->spa_zio_taskq[t][q], executor)) return (B_TRUE); @@ -1115,6 +1117,7 @@ static void zio_reexecute(zio_t *pio) { zio_t *cio, *cio_next; + int c, w; ASSERT(pio->io_child_type == ZIO_CHILD_LOGICAL); ASSERT(pio->io_orig_stage == ZIO_STAGE_OPEN); @@ -1124,9 +1127,9 @@ zio_reexecute(zio_t *pio) pio->io_pipeline = pio->io_orig_pipeline; pio->io_reexecute = 0; pio->io_error = 0; - for (int w = 0; w < ZIO_WAIT_TYPES; w++) + for (w = 0; w < ZIO_WAIT_TYPES; w++) pio->io_state[w] = 0; - for (int c = 0; c < ZIO_CHILD_TYPES; c++) + for (c = 0; c < ZIO_CHILD_TYPES; c++) pio->io_child_error[c] = 0; if (IO_IS_ALLOCATING(pio)) { @@ -1153,7 +1156,7 @@ zio_reexecute(zio_t *pio) for (cio = zio_walk_children(pio); cio != NULL; cio = cio_next) { cio_next = zio_walk_children(pio); mutex_enter(&pio->io_lock); - for (int w = 0; w < ZIO_WAIT_TYPES; w++) + for (w = 0; w < ZIO_WAIT_TYPES; w++) pio->io_children[cio->io_child_type][w]++; mutex_exit(&pio->io_lock); zio_reexecute(cio); @@ -1385,8 +1388,9 @@ static void zio_gang_node_free(zio_gang_node_t **gnpp) { zio_gang_node_t *gn = *gnpp; + int g; - for (int g = 0; g < SPA_GBH_NBLKPTRS; g++) + for (g = 0; g < SPA_GBH_NBLKPTRS; g++) ASSERT(gn->gn_child[g] == NULL); zio_buf_free(gn->gn_gbh, SPA_GANGBLOCKSIZE); @@ -1398,11 +1402,12 @@ static void zio_gang_tree_free(zio_gang_node_t **gnpp) { zio_gang_node_t *gn = *gnpp; + int g; if (gn == NULL) return; - for (int g = 0; g < SPA_GBH_NBLKPTRS; g++) + for (g = 0; g < SPA_GBH_NBLKPTRS; g++) zio_gang_tree_free(&gn->gn_child[g]); zio_gang_node_free(gnpp); @@ -1428,6 +1433,7 @@ zio_gang_tree_assemble_done(zio_t *zio) zio_gang_node_t *gn = zio->io_private; blkptr_t *bp = zio->io_bp; zio_t *pio = zio_unique_parent(zio); + int g; ASSERT(pio == lio); ASSERT(zio_walk_children(zio) == NULL); @@ -1442,7 +1448,7 @@ zio_gang_tree_assemble_done(zio_t *zio) ASSERT(zio->io_size == SPA_GANGBLOCKSIZE); ASSERT(gn->gn_gbh->zg_tail.zbt_magic == ZBT_MAGIC); - for (int g = 0; g < SPA_GBH_NBLKPTRS; g++) { + for (g = 0; g < SPA_GBH_NBLKPTRS; g++) { blkptr_t *gbp = &gn->gn_gbh->zg_blkptr[g]; if (!BP_IS_GANG(gbp)) continue; @@ -1455,6 +1461,7 @@ zio_gang_tree_issue(zio_t *pio, zio_gang_node_t *gn, blkptr_t *bp, void *data) { zio_t *lio = pio->io_logical; zio_t *zio; + int g; ASSERT(BP_IS_GANG(bp) == !!gn); ASSERT(BP_GET_CHECKSUM(bp) == BP_GET_CHECKSUM(lio->io_bp)); @@ -1469,7 +1476,7 @@ zio_gang_tree_issue(zio_t *pio, zio_gang_node_t *gn, blkptr_t *bp, void *data) if (gn != NULL) { ASSERT(gn->gn_gbh->zg_tail.zbt_magic == ZBT_MAGIC); - for (int g = 0; g < SPA_GBH_NBLKPTRS; g++) { + for (g = 0; g < SPA_GBH_NBLKPTRS; g++) { blkptr_t *gbp = &gn->gn_gbh->zg_blkptr[g]; if (BP_IS_HOLE(gbp)) continue; @@ -1526,6 +1533,7 @@ zio_write_gang_member_ready(zio_t *zio) dva_t *cdva = zio->io_bp->blk_dva; dva_t *pdva = pio->io_bp->blk_dva; uint64_t asize; + int d; if (BP_IS_HOLE(zio->io_bp)) return; @@ -1539,7 +1547,7 @@ zio_write_gang_member_ready(zio_t *zio) ASSERT3U(BP_GET_NDVAS(zio->io_bp), <=, BP_GET_NDVAS(pio->io_bp)); mutex_enter(&pio->io_lock); - for (int d = 0; d < BP_GET_NDVAS(zio->io_bp); d++) { + for (d = 0; d < BP_GET_NDVAS(zio->io_bp); d++) { ASSERT(DVA_GET_GANG(&pdva[d])); asize = DVA_GET_ASIZE(&pdva[d]); asize += DVA_GET_ASIZE(&cdva[d]); @@ -1563,7 +1571,7 @@ zio_write_gang_block(zio_t *pio) int ndvas = lio->io_prop.zp_ndvas; int gbh_ndvas = MIN(ndvas + 1, spa_max_replication(spa)); zio_prop_t zp; - int error; + int g, error; error = metaslab_alloc(spa, spa->spa_normal_class, SPA_GANGBLOCKSIZE, bp, gbh_ndvas, txg, pio == lio ? NULL : lio->io_bp, @@ -1593,7 +1601,7 @@ zio_write_gang_block(zio_t *pio) /* * Create and nowait the gang children. */ - for (int g = 0; resid != 0; resid -= lsize, g++) { + for (g = 0; resid != 0; resid -= lsize, g++) { lsize = P2ROUNDUP(resid / (SPA_GBH_NBLKPTRS - g), SPA_MINBLOCKSIZE); ASSERT(lsize >= SPA_MINBLOCKSIZE && lsize <= resid); @@ -1683,6 +1691,7 @@ zio_dva_unallocate(zio_t *zio, zio_gang_node_t *gn, blkptr_t *bp) { spa_t *spa = zio->io_spa; boolean_t now = !(zio->io_flags & ZIO_FLAG_IO_REWRITE); + int g; ASSERT(bp->blk_birth == zio->io_txg || BP_IS_HOLE(bp)); @@ -1713,7 +1722,7 @@ zio_dva_unallocate(zio_t *zio, zio_gang_node_t *gn, blkptr_t *bp) metaslab_free(spa, bp, bp->blk_birth, now); if (gn != NULL) { - for (int g = 0; g < SPA_GBH_NBLKPTRS; g++) { + for (g = 0; g < SPA_GBH_NBLKPTRS; g++) { zio_dva_unallocate(zio, gn->gn_child[g], &gn->gn_gbh->zg_blkptr[g]); } @@ -2126,6 +2135,7 @@ zio_done(zio_t *zio) vdev_t *vd = zio->io_vd; uint64_t psize = zio->io_size; zio_t *pio, *pio_next; + int c, w; /* * If our of children haven't all completed, @@ -2136,8 +2146,8 @@ zio_done(zio_t *zio) zio_wait_for_children(zio, ZIO_CHILD_LOGICAL, ZIO_WAIT_DONE)) return (ZIO_PIPELINE_STOP); - for (int c = 0; c < ZIO_CHILD_TYPES; c++) - for (int w = 0; w < ZIO_WAIT_TYPES; w++) + for (c = 0; c < ZIO_CHILD_TYPES; c++) + for (w = 0; w < ZIO_WAIT_TYPES; w++) ASSERT(zio->io_children[c][w] == 0); if (bp != NULL) { diff --git a/module/zfs/zio_compress.c b/module/zfs/zio_compress.c index c563be4eb..560b43b68 100644 --- a/module/zfs/zio_compress.c +++ b/module/zfs/zio_compress.c @@ -24,7 +24,7 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" + #include <sys/zfs_context.h> #include <sys/compress.h> |