Mercurial > illumos > illumos-gate
changeset 2856:6f4d5ee1906a
6463348 ZFS code could be more portable
line wrap: on
line diff
--- a/usr/src/cmd/zdb/zdb.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/cmd/zdb/zdb.c Tue Oct 03 15:01:10 2006 -0700 @@ -389,17 +389,19 @@ (void) printf("\t\t[%4llu] %s: txg %llu, pass %llu\n", (u_longlong_t)(offset / sizeof (entry)), ddata[SM_DEBUG_ACTION_DECODE(entry)], - SM_DEBUG_TXG_DECODE(entry), - SM_DEBUG_SYNCPASS_DECODE(entry)); + (u_longlong_t)SM_DEBUG_TXG_DECODE(entry), + (u_longlong_t)SM_DEBUG_SYNCPASS_DECODE(entry)); } else { (void) printf("\t\t[%4llu] %c range:" " %08llx-%08llx size: %06llx\n", (u_longlong_t)(offset / sizeof (entry)), SM_TYPE_DECODE(entry) == SM_ALLOC ? 'A' : 'F', - (SM_OFFSET_DECODE(entry) << mapshift) + mapstart, - (SM_OFFSET_DECODE(entry) << mapshift) + mapstart + - (SM_RUN_DECODE(entry) << mapshift), - (SM_RUN_DECODE(entry) << mapshift)); + (u_longlong_t)((SM_OFFSET_DECODE(entry) << + mapshift) + mapstart), + (u_longlong_t)((SM_OFFSET_DECODE(entry) << + mapshift) + mapstart + (SM_RUN_DECODE(entry) << + mapshift)), + (u_longlong_t)(SM_RUN_DECODE(entry) << mapshift)); if (SM_TYPE_DECODE(entry) == SM_ALLOC) alloc += SM_RUN_DECODE(entry) << mapshift; else @@ -497,7 +499,7 @@ indent, "", (u_longlong_t)ss->ss_start, (u_longlong_t)ss->ss_end - 1, - (u_longlong_t)ss->ss_end - ss->ss_start); + (u_longlong_t)(ss->ss_end - ss->ss_start)); } (void) printf("\n"); @@ -844,7 +846,7 @@ object = parent; } - (void) sprintf(component, "???<object#%llu>", (u_longlong_t)object); + (void) sprintf(component, "\?\?\?<object#%llu>", (u_longlong_t)object); complen = strlen(component); path -= complen; @@ -1758,14 +1760,17 @@ */ for (d = 0; d < BP_GET_NDVAS(bp); d++) { (void) printf("\tDVA[%d]: vdev_id %lld / %llx\n", d, - DVA_GET_VDEV(&dva[d]), DVA_GET_OFFSET(&dva[d])); + (longlong_t)DVA_GET_VDEV(&dva[d]), + (longlong_t)DVA_GET_OFFSET(&dva[d])); (void) printf("\tDVA[%d]: GANG: %-5s GRID: %04llx\t" "ASIZE: %llx\n", d, DVA_GET_GANG(&dva[d]) ? "TRUE" : "FALSE", - DVA_GET_GRID(&dva[d]), DVA_GET_ASIZE(&dva[d])); + (longlong_t)DVA_GET_GRID(&dva[d]), + (longlong_t)DVA_GET_ASIZE(&dva[d])); (void) printf("\tDVA[%d]: :%llu:%llx:%llx:%s%s%s%s\n", d, - DVA_GET_VDEV(&dva[d]), DVA_GET_OFFSET(&dva[d]), - BP_GET_PSIZE(bp), + (u_longlong_t)DVA_GET_VDEV(&dva[d]), + (longlong_t)DVA_GET_OFFSET(&dva[d]), + (longlong_t)BP_GET_PSIZE(bp), BP_SHOULD_BYTESWAP(bp) ? "e" : "", !DVA_GET_GANG(&dva[d]) && BP_GET_LEVEL(bp) != 0 ? "d" : "", @@ -1773,12 +1778,12 @@ BP_GET_COMPRESS(bp) != 0 ? "d" : ""); } (void) printf("\tLSIZE: %-16llx\t\tPSIZE: %llx\n", - BP_GET_LSIZE(bp), BP_GET_PSIZE(bp)); + (longlong_t)BP_GET_LSIZE(bp), (longlong_t)BP_GET_PSIZE(bp)); (void) printf("\tENDIAN: %6s\t\t\t\t\tTYPE: %s\n", BP_GET_BYTEORDER(bp) ? "LITTLE" : "BIG", dmu_ot[BP_GET_TYPE(bp)].ot_name); (void) printf("\tBIRTH: %-16llx LEVEL: %-2llu\tFILL: %llx\n", - (u_longlong_t)bp->blk_birth, BP_GET_LEVEL(bp), + (u_longlong_t)bp->blk_birth, (u_longlong_t)BP_GET_LEVEL(bp), (u_longlong_t)bp->blk_fill); (void) printf("\tCKFUNC: %-16s\t\tCOMP: %s\n", zio_checksum_table[BP_GET_CHECKSUM(bp)].ci_name, @@ -1961,7 +1966,7 @@ for (s = strtok(flagstr, ":"); s; s = strtok(NULL, ":")) { for (i = 0; flagstr[i]; i++) { - int bit = flagbits[flagstr[i]]; + int bit = flagbits[(uchar_t)flagstr[i]]; if (bit == 0) { (void) printf("***Invalid flag: %c\n",
--- a/usr/src/cmd/zfs/zfs_main.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/cmd/zfs/zfs_main.c Tue Oct 03 15:01:10 2006 -0700 @@ -1869,7 +1869,6 @@ set_callback(zfs_handle_t *zhp, void *data) { set_cbdata_t *cbp = data; - int ret = 1; if (zfs_prop_set(zhp, cbp->cb_propname, cbp->cb_value) != 0) { switch (libzfs_errno(g_zfs)) { @@ -1884,9 +1883,7 @@ } return (1); } - ret = 0; -error: - return (ret); + return (0); } static int @@ -3014,7 +3011,7 @@ static int volcheck(zpool_handle_t *zhp, void *data) { - int isinit = (int)data; + boolean_t isinit = *((boolean_t *)data); if (isinit) return (zpool_create_zvol_links(zhp)); @@ -3029,7 +3026,7 @@ static int do_volcheck(boolean_t isinit) { - return (zpool_iter(g_zfs, volcheck, (void *)isinit) ? 1 : 0); + return (zpool_iter(g_zfs, volcheck, &isinit) ? 1 : 0); } int
--- a/usr/src/cmd/zpool/zpool_iter.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/cmd/zpool/zpool_iter.c Tue Oct 03 15:01:10 2006 -0700 @@ -106,11 +106,11 @@ offsetof(zpool_node_t, zn_avlnode), zpool_compare, UU_DEFAULT); if (zlp->zl_pool == NULL) - no_memory(); + zpool_no_memory(); if ((zlp->zl_avl = uu_avl_create(zlp->zl_pool, NULL, UU_DEFAULT)) == NULL) - no_memory(); + zpool_no_memory(); if (argc == 0) { (void) zpool_iter(g_zfs, add_pool, zlp);
--- a/usr/src/cmd/zpool/zpool_main.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/cmd/zpool/zpool_main.c Tue Oct 03 15:01:10 2006 -0700 @@ -952,7 +952,7 @@ reason = zpool_import_status(config, &msgid); (void) printf(" pool: %s\n", name); - (void) printf(" id: %llu\n", guid); + (void) printf(" id: %llu\n", (u_longlong_t)guid); (void) printf(" state: %s", health); if (pool_state == POOL_STATE_DESTROYED) (void) printf(" (DESTROYED)"); @@ -1832,7 +1832,7 @@ uint64_t capacity = (total == 0 ? 0 : (used * 100 / total)); (void) snprintf(buf, sizeof (buf), "%llu%%", - capacity); + (u_longlong_t)capacity); } break; @@ -2624,8 +2624,8 @@ (void) printf("errors: The following persistent errors have been " "detected:\n\n"); - (void) printf("%8s %-*s %-*s %s\n", "", maxdsname, "DATASET", - maxobjname, "OBJECT", "RANGE"); + (void) printf("%8s %-*s %-*s %s\n", "", (int)maxdsname, "DATASET", + (int)maxobjname, "OBJECT", "RANGE"); for (i = 0; i < nelem; i++) { nv = log[i]; @@ -2637,8 +2637,8 @@ verify(nvlist_lookup_string(nv, ZPOOL_ERR_RANGE, &range) == 0); - (void) printf("%8s %-*s %-*s %s\n", "", maxdsname, - dsname, maxobjname, objname, range); + (void) printf("%8s %-*s %-*s %s\n", "", (int)maxdsname, + dsname, (int)maxobjname, objname, range); } } @@ -2870,7 +2870,8 @@ "errors\n")); else if (!cbp->cb_verbose) (void) printf(gettext("errors: %llu data " - "errors, use '-v' for a list\n"), nerr); + "errors, use '-v' for a list\n"), + (u_longlong_t)nerr); else print_error_log(zhp); } @@ -2962,7 +2963,7 @@ cbp->cb_first = B_FALSE; } - (void) printf("%2llu %s\n", version, + (void) printf("%2llu %s\n", (u_longlong_t)version, zpool_get_name(zhp)); } else { cbp->cb_first = B_FALSE; @@ -2983,7 +2984,7 @@ cbp->cb_first = B_FALSE; } - (void) printf("%2llu %s\n", version, + (void) printf("%2llu %s\n", (u_longlong_t)version, zpool_get_name(zhp)); }
--- a/usr/src/cmd/zpool/zpool_util.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/cmd/zpool/zpool_util.c Tue Oct 03 15:01:10 2006 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -71,7 +70,7 @@ * Display an out of memory error message and abort the current program. */ void -no_memory(void) +zpool_no_memory(void) { assert(errno == ENOMEM); (void) fprintf(stderr,
--- a/usr/src/cmd/zpool/zpool_util.h Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/cmd/zpool/zpool_util.h Tue Oct 03 15:01:10 2006 -0700 @@ -40,7 +40,7 @@ */ void *safe_malloc(size_t); char *safe_strdup(const char *); -void no_memory(void); +void zpool_no_memory(void); /* * Virtual device functions
--- a/usr/src/cmd/zpool/zpool_vdev.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/cmd/zpool/zpool_vdev.c Tue Oct 03 15:01:10 2006 -0700 @@ -846,7 +846,7 @@ * were unable to read the disk geometry. */ if (errno == ENOMEM) - no_memory(); + zpool_no_memory(); (void) fprintf(stderr, gettext("cannot label '%s': unable to " "read disk geometry\n"), name); @@ -1175,7 +1175,7 @@ child = realloc(child, children * sizeof (nvlist_t *)); if (child == NULL) - no_memory(); + zpool_no_memory(); if ((nv = make_leaf_vdev(argv[c])) == NULL) return (NULL); child[children - 1] = nv; @@ -1227,7 +1227,7 @@ toplevels++; top = realloc(top, toplevels * sizeof (nvlist_t *)); if (top == NULL) - no_memory(); + zpool_no_memory(); top[toplevels - 1] = nv; }
--- a/usr/src/cmd/ztest/ztest.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/cmd/ztest/ztest.c Tue Oct 03 15:01:10 2006 -0700 @@ -1133,28 +1133,6 @@ return (zil_itx_assign(zilog, itx, tx)); } -#ifndef lint -static uint64_t -ztest_log_remove(zilog_t *zilog, dmu_tx_t *tx, uint64_t object) -{ - itx_t *itx; - lr_remove_t *lr; - size_t namesize; - char name[24]; - - (void) sprintf(name, "ZOBJ_%llu", (u_longlong_t)object); - namesize = strlen(name) + 1; - - itx = zil_itx_create(TX_REMOVE, sizeof (*lr) + namesize + - ztest_random(8000)); - lr = (lr_remove_t *)&itx->itx_lr; - lr->lr_doid = object; - bcopy(name, (char *)(lr + 1), namesize); - - return (zil_itx_assign(zilog, itx, tx)); -} -#endif /* lint */ - void ztest_dmu_objset_create_destroy(ztest_args_t *za) { @@ -3335,7 +3313,7 @@ exit(0); } - while (waitpid(pid, &status, WEXITED) != pid) + while (waitpid(pid, &status, 0) != pid) continue; if (WIFEXITED(status)) { @@ -3345,7 +3323,7 @@ WEXITSTATUS(status)); exit(2); } - } else { + } else if (WIFSIGNALED(status)) { if (WTERMSIG(status) != SIGKILL) { (void) fprintf(stderr, "child died with signal %d\n", @@ -3353,6 +3331,10 @@ exit(3); } kills++; + } else { + (void) fprintf(stderr, "something strange happened " + "to child\n"); + exit(4); } iters++;
--- a/usr/src/common/avl/avl.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/common/avl/avl.c Tue Oct 03 15:01:10 2006 -0700 @@ -261,7 +261,7 @@ if (diff == 0) { #ifdef DEBUG if (where != NULL) - *where = NULL; + *where = 0; #endif return (AVL_NODE2DATA(node, off)); }
--- a/usr/src/common/nvpair/nvpair.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/common/nvpair/nvpair.c Tue Oct 03 15:01:10 2006 -0700 @@ -567,7 +567,7 @@ if (!(priv->nvp_stat & NV_STAT_EMBEDDED)) nv_mem_free(priv, nvl, NV_ALIGN(sizeof (nvlist_t))); else - nvl->nvl_priv = NULL; + nvl->nvl_priv = 0; nv_mem_free(priv, priv, sizeof (nvpriv_t)); } @@ -872,6 +872,8 @@ } break; } + default: + break; } /* calculate sizes of the nvpair elements and the nvpair itself */ @@ -1794,7 +1796,7 @@ { int err; - if (nvl->nvl_priv == NULL) + if (nvl->nvl_priv == 0) return (EFAULT); /*
--- a/usr/src/common/nvpair/nvpair_alloc_fixed.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/common/nvpair/nvpair_alloc_fixed.c Tue Oct 03 15:01:10 2006 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -69,7 +69,7 @@ uintptr_t lim = base + va_arg(valist, size_t); nvbuf_t *nvb = (nvbuf_t *)P2ROUNDUP(base, sizeof (uintptr_t)); - if (base == NULL || (uintptr_t)&nvb[1] > lim) + if (base == 0 || (uintptr_t)&nvb[1] > lim) return (EINVAL); nvb->nvb_buf = (uintptr_t)&nvb[0];
--- a/usr/src/lib/libuutil/common/uu_avl.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/lib/libuutil/common/uu_avl.c Tue Oct 03 15:01:10 2006 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -155,7 +154,7 @@ } na[0] = POOL_TO_MARKER(pp); - na[1] = NULL; + na[1] = 0; } void @@ -169,7 +168,7 @@ "node already finied\n", base, np, pp, pp->uap_name); } - if (na[0] != POOL_TO_MARKER(pp) || na[1] != NULL) { + if (na[0] != POOL_TO_MARKER(pp) || na[1] != 0) { uu_panic("uu_avl_node_fini(%p, %p, %p (\"%s\")): " "node corrupt, in tree, or in different pool\n", base, np, pp, pp->uap_name); @@ -449,7 +448,7 @@ avl_remove(&ap->ua_tree, elem); na[0] = POOL_TO_MARKER(pp); - na[1] = NULL; + na[1] = 0; } void * @@ -462,7 +461,7 @@ uintptr_t *na = NODE_ARRAY(pp, elem); na[0] = POOL_TO_MARKER(pp); - na[1] = NULL; + na[1] = 0; } return (elem); } @@ -495,11 +494,11 @@ uu_avl_pool_t *pp = ap->ua_pool; uintptr_t *na = NODE_ARRAY(pp, elem); - if (na[1] != NULL) + if (na[1] != 0) uu_panic("uu_avl_insert(%p, %p, %p): node already " "in tree, or corrupt\n", ap, elem, idx); - if (na[0] == NULL) + if (na[0] == 0) uu_panic("uu_avl_insert(%p, %p, %p): node not " "initialized\n", ap, elem, idx);
--- a/usr/src/lib/libzfs/common/libzfs_dataset.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/lib/libzfs/common/libzfs_dataset.c Tue Oct 03 15:01:10 2006 -0700 @@ -157,6 +157,21 @@ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "multiple '@' delimiters in name")); break; + + case NAME_ERR_NOLETTER: + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "pool doesn't begin with a letter")); + break; + + case NAME_ERR_RESERVED: + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "name is reserved")); + break; + + case NAME_ERR_DISKLIKE: + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "reserved disk name")); + break; } } @@ -1540,7 +1555,8 @@ if (get_numeric_property(zhp, prop, src, &source, &val) != 0) return (-1); if (literal) - (void) snprintf(propbuf, proplen, "%llu", val); + (void) snprintf(propbuf, proplen, "%llu", + (u_longlong_t)val); else zfs_nicenum(val, propbuf, proplen); break; @@ -1570,6 +1586,7 @@ strftime(propbuf, proplen, "%a %b %e %k:%M %Y", &t) == 0) (void) snprintf(propbuf, proplen, "%llu", + (u_longlong_t) zhp->zfs_dmustats.dds_creation_time); } break; @@ -1648,7 +1665,8 @@ (void) strlcpy(propbuf, "none", proplen); } else { if (literal) - (void) snprintf(propbuf, proplen, "%llu", val); + (void) snprintf(propbuf, proplen, "%llu", + (u_longlong_t)val); else zfs_nicenum(val, propbuf, proplen); } @@ -1657,8 +1675,8 @@ case ZFS_PROP_COMPRESSRATIO: if (get_numeric_property(zhp, prop, src, &source, &val) != 0) return (-1); - (void) snprintf(propbuf, proplen, "%lld.%02lldx", val / 100, - val % 100); + (void) snprintf(propbuf, proplen, "%lld.%02lldx", (longlong_t) + val / 100, (longlong_t)val % 100); break; case ZFS_PROP_TYPE:
--- a/usr/src/lib/libzfs/common/libzfs_pool.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/lib/libzfs/common/libzfs_pool.c Tue Oct 03 15:01:10 2006 -0700 @@ -99,6 +99,27 @@ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "pool name is reserved")); break; + + case NAME_ERR_LEADING_SLASH: + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "leading slash in name")); + break; + + case NAME_ERR_EMPTY_COMPONENT: + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "empty component in name")); + break; + + case NAME_ERR_TRAILING_SLASH: + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "trailing slash in name")); + break; + + case NAME_ERR_MULTIPLE_AT: + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "multiple '@' delimiters in name")); + break; + } } return (B_FALSE); @@ -470,7 +491,7 @@ ZFS_TYPE_FILESYSTEM)) == NULL) return (-1); - if (zpool_remove_zvol_links(zhp) != NULL) + if (zpool_remove_zvol_links(zhp) != 0) return (-1); (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name)); @@ -1378,7 +1399,8 @@ &value) == 0) { verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, &value) == 0); - (void) snprintf(buf, sizeof (buf), "%llu", value); + (void) snprintf(buf, sizeof (buf), "%llu", + (u_longlong_t)value); path = buf; } else if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0) { @@ -1432,7 +1454,7 @@ verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NPARITY, &value) == 0); (void) snprintf(buf, sizeof (buf), "%s%llu", path, - value); + (u_longlong_t)value); path = buf; } } @@ -1473,7 +1495,7 @@ verify(nvlist_lookup_uint64(zhp->zpool_config, ZPOOL_CONFIG_ERRCOUNT, &count) == 0); if ((zc.zc_nvlist_dst = (uintptr_t)zfs_alloc(zhp->zpool_hdl, - count * sizeof (zbookmark_t))) == NULL) + count * sizeof (zbookmark_t))) == (uintptr_t)NULL) return (-1); zc.zc_nvlist_dst_size = count; (void) strcpy(zc.zc_name, zhp->zpool_name); @@ -1484,7 +1506,7 @@ if (errno == ENOMEM) { if ((zc.zc_nvlist_dst = (uintptr_t) zfs_alloc(zhp->zpool_hdl, - zc.zc_nvlist_dst_size)) == NULL) + zc.zc_nvlist_dst_size)) == (uintptr_t)NULL) return (-1); } else { return (-1); @@ -1574,12 +1596,14 @@ zhp->zpool_error_log[j] = nv; (void) snprintf(buf, sizeof (buf), - "%llx", zb[i].zb_objset); + "%llx", (longlong_t) + zb[i].zb_objset); if (nvlist_add_string(nv, ZPOOL_ERR_DATASET, buf) != 0) goto nomem; (void) snprintf(buf, sizeof (buf), - "%llx", zb[i].zb_object); + "%llx", (longlong_t) + zb[i].zb_object); if (nvlist_add_string(nv, ZPOOL_ERR_OBJECT, buf) != 0) goto nomem;
--- a/usr/src/lib/libzpool/common/kernel.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/lib/libzpool/common/kernel.c Tue Oct 03 15:01:10 2006 -0700 @@ -36,6 +36,7 @@ #include <sys/spa.h> #include <sys/processor.h> + /* * Emulation of kernel services in userland. */ @@ -85,7 +86,7 @@ { ASSERT(mp->m_owner != (void *)-1UL); ASSERT(mp->m_owner != curthread); - (void) mutex_lock(&mp->m_lock); + VERIFY(mutex_lock(&mp->m_lock) == 0); ASSERT(mp->m_owner == NULL); mp->m_owner = curthread; } @@ -108,7 +109,7 @@ { ASSERT(mutex_owner(mp) == curthread); mp->m_owner = NULL; - (void) mutex_unlock(&mp->m_lock); + VERIFY(mutex_unlock(&mp->m_lock) == 0); } void * @@ -199,13 +200,13 @@ void cv_init(kcondvar_t *cv, char *name, int type, void *arg) { - (void) cond_init(cv, type, NULL); + VERIFY(cond_init(cv, type, NULL) == 0); } void cv_destroy(kcondvar_t *cv) { - (void) cond_destroy(cv); + VERIFY(cond_destroy(cv) == 0); } void @@ -213,7 +214,8 @@ { ASSERT(mutex_owner(mp) == curthread); mp->m_owner = NULL; - (void) cond_wait(cv, &mp->m_lock); + int ret = cond_wait(cv, &mp->m_lock); + VERIFY(ret == 0 || ret == EINTR); mp->m_owner = curthread; } @@ -251,13 +253,13 @@ void cv_signal(kcondvar_t *cv) { - (void) cond_signal(cv); + VERIFY(cond_signal(cv) == 0); } void cv_broadcast(kcondvar_t *cv) { - (void) cond_broadcast(cv); + VERIFY(cond_broadcast(cv) == 0); } /*
--- a/usr/src/lib/libzpool/common/sys/zfs_context.h Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/lib/libzpool/common/sys/zfs_context.h Tue Oct 03 15:01:10 2006 -0700 @@ -178,7 +178,7 @@ #define thread_create(stk, stksize, func, arg, len, pp, state, pri) \ zk_thread_create(func, arg) -#define thread_exit() thr_exit(0) +#define thread_exit() thr_exit(NULL) extern kthread_t *zk_thread_create(void (*func)(), void *arg);
--- a/usr/src/uts/common/fs/zfs/arc.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/arc.c Tue Oct 03 15:01:10 2006 -0700 @@ -1303,6 +1303,7 @@ /* reset the growth delay for every reclaim */ growtime = lbolt + (arc_grow_retry * hz); + ASSERT(growtime > 0); arc_kmem_reap_now(last_reclaim); @@ -2449,6 +2450,12 @@ arc.evict_skip = 0; arc.mutex_miss = 0; + mutex_init(&arc.anon->mtx, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc.mru->mtx, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc.mru_ghost->mtx, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc.mfu->mtx, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc.mfu_ghost->mtx, NULL, MUTEX_DEFAULT, NULL); + list_create(&arc.mru->list, sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); list_create(&arc.mru_ghost->list, sizeof (arc_buf_hdr_t), @@ -2491,5 +2498,11 @@ list_destroy(&arc.mfu->list); list_destroy(&arc.mfu_ghost->list); + mutex_destroy(&arc.anon->mtx); + mutex_destroy(&arc.mru->mtx); + mutex_destroy(&arc.mru_ghost->mtx); + mutex_destroy(&arc.mfu->mtx); + mutex_destroy(&arc.mfu_ghost->mtx); + buf_fini(); }
--- a/usr/src/uts/common/fs/zfs/dmu_objset.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/dmu_objset.c Tue Oct 03 15:01:10 2006 -0700 @@ -214,6 +214,9 @@ list_create(&osi->os_downgraded_dbufs, sizeof (dmu_buf_impl_t), offsetof(dmu_buf_impl_t, db_link)); + mutex_init(&osi->os_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&osi->os_obj_lock, NULL, MUTEX_DEFAULT, NULL); + osi->os_meta_dnode = dnode_special_open(osi, &osi->os_phys->os_meta_dnode, DMU_META_DNODE_OBJECT); @@ -361,6 +364,8 @@ zil_free(osi->os_zil); zio_buf_free(osi->os_phys, sizeof (objset_phys_t)); + mutex_destroy(&osi->os_lock); + mutex_destroy(&osi->os_obj_lock); kmem_free(osi, sizeof (objset_impl_t)); }
--- a/usr/src/uts/common/fs/zfs/dmu_zfetch.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/dmu_zfetch.c Tue Oct 03 15:01:10 2006 -0700 @@ -55,7 +55,6 @@ static int dmu_zfetch_stream_insert(zfetch_t *, zstream_t *); static zstream_t *dmu_zfetch_stream_reclaim(zfetch_t *); static void dmu_zfetch_stream_remove(zfetch_t *, zstream_t *); -static void dmu_zfetch_stream_update(zfetch_t *, zstream_t *); static int dmu_zfetch_streams_equal(zstream_t *, zstream_t *); /*
--- a/usr/src/uts/common/fs/zfs/dsl_dataset.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/dsl_dataset.c Tue Oct 03 15:01:10 2006 -0700 @@ -231,6 +231,9 @@ if (list_link_active(&ds->ds_synced_link)) list_remove(&dp->dp_synced_objsets, ds); + mutex_destroy(&ds->ds_lock); + mutex_destroy(&ds->ds_deadlist.bpl_lock); + kmem_free(ds, sizeof (dsl_dataset_t)); } @@ -284,6 +287,10 @@ ds->ds_object = dsobj; ds->ds_phys = dbuf->db_data; + mutex_init(&ds->ds_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&ds->ds_deadlist.bpl_lock, NULL, MUTEX_DEFAULT, + NULL); + err = bplist_open(&ds->ds_deadlist, mos, ds->ds_phys->ds_deadlist_obj); if (err == 0) { @@ -295,6 +302,8 @@ * we don't really need to close the blist if we * just opened it. */ + mutex_destroy(&ds->ds_lock); + mutex_destroy(&ds->ds_deadlist.bpl_lock); kmem_free(ds, sizeof (dsl_dataset_t)); dmu_buf_rele(dbuf, tag); return (err); @@ -343,6 +352,8 @@ DS_MODE_NONE, ds); } dsl_dir_close(ds->ds_dir, ds); + mutex_destroy(&ds->ds_lock); + mutex_destroy(&ds->ds_deadlist.bpl_lock); kmem_free(ds, sizeof (dsl_dataset_t)); if (err) { dmu_buf_rele(dbuf, tag);
--- a/usr/src/uts/common/fs/zfs/dsl_dir.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/dsl_dir.c Tue Oct 03 15:01:10 2006 -0700 @@ -37,7 +37,6 @@ #include <sys/arc.h> #include "zfs_namecheck.h" -static uint64_t dsl_dir_space_accounted(dsl_dir_t *dd); static uint64_t dsl_dir_estimated_space(dsl_dir_t *dd); static uint64_t dsl_dir_space_available(dsl_dir_t *dd, dsl_dir_t *ancestor, int64_t delta, int ondiskonly); @@ -70,6 +69,7 @@ * dir open. */ list_destroy(&dd->dd_prop_cbs); + mutex_destroy(&dd->dd_lock); kmem_free(dd, sizeof (dsl_dir_t)); } @@ -106,6 +106,7 @@ dd->dd_pool = dp; dd->dd_phys = dbuf->db_data; dd->dd_used_bytes = dd->dd_phys->dd_used_bytes; + mutex_init(&dd->dd_lock, NULL, MUTEX_DEFAULT, NULL); list_create(&dd->dd_prop_cbs, sizeof (dsl_prop_cb_record_t), offsetof(dsl_prop_cb_record_t, cbr_node)); @@ -114,6 +115,7 @@ err = dsl_dir_open_obj(dp, dd->dd_phys->dd_parent_obj, NULL, dd, &dd->dd_parent); if (err) { + mutex_destroy(&dd->dd_lock); kmem_free(dd, sizeof (dsl_dir_t)); dmu_buf_rele(dbuf, tag); return (err); @@ -137,6 +139,7 @@ } if (err) { dsl_dir_close(dd->dd_parent, dd); + mutex_destroy(&dd->dd_lock); kmem_free(dd, sizeof (dsl_dir_t)); dmu_buf_rele(dbuf, tag); return (err); @@ -150,6 +153,7 @@ if (winner) { if (dd->dd_parent) dsl_dir_close(dd->dd_parent, dd); + mutex_destroy(&dd->dd_lock); kmem_free(dd, sizeof (dsl_dir_t)); dd = winner; } else {
--- a/usr/src/uts/common/fs/zfs/dsl_pool.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/dsl_pool.c Tue Oct 03 15:01:10 2006 -0700 @@ -60,6 +60,7 @@ dp = kmem_zalloc(sizeof (dsl_pool_t), KM_SLEEP); dp->dp_spa = spa; dp->dp_meta_rootbp = *bp; + rw_init(&dp->dp_config_rwlock, NULL, RW_DEFAULT, NULL); txg_init(dp, txg); txg_list_create(&dp->dp_dirty_datasets, @@ -131,6 +132,7 @@ arc_flush(); txg_fini(dp); + rw_destroy(&dp->dp_config_rwlock); kmem_free(dp, sizeof (dsl_pool_t)); }
--- a/usr/src/uts/common/fs/zfs/metaslab.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/metaslab.c Tue Oct 03 15:01:10 2006 -0700 @@ -293,6 +293,7 @@ metaslab_t *msp; msp = kmem_zalloc(sizeof (metaslab_t), KM_SLEEP); + mutex_init(&msp->ms_lock, NULL, MUTEX_DEFAULT, NULL); msp->ms_smo_syncing = *smo; @@ -355,6 +356,7 @@ } mutex_exit(&msp->ms_lock); + mutex_destroy(&msp->ms_lock); kmem_free(msp, sizeof (metaslab_t)); }
--- a/usr/src/uts/common/fs/zfs/spa.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/spa.c Tue Oct 03 15:01:10 2006 -0700 @@ -124,6 +124,14 @@ rw_init(&spa->spa_traverse_lock, NULL, RW_DEFAULT, NULL); + mutex_init(&spa->spa_async_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&spa->spa_config_cache_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&spa->spa_scrub_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&spa->spa_errlog_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&spa->spa_errlist_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&spa->spa_config_lock.scl_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&spa->spa_sync_bplist.bpl_lock, NULL, MUTEX_DEFAULT, NULL); + list_create(&spa->spa_dirty_list, sizeof (vdev_t), offsetof(vdev_t, vdev_dirty_node));
--- a/usr/src/uts/common/fs/zfs/spa_errlog.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/spa_errlog.c Tue Oct 03 15:01:10 2006 -0700 @@ -60,6 +60,7 @@ * This is a stripped-down version of strtoull, suitable only for converting * lowercase hexidecimal numbers that don't overflow. */ +#ifdef _KERNEL static uint64_t strtonum(char *str, char **nptr) { @@ -85,6 +86,7 @@ return (val); } +#endif /* * Convert a bookmark to a string. @@ -100,6 +102,7 @@ /* * Convert a string to a bookmark */ +#ifdef _KERNEL static void name_to_bookmark(char *buf, zbookmark_t *zb) { @@ -112,6 +115,7 @@ zb->zb_blkid = strtonum(buf + 1, &buf); ASSERT(*buf == '\0'); } +#endif /* * Log an uncorrectable error to the persistent error log. We add it to the
--- a/usr/src/uts/common/fs/zfs/spa_misc.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/spa_misc.c Tue Oct 03 15:01:10 2006 -0700 @@ -276,6 +276,14 @@ refcount_destroy(&spa->spa_refcount); refcount_destroy(&spa->spa_config_lock.scl_count); + mutex_destroy(&spa->spa_sync_bplist.bpl_lock); + mutex_destroy(&spa->spa_config_lock.scl_lock); + mutex_destroy(&spa->spa_errlist_lock); + mutex_destroy(&spa->spa_errlog_lock); + mutex_destroy(&spa->spa_scrub_lock); + mutex_destroy(&spa->spa_config_cache_lock); + mutex_destroy(&spa->spa_async_lock); + kmem_free(spa, sizeof (spa_t)); }
--- a/usr/src/uts/common/fs/zfs/sys/spa.h Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/sys/spa.h Tue Oct 03 15:01:10 2006 -0700 @@ -61,9 +61,9 @@ #define BF64_GET(x, low, len) BF64_DECODE(x, low, len) #define BF32_SET(x, low, len, val) \ - ((x) ^= BF32_ENCODE((x >> low) ^ val, low, len)) + ((x) ^= BF32_ENCODE((x >> low) ^ (val), low, len)) #define BF64_SET(x, low, len, val) \ - ((x) ^= BF64_ENCODE((x >> low) ^ val, low, len)) + ((x) ^= BF64_ENCODE((x >> low) ^ (val), low, len)) #define BF32_GET_SB(x, low, len, shift, bias) \ ((BF32_GET(x, low, len) + (bias)) << (shift))
--- a/usr/src/uts/common/fs/zfs/sys/vdev_impl.h Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/sys/vdev_impl.h Tue Oct 03 15:01:10 2006 -0700 @@ -203,7 +203,8 @@ offsetof(vdev_label_t, vl_uberblock[(n) << VDEV_UBERBLOCK_SHIFT(vd)]) #define VDEV_UBERBLOCK_SIZE(vd) (1ULL << VDEV_UBERBLOCK_SHIFT(vd)) -#define VDEV_BOOT_MAGIC 0x2f5b007b10c /* ZFS boot block */ +/* ZFS boot block */ +#define VDEV_BOOT_MAGIC 0x2f5b007b10cULL #define VDEV_BOOT_VERSION 1 /* version number */ typedef struct vdev_boot_header {
--- a/usr/src/uts/common/fs/zfs/sys/zap_impl.h Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/sys/zap_impl.h Tue Oct 03 15:01:10 2006 -0700 @@ -38,7 +38,7 @@ extern int fzap_default_block_shift; -#define ZAP_MAGIC 0x2F52AB2AB +#define ZAP_MAGIC 0x2F52AB2ABULL #define FZAP_BLOCK_SHIFT(zap) ((zap)->zap_f.zap_block_shift)
--- a/usr/src/uts/common/fs/zfs/txg.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/txg.c Tue Oct 03 15:01:10 2006 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -49,12 +48,16 @@ txg_init(dsl_pool_t *dp, uint64_t txg) { tx_state_t *tx = &dp->dp_tx; - + int c; bzero(tx, sizeof (tx_state_t)); tx->tx_cpu = kmem_zalloc(max_ncpus * sizeof (tx_cpu_t), KM_SLEEP); + for (c = 0; c < max_ncpus; c++) + mutex_init(&tx->tx_cpu[c].tc_lock, NULL, MUTEX_DEFAULT, NULL); + rw_init(&tx->tx_suspend, NULL, RW_DEFAULT, NULL); + mutex_init(&tx->tx_sync_lock, NULL, MUTEX_DEFAULT, NULL); tx->tx_open_txg = txg; } @@ -66,10 +69,15 @@ txg_fini(dsl_pool_t *dp) { tx_state_t *tx = &dp->dp_tx; + int c; ASSERT(tx->tx_threads == 0); rw_destroy(&tx->tx_suspend); + mutex_destroy(&tx->tx_sync_lock); + + for (c = 0; c < max_ncpus; c++) + mutex_destroy(&tx->tx_cpu[c].tc_lock); kmem_free(tx->tx_cpu, max_ncpus * sizeof (tx_cpu_t));
--- a/usr/src/uts/common/fs/zfs/unique.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/unique.c Tue Oct 03 15:01:10 2006 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,7 +30,7 @@ #include <sys/unique.h> static avl_tree_t unique_avl; -static kmutex_t unique_mtx; +static kmutex_t unique_mtx; /* Lock never initialized. */ typedef struct unique { avl_node_t un_link;
--- a/usr/src/uts/common/fs/zfs/vdev.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/vdev.c Tue Oct 03 15:01:10 2006 -0700 @@ -302,6 +302,7 @@ vd->vdev_state = VDEV_STATE_CLOSED; mutex_init(&vd->vdev_dtl_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&vd->vdev_stat_lock, NULL, MUTEX_DEFAULT, NULL); space_map_create(&vd->vdev_dtl_map, 0, -1ULL, 0, &vd->vdev_dtl_lock); space_map_create(&vd->vdev_dtl_scrub, 0, -1ULL, 0, &vd->vdev_dtl_lock); txg_list_create(&vd->vdev_ms_list, @@ -338,6 +339,7 @@ space_map_destroy(&vd->vdev_dtl_scrub); mutex_exit(&vd->vdev_dtl_lock); mutex_destroy(&vd->vdev_dtl_lock); + mutex_destroy(&vd->vdev_stat_lock); if (vd == spa->spa_root_vdev) spa->spa_root_vdev = NULL;
--- a/usr/src/uts/common/fs/zfs/zap.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/zap.c Tue Oct 03 15:01:10 2006 -0700 @@ -62,17 +62,11 @@ block_type = *(uint64_t *)vbuf; - switch (block_type) { - case ZBT_LEAF: - case BSWAP_64(ZBT_LEAF): + if (block_type == ZBT_LEAF || block_type == BSWAP_64(ZBT_LEAF)) zap_leaf_byteswap(vbuf, size); - return; - case ZBT_HEADER: - case BSWAP_64(ZBT_HEADER): - default: + else { /* it's a ptrtbl block */ byteswap_uint64_array(vbuf, size); - return; } } @@ -849,7 +843,6 @@ goto retry; } -out: zap_put_leaf_maybe_grow_ptrtbl(zap, l, tx); return (err); }
--- a/usr/src/uts/common/fs/zfs/zap_leaf.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/zap_leaf.c Tue Oct 03 15:01:10 2006 -0700 @@ -94,7 +94,7 @@ return (*(uint64_t *)addr); } ASSERT(!"bad int len"); - return (0xFEEDFACEDEADBEEF); + return (0xFEEDFACEDEADBEEFULL); } void
--- a/usr/src/uts/common/fs/zfs/zap_micro.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/zap_micro.c Tue Oct 03 15:01:10 2006 -0700 @@ -35,8 +35,6 @@ #include <sys/avl.h> -static uint64_t mzap_write_cookie(zap_t *zap, uint64_t cookie, - uint64_t entptr); static void mzap_upgrade(zap_t *zap, dmu_tx_t *tx); @@ -62,15 +60,11 @@ block_type = *(uint64_t *)buf; - switch (block_type) { - case ZBT_MICRO: - case BSWAP_64(ZBT_MICRO): + if (block_type == ZBT_MICRO || block_type == BSWAP_64(ZBT_MICRO)) { /* ASSERT(magic == ZAP_LEAF_MAGIC); */ mzap_byteswap(buf, size); - return; - default: + } else { fzap_byteswap(buf, size); - return; } }
--- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c Tue Oct 03 15:01:10 2006 -0700 @@ -614,7 +614,7 @@ dmu_objset_stats(os, &zc->zc_objset_stats); - if (zc->zc_nvlist_dst != NULL && + if (zc->zc_nvlist_dst != 0 && (error = dsl_prop_get_all(os, &nv)) == 0) { error = put_nvlist(zc, nv); nvlist_free(nv); @@ -1413,6 +1413,9 @@ if (dataset_namecheck(zc->zc_name, NULL, NULL) != 0) error = EINVAL; break; + + case no_name: + break; } }
--- a/usr/src/uts/common/fs/zfs/zfs_znode.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/zfs_znode.c Tue Oct 03 15:01:10 2006 -0700 @@ -323,6 +323,8 @@ */ list_create(&zfsvfs->z_delete_head.z_znodes, sizeof (znode_t), offsetof(znode_t, z_list_node)); + /* Mutex never destroyed. */ + mutex_init(&zfsvfs->z_delete_head.z_mutex, NULL, MUTEX_DEFAULT, NULL); return (0); }
--- a/usr/src/uts/common/fs/zfs/zil.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/zil.c Tue Oct 03 15:01:10 2006 -0700 @@ -1068,7 +1068,7 @@ zil_init(void) { zil_lwb_cache = kmem_cache_create("zil_lwb_cache", - sizeof (struct lwb), NULL, NULL, NULL, NULL, NULL, NULL, 0); + sizeof (struct lwb), 0, NULL, NULL, NULL, NULL, NULL, 0); } void @@ -1090,6 +1090,8 @@ zilog->zl_dmu_pool = dmu_objset_pool(os); zilog->zl_destroy_txg = TXG_INITIAL - 1; + mutex_init(&zilog->zl_lock, NULL, MUTEX_DEFAULT, NULL); + list_create(&zilog->zl_itx_list, sizeof (itx_t), offsetof(itx_t, itx_node)); @@ -1126,6 +1128,7 @@ ASSERT(list_head(&zilog->zl_itx_list) == NULL); list_destroy(&zilog->zl_itx_list); + mutex_destroy(&zilog->zl_lock); kmem_free(zilog, sizeof (zilog_t)); }
--- a/usr/src/uts/common/fs/zfs/zio.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/zio.c Tue Oct 03 15:01:10 2006 -0700 @@ -112,7 +112,7 @@ if (align != 0) { char name[30]; - (void) sprintf(name, "zio_buf_%lu", size); + (void) sprintf(name, "zio_buf_%lu", (ulong_t)size); zio_buf_cache[c] = kmem_cache_create(name, size, align, NULL, NULL, NULL, NULL, NULL, KMC_NODEBUG); dprintf("creating cache for size %5lx align %5lx\n", @@ -258,6 +258,7 @@ zio->io_async_stages = ZIO_ASYNC_PIPELINE_STAGES; zio->io_timestamp = lbolt64; zio->io_flags = flags; + mutex_init(&zio->io_lock, NULL, MUTEX_DEFAULT, NULL); zio_push_transform(zio, data, size, size); if (pio == NULL) { @@ -653,7 +654,7 @@ mutex_exit(&zio->io_lock); error = zio->io_error; - + mutex_destroy(&zio->io_lock); kmem_free(zio, sizeof (zio_t)); return (error);
--- a/usr/src/uts/common/fs/zfs/zio_checksum.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/zio_checksum.c Tue Oct 03 15:01:10 2006 -0700 @@ -68,15 +68,15 @@ } zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = { - NULL, NULL, 0, 0, "inherit", - NULL, NULL, 0, 0, "on", - zio_checksum_off, zio_checksum_off, 0, 0, "off", - zio_checksum_SHA256, zio_checksum_SHA256, 1, 1, "label", - zio_checksum_SHA256, zio_checksum_SHA256, 1, 1, "gang_header", - fletcher_2_native, fletcher_2_byteswap, 0, 1, "zilog", - fletcher_2_native, fletcher_2_byteswap, 0, 0, "fletcher2", - fletcher_4_native, fletcher_4_byteswap, 1, 0, "fletcher4", - zio_checksum_SHA256, zio_checksum_SHA256, 1, 0, "SHA256", + {{NULL, NULL}, 0, 0, "inherit"}, + {{NULL, NULL}, 0, 0, "on"}, + {{zio_checksum_off, zio_checksum_off}, 0, 0, "off"}, + {{zio_checksum_SHA256, zio_checksum_SHA256}, 1, 1, "label"}, + {{zio_checksum_SHA256, zio_checksum_SHA256}, 1, 1, "gang_header"}, + {{fletcher_2_native, fletcher_2_byteswap}, 0, 1, "zilog"}, + {{fletcher_2_native, fletcher_2_byteswap}, 0, 0, "fletcher2"}, + {{fletcher_4_native, fletcher_4_byteswap}, 1, 0, "fletcher4"}, + {{zio_checksum_SHA256, zio_checksum_SHA256}, 1, 0, "SHA256"}, }; uint8_t
--- a/usr/src/uts/common/fs/zfs/zio_compress.c Tue Oct 03 14:50:02 2006 -0700 +++ b/usr/src/uts/common/fs/zfs/zio_compress.c Tue Oct 03 15:01:10 2006 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -37,10 +36,10 @@ */ zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS] = { - NULL, NULL, "inherit", - NULL, NULL, "on", - NULL, NULL, "uncompressed", - lzjb_compress, lzjb_decompress, "lzjb", + {NULL, NULL, "inherit"}, + {NULL, NULL, "on"}, + {NULL, NULL, "uncompressed"}, + {lzjb_compress, lzjb_decompress, "lzjb"}, }; uint8_t