From 4ecf6b4e5594043f34328df08c5137f139e85931 Mon Sep 17 00:00:00 2001 From: Martin Matuska Date: Sun, 9 Sep 2012 07:48:51 +0000 Subject: [PATCH 1/4] Update vendor/illumos/dist to illumos-gate 13804:9f4f28db61d2 (dtrace changes only, illumos issue #3021) --- lib/libdtrace/common/dt_consume.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libdtrace/common/dt_consume.c b/lib/libdtrace/common/dt_consume.c index f12a39991aea..b1e8d2daa44b 100644 --- a/lib/libdtrace/common/dt_consume.c +++ b/lib/libdtrace/common/dt_consume.c @@ -2463,6 +2463,7 @@ dt_buf_oldest(void *elem, void *arg) while (offs < buf->dtbd_size) { dtrace_rechdr_t *dtrh = + /* LINTED - alignment */ (dtrace_rechdr_t *)(buf->dtbd_data + offs); if (dtrh->dtrh_epid == DTRACE_EPIDNONE) { offs += sizeof (dtrace_epid_t); From e73ba0ab20c469669b6a2204f9eb45c52d0dcf78 Mon Sep 17 00:00:00 2001 From: Martin Matuska Date: Sun, 9 Sep 2012 07:52:13 +0000 Subject: [PATCH 2/4] Update vendor/illumos/dist and vendor/illumos-sys/dist to illumos-gate 13805:e3a9ae14a119 (zfs changes, illumos issues #1884, #3006) --- cmd/zfs/zfs_main.c | 750 +++++++++++++------------- cmd/ztest/ztest.c | 24 +- common/nvpair/fnvpair.c | 116 ++-- lib/libzpool/common/sys/zfs_context.h | 56 +- man/man1m/zfs.1m | 81 +-- uts/common/fs/zfs/arc.c | 10 +- uts/common/fs/zfs/bpobj.c | 2 +- uts/common/fs/zfs/bptree.c | 14 +- uts/common/fs/zfs/dbuf.c | 6 +- uts/common/fs/zfs/dmu_send.c | 6 +- uts/common/fs/zfs/dmu_traverse.c | 2 +- uts/common/fs/zfs/dmu_tx.c | 2 +- uts/common/fs/zfs/dnode.c | 74 +-- uts/common/fs/zfs/dnode_sync.c | 8 +- uts/common/fs/zfs/dsl_dataset.c | 16 +- uts/common/fs/zfs/dsl_dir.c | 12 +- uts/common/fs/zfs/dsl_pool.c | 2 +- uts/common/fs/zfs/dsl_synctask.c | 2 +- uts/common/fs/zfs/metaslab.c | 2 +- uts/common/fs/zfs/spa.c | 6 +- uts/common/fs/zfs/space_map.c | 9 +- uts/common/fs/zfs/vdev.c | 14 +- uts/common/fs/zfs/vdev_raidz.c | 6 +- uts/common/fs/zfs/zap.c | 10 +- uts/common/fs/zfs/zap_micro.c | 2 +- uts/common/fs/zfs/zfs_debug.c | 5 +- uts/common/fs/zfs/zfs_ioctl.c | 2 +- uts/common/fs/zfs/zfs_rlock.c | 9 +- uts/common/fs/zfs/zfs_vfsops.c | 2 +- uts/common/fs/zfs/zfs_vnops.c | 11 +- uts/common/fs/zfs/zfs_znode.c | 9 +- uts/common/fs/zfs/zil.c | 2 +- uts/common/fs/zfs/zio.c | 2 +- uts/common/sys/debug.h | 8 + 34 files changed, 613 insertions(+), 669 deletions(-) diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index 1fd27c5677d8..28a808ab5345 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -289,13 +289,13 @@ get_usage(zfs_help_t idx) "\tunallow [-r] -s @setname [[,...]] " "\n")); case HELP_USERSPACE: - return (gettext("\tuserspace [-hniHp] [-o field[,...]] " - "[-sS field] ... [-t type[,...]]\n" - "\t \n")); + return (gettext("\tuserspace [-Hinp] [-o field[,...]] " + "[-s field] ...\n\t[-S field] ... " + "[-t type[,...]] \n")); case HELP_GROUPSPACE: - return (gettext("\tgroupspace [-hniHpU] [-o field[,...]] " - "[-sS field] ... [-t type[,...]]\n" - "\t \n")); + return (gettext("\tgroupspace [-Hinp] [-o field[,...]] " + "[-s field] ...\n\t[-S field] ... " + "[-t type[,...]] \n")); case HELP_HOLD: return (gettext("\thold [-r] ...\n")); case HELP_HOLDS: @@ -2046,30 +2046,52 @@ zfs_do_upgrade(int argc, char **argv) return (ret); } -#define USTYPE_USR_BIT (0) -#define USTYPE_GRP_BIT (1) -#define USTYPE_PSX_BIT (2) -#define USTYPE_SMB_BIT (3) +/* + * zfs userspace [-Hinp] [-o field[,...]] [-s field [-s field]...] + * [-S field [-S field]...] [-t type[,...]] filesystem | snapshot + * zfs groupspace [-Hinp] [-o field[,...]] [-s field [-s field]...] + * [-S field [-S field]...] [-t type[,...]] filesystem | snapshot + * + * -H Scripted mode; elide headers and separate columns by tabs. + * -i Translate SID to POSIX ID. + * -n Print numeric ID instead of user/group name. + * -o Control which fields to display. + * -p Use exact (parseable) numeric output. + * -s Specify sort columns, descending order. + * -S Specify sort columns, ascending order. + * -t Control which object types to display. + * + * Displays space consumed by, and quotas on, each user in the specified + * filesystem or snapshot. + */ -#define USTYPE_USR (1 << USTYPE_USR_BIT) -#define USTYPE_GRP (1 << USTYPE_GRP_BIT) +/* us_field_types, us_field_hdr and us_field_names should be kept in sync */ +enum us_field_types { + USFIELD_TYPE, + USFIELD_NAME, + USFIELD_USED, + USFIELD_QUOTA +}; +static char *us_field_hdr[] = { "TYPE", "NAME", "USED", "QUOTA" }; +static char *us_field_names[] = { "type", "name", "used", "quota" }; +#define USFIELD_LAST (sizeof (us_field_names) / sizeof (char *)) -#define USTYPE_PSX (1 << USTYPE_PSX_BIT) -#define USTYPE_SMB (1 << USTYPE_SMB_BIT) +#define USTYPE_PSX_GRP (1 << 0) +#define USTYPE_PSX_USR (1 << 1) +#define USTYPE_SMB_GRP (1 << 2) +#define USTYPE_SMB_USR (1 << 3) +#define USTYPE_ALL \ + (USTYPE_PSX_GRP | USTYPE_PSX_USR | USTYPE_SMB_GRP | USTYPE_SMB_USR) -#define USTYPE_PSX_USR (USTYPE_PSX | USTYPE_USR) -#define USTYPE_SMB_USR (USTYPE_SMB | USTYPE_USR) -#define USTYPE_PSX_GRP (USTYPE_PSX | USTYPE_GRP) -#define USTYPE_SMB_GRP (USTYPE_SMB | USTYPE_GRP) -#define USTYPE_ALL (USTYPE_PSX_USR | USTYPE_SMB_USR \ - | USTYPE_PSX_GRP | USTYPE_SMB_GRP) - - -#define USPROP_USED_BIT (0) -#define USPROP_QUOTA_BIT (1) - -#define USPROP_USED (1 << USPROP_USED_BIT) -#define USPROP_QUOTA (1 << USPROP_QUOTA_BIT) +static int us_type_bits[] = { + USTYPE_PSX_GRP, + USTYPE_PSX_USR, + USTYPE_SMB_GRP, + USTYPE_SMB_USR, + USTYPE_ALL +}; +static char *us_type_names[] = { "posixgroup", "posxiuser", "smbgroup", + "smbuser", "all" }; typedef struct us_node { nvlist_t *usn_nvl; @@ -2078,37 +2100,49 @@ typedef struct us_node { } us_node_t; typedef struct us_cbdata { - nvlist_t **cb_nvlp; - uu_avl_pool_t *cb_avl_pool; - uu_avl_t *cb_avl; - boolean_t cb_numname; - boolean_t cb_nicenum; - boolean_t cb_sid2posix; - zfs_userquota_prop_t cb_prop; - zfs_sort_column_t *cb_sortcol; - size_t cb_max_typelen; - size_t cb_max_namelen; - size_t cb_max_usedlen; - size_t cb_max_quotalen; + nvlist_t **cb_nvlp; + uu_avl_pool_t *cb_avl_pool; + uu_avl_t *cb_avl; + boolean_t cb_numname; + boolean_t cb_nicenum; + boolean_t cb_sid2posix; + zfs_userquota_prop_t cb_prop; + zfs_sort_column_t *cb_sortcol; + size_t cb_width[USFIELD_LAST]; } us_cbdata_t; +static boolean_t us_populated = B_FALSE; + typedef struct { zfs_sort_column_t *si_sortcol; - boolean_t si_num_name; - boolean_t si_parsable; + boolean_t si_numname; } us_sort_info_t; +static int +us_field_index(char *field) +{ + int i; + + for (i = 0; i < USFIELD_LAST; i++) { + if (strcmp(field, us_field_names[i]) == 0) + return (i); + } + + return (-1); +} + static int us_compare(const void *larg, const void *rarg, void *unused) { const us_node_t *l = larg; const us_node_t *r = rarg; - int rc = 0; us_sort_info_t *si = (us_sort_info_t *)unused; zfs_sort_column_t *sortcol = si->si_sortcol; - boolean_t num_name = si->si_num_name; + boolean_t numname = si->si_numname; nvlist_t *lnvl = l->usn_nvl; nvlist_t *rnvl = r->usn_nvl; + int rc = 0; + boolean_t lvb, rvb; for (; sortcol != NULL; sortcol = sortcol->sc_next) { char *lvstr = ""; @@ -2127,17 +2161,17 @@ us_compare(const void *larg, const void *rarg, void *unused) (void) nvlist_lookup_uint32(lnvl, propname, &lv32); (void) nvlist_lookup_uint32(rnvl, propname, &rv32); if (rv32 != lv32) - rc = (rv32 > lv32) ? 1 : -1; + rc = (rv32 < lv32) ? 1 : -1; break; case ZFS_PROP_NAME: propname = "name"; - if (num_name) { - (void) nvlist_lookup_uint32(lnvl, propname, - &lv32); - (void) nvlist_lookup_uint32(rnvl, propname, - &rv32); - if (rv32 != lv32) - rc = (rv32 > lv32) ? 1 : -1; + if (numname) { + (void) nvlist_lookup_uint64(lnvl, propname, + &lv64); + (void) nvlist_lookup_uint64(rnvl, propname, + &rv64); + if (rv64 != lv64) + rc = (rv64 < lv64) ? 1 : -1; } else { (void) nvlist_lookup_string(lnvl, propname, &lvstr); @@ -2146,27 +2180,40 @@ us_compare(const void *larg, const void *rarg, void *unused) rc = strcmp(lvstr, rvstr); } break; - case ZFS_PROP_USED: case ZFS_PROP_QUOTA: - if (ZFS_PROP_USED == prop) + if (!us_populated) + break; + if (prop == ZFS_PROP_USED) propname = "used"; else propname = "quota"; (void) nvlist_lookup_uint64(lnvl, propname, &lv64); (void) nvlist_lookup_uint64(rnvl, propname, &rv64); if (rv64 != lv64) - rc = (rv64 > lv64) ? 1 : -1; + rc = (rv64 < lv64) ? 1 : -1; + break; } - if (rc) + if (rc != 0) { if (rc < 0) return (reverse ? 1 : -1); else return (reverse ? -1 : 1); + } } - return (rc); + /* + * If entries still seem to be the same, check if they are of the same + * type (smbentity is added only if we are doing SID to POSIX ID + * translation where we can have duplicate type/name combinations). + */ + if (nvlist_lookup_boolean_value(lnvl, "smbentity", &lvb) == 0 && + nvlist_lookup_boolean_value(rnvl, "smbentity", &rvb) == 0 && + lvb != rvb) + return (lvb < rvb ? -1 : 1); + + return (0); } static inline const char * @@ -2186,9 +2233,6 @@ us_type2str(unsigned field_type) } } -/* - * zfs userspace - */ static int userspace_cb(void *arg, const char *domain, uid_t rid, uint64_t space) { @@ -2196,7 +2240,6 @@ userspace_cb(void *arg, const char *domain, uid_t rid, uint64_t space) zfs_userquota_prop_t prop = cb->cb_prop; char *name = NULL; char *propname; - char namebuf[32]; char sizebuf[32]; us_node_t *node; uu_avl_pool_t *avl_pool = cb->cb_avl_pool; @@ -2210,30 +2253,28 @@ userspace_cb(void *arg, const char *domain, uid_t rid, uint64_t space) size_t namelen; size_t typelen; size_t sizelen; + int typeidx, nameidx, sizeidx; us_sort_info_t sortinfo = { sortcol, cb->cb_numname }; + boolean_t smbentity = B_FALSE; - if (domain == NULL || domain[0] == '\0') { - /* POSIX */ - if (prop == ZFS_PROP_GROUPUSED || prop == ZFS_PROP_GROUPQUOTA) { - type = USTYPE_PSX_GRP; - struct group *g = getgrgid(rid); - if (g) - name = g->gr_name; - } else { - type = USTYPE_PSX_USR; - struct passwd *p = getpwuid(rid); - if (p) - name = p->pw_name; - } - } else { - char sid[ZFS_MAXNAMELEN+32]; + if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0) + nomem(); + node = safe_malloc(sizeof (us_node_t)); + uu_avl_node_init(node, &node->usn_avlnode, avl_pool); + node->usn_nvl = props; + + if (domain != NULL && domain[0] != '\0') { + /* SMB */ + char sid[ZFS_MAXNAMELEN + 32]; uid_t id; uint64_t classes; - int err = 0; + int err; directory_error_t e; + smbentity = B_TRUE; + (void) snprintf(sid, sizeof (sid), "%s-%u", domain, rid); - /* SMB */ + if (prop == ZFS_PROP_GROUPUSED || prop == ZFS_PROP_GROUPQUOTA) { type = USTYPE_SMB_GRP; err = sid_to_id(sid, B_FALSE, &id); @@ -2244,216 +2285,140 @@ userspace_cb(void *arg, const char *domain, uid_t rid, uint64_t space) if (err == 0) { rid = id; - - e = directory_name_from_sid(NULL, sid, &name, &classes); - if (e != NULL) { - directory_error_free(e); - return (NULL); + if (!cb->cb_sid2posix) { + e = directory_name_from_sid(NULL, sid, &name, + &classes); + if (e != NULL) { + directory_error_free(e); + return (1); + } + if (name == NULL) + name = sid; } - - if (name == NULL) - name = sid; } } -/* - * if (prop == ZFS_PROP_GROUPUSED || prop == ZFS_PROP_GROUPQUOTA) - * ug = "group"; - * else - * ug = "user"; - */ + if (cb->cb_sid2posix || domain == NULL || domain[0] == '\0') { + /* POSIX or -i */ + if (prop == ZFS_PROP_GROUPUSED || prop == ZFS_PROP_GROUPQUOTA) { + type = USTYPE_PSX_GRP; + if (!cb->cb_numname) { + struct group *g; - if (prop == ZFS_PROP_USERUSED || prop == ZFS_PROP_GROUPUSED) - propname = "used"; - else - propname = "quota"; + if ((g = getgrgid(rid)) != NULL) + name = g->gr_name; + } + } else { + type = USTYPE_PSX_USR; + if (!cb->cb_numname) { + struct passwd *p; - (void) snprintf(namebuf, sizeof (namebuf), "%u", rid); - if (name == NULL) - name = namebuf; - - if (cb->cb_nicenum) - zfs_nicenum(space, sizebuf, sizeof (sizebuf)); - else - (void) sprintf(sizebuf, "%llu", space); - - node = safe_malloc(sizeof (us_node_t)); - uu_avl_node_init(node, &node->usn_avlnode, avl_pool); - - if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0) { - free(node); - return (-1); + if ((p = getpwuid(rid)) != NULL) + name = p->pw_name; + } + } } + /* + * Make sure that the type/name combination is unique when doing + * SID to POSIX ID translation (hence changing the type from SMB to + * POSIX). + */ + if (cb->cb_sid2posix && + nvlist_add_boolean_value(props, "smbentity", smbentity) != 0) + nomem(); + + /* Calculate/update width of TYPE field */ + typestr = us_type2str(type); + typelen = strlen(gettext(typestr)); + typeidx = us_field_index("type"); + if (typelen > cb->cb_width[typeidx]) + cb->cb_width[typeidx] = typelen; if (nvlist_add_uint32(props, "type", type) != 0) nomem(); - if (cb->cb_numname) { - if (nvlist_add_uint32(props, "name", rid) != 0) + /* Calculate/update width of NAME field */ + if ((cb->cb_numname && cb->cb_sid2posix) || name == NULL) { + if (nvlist_add_uint64(props, "name", rid) != 0) nomem(); - namelen = strlen(namebuf); + namelen = snprintf(NULL, 0, "%u", rid); } else { if (nvlist_add_string(props, "name", name) != 0) nomem(); namelen = strlen(name); } + nameidx = us_field_index("name"); + if (namelen > cb->cb_width[nameidx]) + cb->cb_width[nameidx] = namelen; - typestr = us_type2str(type); - typelen = strlen(gettext(typestr)); - if (typelen > cb->cb_max_typelen) - cb->cb_max_typelen = typelen; - - if (namelen > cb->cb_max_namelen) - cb->cb_max_namelen = namelen; - - sizelen = strlen(sizebuf); - if (0 == strcmp(propname, "used")) { - if (sizelen > cb->cb_max_usedlen) - cb->cb_max_usedlen = sizelen; - } else { - if (sizelen > cb->cb_max_quotalen) - cb->cb_max_quotalen = sizelen; - } - - node->usn_nvl = props; - - n = uu_avl_find(avl, node, &sortinfo, &idx); - if (n == NULL) + /* + * Check if this type/name combination is in the list and update it; + * otherwise add new node to the list. + */ + if ((n = uu_avl_find(avl, node, &sortinfo, &idx)) == NULL) { uu_avl_insert(avl, node, idx); - else { + } else { nvlist_free(props); free(node); node = n; props = node->usn_nvl; } + /* Calculate/update width of USED/QUOTA fields */ + if (cb->cb_nicenum) + zfs_nicenum(space, sizebuf, sizeof (sizebuf)); + else + (void) snprintf(sizebuf, sizeof (sizebuf), "%llu", space); + sizelen = strlen(sizebuf); + if (prop == ZFS_PROP_USERUSED || prop == ZFS_PROP_GROUPUSED) { + propname = "used"; + if (!nvlist_exists(props, "quota")) + (void) nvlist_add_uint64(props, "quota", 0); + } else { + propname = "quota"; + if (!nvlist_exists(props, "used")) + (void) nvlist_add_uint64(props, "used", 0); + } + sizeidx = us_field_index(propname); + if (sizelen > cb->cb_width[sizeidx]) + cb->cb_width[sizeidx] = sizelen; + if (nvlist_add_uint64(props, propname, space) != 0) nomem(); return (0); } -static inline boolean_t -usprop_check(zfs_userquota_prop_t p, unsigned types, unsigned props) -{ - unsigned type; - unsigned prop; - - switch (p) { - case ZFS_PROP_USERUSED: - type = USTYPE_USR; - prop = USPROP_USED; - break; - case ZFS_PROP_USERQUOTA: - type = USTYPE_USR; - prop = USPROP_QUOTA; - break; - case ZFS_PROP_GROUPUSED: - type = USTYPE_GRP; - prop = USPROP_USED; - break; - case ZFS_PROP_GROUPQUOTA: - type = USTYPE_GRP; - prop = USPROP_QUOTA; - break; - default: /* ALL */ - return (B_TRUE); - }; - - return (type & types && prop & props); -} - -#define USFIELD_TYPE (1 << 0) -#define USFIELD_NAME (1 << 1) -#define USFIELD_USED (1 << 2) -#define USFIELD_QUOTA (1 << 3) -#define USFIELD_ALL (USFIELD_TYPE | USFIELD_NAME | USFIELD_USED | USFIELD_QUOTA) - -static int -parsefields(unsigned *fieldsp, char **names, unsigned *bits, size_t len) -{ - char *field = optarg; - char *delim; - - do { - int i; - boolean_t found = B_FALSE; - delim = strchr(field, ','); - if (delim != NULL) - *delim = '\0'; - - for (i = 0; i < len; i++) - if (0 == strcmp(field, names[i])) { - found = B_TRUE; - *fieldsp |= bits[i]; - break; - } - - if (!found) { - (void) fprintf(stderr, gettext("invalid type '%s'" - "for -t option\n"), field); - return (-1); - } - - field = delim + 1; - } while (delim); - - return (0); -} - - -static char *type_names[] = { "posixuser", "smbuser", "posixgroup", "smbgroup", - "all" }; -static unsigned type_bits[] = { - USTYPE_PSX_USR, - USTYPE_SMB_USR, - USTYPE_PSX_GRP, - USTYPE_SMB_GRP, - USTYPE_ALL -}; - -static char *us_field_names[] = { "type", "name", "used", "quota" }; -static unsigned us_field_bits[] = { - USFIELD_TYPE, - USFIELD_NAME, - USFIELD_USED, - USFIELD_QUOTA -}; - static void -print_us_node(boolean_t scripted, boolean_t parseable, unsigned fields, - size_t type_width, size_t name_width, size_t used_width, - size_t quota_width, us_node_t *node) +print_us_node(boolean_t scripted, boolean_t parsable, int *fields, int types, + size_t *width, us_node_t *node) { nvlist_t *nvl = node->usn_nvl; - nvpair_t *nvp = NULL; char valstr[ZFS_MAXNAMELEN]; boolean_t first = B_TRUE; - boolean_t quota_found = B_FALSE; + int cfield = 0; + int field; + uint32_t ustype; - if (fields & USFIELD_QUOTA && !nvlist_exists(nvl, "quota")) - if (nvlist_add_string(nvl, "quota", "none") != 0) - nomem(); + /* Check type */ + (void) nvlist_lookup_uint32(nvl, "type", &ustype); + if (!(ustype & types)) + return; - while ((nvp = nvlist_next_nvpair(nvl, nvp)) != NULL) { - char *pname = nvpair_name(nvp); - data_type_t type = nvpair_type(nvp); - uint32_t val32 = 0; - uint64_t val64 = 0; + while ((field = fields[cfield]) != USFIELD_LAST) { + nvpair_t *nvp = NULL; + data_type_t type; + uint32_t val32; + uint64_t val64; char *strval = NULL; - unsigned field = 0; - unsigned width = 0; - int i; - for (i = 0; i < 4; i++) { - if (0 == strcmp(pname, us_field_names[i])) { - field = us_field_bits[i]; + + while ((nvp = nvlist_next_nvpair(nvl, nvp)) != NULL) { + if (strcmp(nvpair_name(nvp), + us_field_names[field]) == 0) break; - } } - if (!(field & fields)) - continue; - + type = nvpair_type(nvp); switch (type) { case DATA_TYPE_UINT32: (void) nvpair_value_uint32(nvp, &val32); @@ -2465,99 +2430,86 @@ print_us_node(boolean_t scripted, boolean_t parseable, unsigned fields, (void) nvpair_value_string(nvp, &strval); break; default: - (void) fprintf(stderr, "Invalid data type\n"); + (void) fprintf(stderr, "invalid data type\n"); } - if (!first) - if (scripted) - (void) printf("\t"); - else - (void) printf(" "); - switch (field) { case USFIELD_TYPE: strval = (char *)us_type2str(val32); - width = type_width; break; case USFIELD_NAME: if (type == DATA_TYPE_UINT64) { (void) sprintf(valstr, "%llu", val64); strval = valstr; } - width = name_width; break; case USFIELD_USED: case USFIELD_QUOTA: if (type == DATA_TYPE_UINT64) { - (void) nvpair_value_uint64(nvp, &val64); - if (parseable) + if (parsable) { (void) sprintf(valstr, "%llu", val64); - else + } else { zfs_nicenum(val64, valstr, sizeof (valstr)); - strval = valstr; + } + if (field == USFIELD_QUOTA && + strcmp(valstr, "0") == 0) + strval = "none"; + else + strval = valstr; } - - if (field == USFIELD_USED) - width = used_width; - else { - quota_found = B_FALSE; - width = quota_width; - } - break; } - if (field == USFIELD_QUOTA && !quota_found) - (void) printf("%*s", width, strval); - else { - if (type == DATA_TYPE_STRING) - (void) printf("%-*s", width, strval); + if (!first) { + if (scripted) + (void) printf("\t"); else - (void) printf("%*s", width, strval); + (void) printf(" "); } + if (scripted) + (void) printf("%s", strval); + else if (field == USFIELD_TYPE || field == USFIELD_NAME) + (void) printf("%-*s", width[field], strval); + else + (void) printf("%*s", width[field], strval); first = B_FALSE; - + cfield++; } (void) printf("\n"); } static void -print_us(boolean_t scripted, boolean_t parsable, unsigned fields, - unsigned type_width, unsigned name_width, unsigned used_width, - unsigned quota_width, boolean_t rmnode, uu_avl_t *avl) +print_us(boolean_t scripted, boolean_t parsable, int *fields, int types, + size_t *width, boolean_t rmnode, uu_avl_t *avl) { - static char *us_field_hdr[] = { "TYPE", "NAME", "USED", "QUOTA" }; us_node_t *node; const char *col; - int i; - size_t width[4] = { type_width, name_width, used_width, quota_width }; + int cfield = 0; + int field; if (!scripted) { boolean_t first = B_TRUE; - for (i = 0; i < 4; i++) { - unsigned field = us_field_bits[i]; - if (!(field & fields)) - continue; - col = gettext(us_field_hdr[i]); - if (field == USFIELD_TYPE || field == USFIELD_NAME) - (void) printf(first?"%-*s":" %-*s", width[i], - col); - else - (void) printf(first?"%*s":" %*s", width[i], - col); + while ((field = fields[cfield]) != USFIELD_LAST) { + col = gettext(us_field_hdr[field]); + if (field == USFIELD_TYPE || field == USFIELD_NAME) { + (void) printf(first ? "%-*s" : " %-*s", + width[field], col); + } else { + (void) printf(first ? "%*s" : " %*s", + width[field], col); + } first = B_FALSE; + cfield++; } (void) printf("\n"); } - for (node = uu_avl_first(avl); node != NULL; - node = uu_avl_next(avl, node)) { - print_us_node(scripted, parsable, fields, type_width, - name_width, used_width, used_width, node); + for (node = uu_avl_first(avl); node; node = uu_avl_next(avl, node)) { + print_us_node(scripted, parsable, fields, types, width, node); if (rmnode) nvlist_free(node->usn_nvl); } @@ -2571,32 +2523,36 @@ zfs_do_userspace(int argc, char **argv) uu_avl_pool_t *avl_pool; uu_avl_t *avl_tree; uu_avl_walk_t *walk; - - char *cmd; + char *delim; + char deffields[] = "type,name,used,quota"; + char *ofield = NULL; + char *tfield = NULL; + int cfield = 0; + int fields[256]; + int i; boolean_t scripted = B_FALSE; boolean_t prtnum = B_FALSE; - boolean_t parseable = B_FALSE; + boolean_t parsable = B_FALSE; boolean_t sid2posix = B_FALSE; int error = 0; int c; - zfs_sort_column_t *default_sortcol = NULL; zfs_sort_column_t *sortcol = NULL; - unsigned types = USTYPE_PSX_USR | USTYPE_SMB_USR; - unsigned fields = 0; - unsigned props = USPROP_USED | USPROP_QUOTA; + int types = USTYPE_PSX_USR | USTYPE_SMB_USR; us_cbdata_t cb; us_node_t *node; - boolean_t resort_avl = B_FALSE; + us_node_t *rmnode; + uu_list_pool_t *listpool; + uu_list_t *list; + uu_avl_index_t idx = 0; + uu_list_index_t idx2 = 0; if (argc < 2) usage(B_FALSE); - cmd = argv[0]; - if (0 == strcmp(cmd, "groupspace")) - /* toggle default group types */ + if (strcmp(argv[0], "groupspace") == 0) + /* Toggle default group types */ types = USTYPE_PSX_GRP | USTYPE_SMB_GRP; - /* check options */ while ((c = getopt(argc, argv, "nHpo:s:S:t:i")) != -1) { switch (c) { case 'n': @@ -2606,32 +2562,22 @@ zfs_do_userspace(int argc, char **argv) scripted = B_TRUE; break; case 'p': - parseable = B_TRUE; + parsable = B_TRUE; break; case 'o': - if (parsefields(&fields, us_field_names, us_field_bits, - 4) != 0) - return (1); + ofield = optarg; break; case 's': - if (zfs_add_sort_column(&sortcol, optarg, - B_FALSE) != 0) { - (void) fprintf(stderr, - gettext("invalid property '%s'\n"), optarg); - usage(B_FALSE); - } - break; case 'S': if (zfs_add_sort_column(&sortcol, optarg, - B_TRUE) != 0) { + c == 's' ? B_FALSE : B_TRUE) != 0) { (void) fprintf(stderr, - gettext("invalid property '%s'\n"), optarg); + gettext("invalid field '%s'\n"), optarg); usage(B_FALSE); } break; case 't': - if (parsefields(&types, type_names, type_bits, 5)) - return (1); + tfield = optarg; break; case 'i': sid2posix = B_TRUE; @@ -2651,104 +2597,128 @@ zfs_do_userspace(int argc, char **argv) argc -= optind; argv += optind; - /* ok, now we have sorted by default colums (type,name) avl tree */ - if (sortcol) { - zfs_sort_column_t *sc; - for (sc = sortcol; sc; sc = sc->sc_next) { - if (sc->sc_prop == ZFS_PROP_QUOTA) { - resort_avl = B_TRUE; - break; - } - } + if (argc < 1) { + (void) fprintf(stderr, gettext("missing dataset name\n")); + usage(B_FALSE); + } + if (argc > 1) { + (void) fprintf(stderr, gettext("too many arguments\n")); + usage(B_FALSE); } - if (!fields) - fields = USFIELD_ALL; + /* Use default output fields if not specified using -o */ + if (ofield == NULL) + ofield = deffields; + do { + if ((delim = strchr(ofield, ',')) != NULL) + *delim = '\0'; + if ((fields[cfield++] = us_field_index(ofield)) == -1) { + (void) fprintf(stderr, gettext("invalid type '%s' " + "for -o option\n"), ofield); + return (-1); + } + if (delim != NULL) + ofield = delim + 1; + } while (delim != NULL); + fields[cfield] = USFIELD_LAST; - if ((zhp = zfs_open(g_zfs, argv[argc-1], ZFS_TYPE_DATASET)) == NULL) + /* Override output types (-t option) */ + if (tfield != NULL) { + types = 0; + + do { + boolean_t found = B_FALSE; + + if ((delim = strchr(tfield, ',')) != NULL) + *delim = '\0'; + for (i = 0; i < sizeof (us_type_bits) / sizeof (int); + i++) { + if (strcmp(tfield, us_type_names[i]) == 0) { + found = B_TRUE; + types |= us_type_bits[i]; + break; + } + } + if (!found) { + (void) fprintf(stderr, gettext("invalid type " + "'%s' for -t option\n"), tfield); + return (-1); + } + if (delim != NULL) + tfield = delim + 1; + } while (delim != NULL); + } + + if ((zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_DATASET)) == NULL) return (1); if ((avl_pool = uu_avl_pool_create("us_avl_pool", sizeof (us_node_t), - offsetof(us_node_t, usn_avlnode), - us_compare, UU_DEFAULT)) == NULL) + offsetof(us_node_t, usn_avlnode), us_compare, UU_DEFAULT)) == NULL) nomem(); if ((avl_tree = uu_avl_create(avl_pool, NULL, UU_DEFAULT)) == NULL) nomem(); - if (sortcol && !resort_avl) - cb.cb_sortcol = sortcol; - else { - (void) zfs_add_sort_column(&default_sortcol, "type", B_FALSE); - (void) zfs_add_sort_column(&default_sortcol, "name", B_FALSE); - cb.cb_sortcol = default_sortcol; - } + /* Always add default sorting columns */ + (void) zfs_add_sort_column(&sortcol, "type", B_FALSE); + (void) zfs_add_sort_column(&sortcol, "name", B_FALSE); + + cb.cb_sortcol = sortcol; cb.cb_numname = prtnum; - cb.cb_nicenum = !parseable; + cb.cb_nicenum = !parsable; cb.cb_avl_pool = avl_pool; cb.cb_avl = avl_tree; cb.cb_sid2posix = sid2posix; - cb.cb_max_typelen = strlen(gettext("TYPE")); - cb.cb_max_namelen = strlen(gettext("NAME")); - cb.cb_max_usedlen = strlen(gettext("USED")); - cb.cb_max_quotalen = strlen(gettext("QUOTA")); + + for (i = 0; i < USFIELD_LAST; i++) + cb.cb_width[i] = strlen(gettext(us_field_hdr[i])); for (p = 0; p < ZFS_NUM_USERQUOTA_PROPS; p++) { - if (!usprop_check(p, types, props)) + if (((p == ZFS_PROP_USERUSED || p == ZFS_PROP_USERQUOTA) && + !(types & (USTYPE_PSX_USR | USTYPE_SMB_USR))) || + ((p == ZFS_PROP_GROUPUSED || p == ZFS_PROP_GROUPQUOTA) && + !(types & (USTYPE_PSX_GRP | USTYPE_SMB_GRP)))) continue; - cb.cb_prop = p; error = zfs_userspace(zhp, p, userspace_cb, &cb); if (error) break; } + /* Sort the list */ + us_populated = B_TRUE; + listpool = uu_list_pool_create("tmplist", sizeof (us_node_t), + offsetof(us_node_t, usn_listnode), NULL, UU_DEFAULT); + list = uu_list_create(listpool, NULL, UU_DEFAULT); - if (resort_avl) { - us_node_t *node; - us_node_t *rmnode; - uu_list_pool_t *listpool; - uu_list_t *list; - uu_avl_index_t idx = 0; - uu_list_index_t idx2 = 0; - listpool = uu_list_pool_create("tmplist", sizeof (us_node_t), - offsetof(us_node_t, usn_listnode), NULL, - UU_DEFAULT); - list = uu_list_create(listpool, NULL, UU_DEFAULT); + node = uu_avl_first(avl_tree); + uu_list_node_init(node, &node->usn_listnode, listpool); - node = uu_avl_first(avl_tree); - uu_list_node_init(node, &node->usn_listnode, listpool); - while (node != NULL) { - rmnode = node; - node = uu_avl_next(avl_tree, node); - uu_avl_remove(avl_tree, rmnode); - if (uu_list_find(list, rmnode, NULL, &idx2) == NULL) { - uu_list_insert(list, rmnode, idx2); - } - } - - for (node = uu_list_first(list); node != NULL; - node = uu_list_next(list, node)) { - us_sort_info_t sortinfo = { sortcol, cb.cb_numname }; - if (uu_avl_find(avl_tree, node, &sortinfo, &idx) == - NULL) - uu_avl_insert(avl_tree, node, idx); - } - - uu_list_destroy(list); + while (node != NULL) { + rmnode = node; + node = uu_avl_next(avl_tree, node); + uu_avl_remove(avl_tree, rmnode); + if (uu_list_find(list, rmnode, NULL, &idx2) == NULL) + uu_list_insert(list, rmnode, idx2); } - /* print & free node`s nvlist memory */ - print_us(scripted, parseable, fields, cb.cb_max_typelen, - cb.cb_max_namelen, cb.cb_max_usedlen, - cb.cb_max_quotalen, B_TRUE, cb.cb_avl); + for (node = uu_list_first(list); node != NULL; + node = uu_list_next(list, node)) { + us_sort_info_t sortinfo = { sortcol, cb.cb_numname }; - if (sortcol) - zfs_free_sort_columns(sortcol); - zfs_free_sort_columns(default_sortcol); + if (uu_avl_find(avl_tree, node, &sortinfo, &idx) == NULL) + uu_avl_insert(avl_tree, node, idx); + } - /* - * Finally, clean up the AVL tree. - */ + uu_list_destroy(list); + uu_list_pool_destroy(listpool); + + /* Print and free node nvlist memory */ + print_us(scripted, parsable, fields, types, cb.cb_width, B_TRUE, + cb.cb_avl); + + zfs_free_sort_columns(sortcol); + + /* Clean up the AVL tree */ if ((walk = uu_avl_walk_start(cb.cb_avl, UU_WALK_ROBUST)) == NULL) nomem(); diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c index caa783458400..95b8e2ed790a 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest/ztest.c @@ -979,7 +979,7 @@ ztest_dsl_prop_set_uint64(char *osname, zfs_prop_t prop, uint64_t value, ztest_record_enospc(FTAG); return (error); } - ASSERT3U(error, ==, 0); + ASSERT0(error); VERIFY3U(dsl_prop_get(osname, propname, sizeof (curval), 1, &curval, setpoint), ==, 0); @@ -1011,7 +1011,7 @@ ztest_spa_prop_set_uint64(zpool_prop_t prop, uint64_t value) ztest_record_enospc(FTAG); return (error); } - ASSERT3U(error, ==, 0); + ASSERT0(error); return (error); } @@ -1708,7 +1708,7 @@ ztest_replay_setattr(ztest_ds_t *zd, lr_setattr_t *lr, boolean_t byteswap) ASSERT3U(lr->lr_size, >=, sizeof (*bbt)); ASSERT3U(lr->lr_size, <=, db->db_size); - VERIFY3U(dmu_set_bonus(db, lr->lr_size, tx), ==, 0); + VERIFY0(dmu_set_bonus(db, lr->lr_size, tx)); bbt = ztest_bt_bonus(db); ztest_bt_generate(bbt, os, lr->lr_foid, -1ULL, lr->lr_mode, txg, crtxg); @@ -3043,7 +3043,7 @@ ztest_objset_destroy_cb(const char *name, void *arg) error = dmu_object_info(os, ZTEST_DIROBJ, &doi); if (error != ENOENT) { /* We could have crashed in the middle of destroying it */ - ASSERT3U(error, ==, 0); + ASSERT0(error); ASSERT3U(doi.doi_type, ==, DMU_OT_ZAP_OTHER); ASSERT3S(doi.doi_physical_blocks_512, >=, 0); } @@ -3452,10 +3452,10 @@ ztest_dmu_read_write(ztest_ds_t *zd, uint64_t id) */ error = dmu_read(os, packobj, packoff, packsize, packbuf, DMU_READ_PREFETCH); - ASSERT3U(error, ==, 0); + ASSERT0(error); error = dmu_read(os, bigobj, bigoff, bigsize, bigbuf, DMU_READ_PREFETCH); - ASSERT3U(error, ==, 0); + ASSERT0(error); /* * Get a tx for the mods to both packobj and bigobj. @@ -3765,10 +3765,10 @@ ztest_dmu_read_write_zcopy(ztest_ds_t *zd, uint64_t id) if (i != 0 || ztest_random(2) != 0) { error = dmu_read(os, packobj, packoff, packsize, packbuf, DMU_READ_PREFETCH); - ASSERT3U(error, ==, 0); + ASSERT0(error); error = dmu_read(os, bigobj, bigoff, bigsize, bigbuf, DMU_READ_PREFETCH); - ASSERT3U(error, ==, 0); + ASSERT0(error); } compare_and_update_pbbufs(s, packbuf, bigbuf, bigsize, n, chunksize, txg); @@ -4039,7 +4039,7 @@ ztest_zap(ztest_ds_t *zd, uint64_t id) if (error == ENOENT) return; - ASSERT3U(error, ==, 0); + ASSERT0(error); tx = dmu_tx_create(os); dmu_tx_hold_zap(tx, object, B_TRUE, NULL); @@ -4235,7 +4235,7 @@ ztest_commit_callback(void *arg, int error) data->zcd_called = B_TRUE; if (error == ECANCELED) { - ASSERT3U(data->zcd_txg, ==, 0); + ASSERT0(data->zcd_txg); ASSERT(!data->zcd_added); /* @@ -4440,7 +4440,7 @@ ztest_spa_prop_get_set(ztest_ds_t *zd, uint64_t id) (void) ztest_spa_prop_set_uint64(ZPOOL_PROP_DEDUPDITTO, ZIO_DEDUPDITTO_MIN + ztest_random(ZIO_DEDUPDITTO_MIN)); - VERIFY3U(spa_prop_get(ztest_spa, &props), ==, 0); + VERIFY0(spa_prop_get(ztest_spa, &props)); if (ztest_opts.zo_verbose >= 6) dump_nvlist(props, 4); @@ -5262,7 +5262,7 @@ ztest_dataset_open(int d) } ASSERT(error == 0 || error == EEXIST); - VERIFY3U(dmu_objset_hold(name, zd, &os), ==, 0); + VERIFY0(dmu_objset_hold(name, zd, &os)); (void) rw_unlock(&ztest_name_lock); ztest_zd_init(zd, ZTEST_GET_SHARED_DS(d), os); diff --git a/common/nvpair/fnvpair.c b/common/nvpair/fnvpair.c index 8d1bb98be32c..8c5591c0b2f7 100644 --- a/common/nvpair/fnvpair.c +++ b/common/nvpair/fnvpair.c @@ -50,7 +50,7 @@ nvlist_t * fnvlist_alloc(void) { nvlist_t *nvl; - VERIFY3U(nvlist_alloc(&nvl, NV_UNIQUE_NAME, KM_SLEEP), ==, 0); + VERIFY0(nvlist_alloc(&nvl, NV_UNIQUE_NAME, KM_SLEEP)); return (nvl); } @@ -64,7 +64,7 @@ size_t fnvlist_size(nvlist_t *nvl) { size_t size; - VERIFY3U(nvlist_size(nvl, &size, NV_ENCODE_NATIVE), ==, 0); + VERIFY0(nvlist_size(nvl, &size, NV_ENCODE_NATIVE)); return (size); } @@ -96,7 +96,7 @@ nvlist_t * fnvlist_unpack(char *buf, size_t buflen) { nvlist_t *rv; - VERIFY3U(nvlist_unpack(buf, buflen, &rv, KM_SLEEP), ==, 0); + VERIFY0(nvlist_unpack(buf, buflen, &rv, KM_SLEEP)); return (rv); } @@ -104,195 +104,195 @@ nvlist_t * fnvlist_dup(nvlist_t *nvl) { nvlist_t *rv; - VERIFY3U(nvlist_dup(nvl, &rv, KM_SLEEP), ==, 0); + VERIFY0(nvlist_dup(nvl, &rv, KM_SLEEP)); return (rv); } void fnvlist_merge(nvlist_t *dst, nvlist_t *src) { - VERIFY3U(nvlist_merge(dst, src, KM_SLEEP), ==, 0); + VERIFY0(nvlist_merge(dst, src, KM_SLEEP)); } void fnvlist_add_boolean(nvlist_t *nvl, const char *name) { - VERIFY3U(nvlist_add_boolean(nvl, name), ==, 0); + VERIFY0(nvlist_add_boolean(nvl, name)); } void fnvlist_add_boolean_value(nvlist_t *nvl, const char *name, boolean_t val) { - VERIFY3U(nvlist_add_boolean_value(nvl, name, val), ==, 0); + VERIFY0(nvlist_add_boolean_value(nvl, name, val)); } void fnvlist_add_byte(nvlist_t *nvl, const char *name, uchar_t val) { - VERIFY3U(nvlist_add_byte(nvl, name, val), ==, 0); + VERIFY0(nvlist_add_byte(nvl, name, val)); } void fnvlist_add_int8(nvlist_t *nvl, const char *name, int8_t val) { - VERIFY3U(nvlist_add_int8(nvl, name, val), ==, 0); + VERIFY0(nvlist_add_int8(nvl, name, val)); } void fnvlist_add_uint8(nvlist_t *nvl, const char *name, uint8_t val) { - VERIFY3U(nvlist_add_uint8(nvl, name, val), ==, 0); + VERIFY0(nvlist_add_uint8(nvl, name, val)); } void fnvlist_add_int16(nvlist_t *nvl, const char *name, int16_t val) { - VERIFY3U(nvlist_add_int16(nvl, name, val), ==, 0); + VERIFY0(nvlist_add_int16(nvl, name, val)); } void fnvlist_add_uint16(nvlist_t *nvl, const char *name, uint16_t val) { - VERIFY3U(nvlist_add_uint16(nvl, name, val), ==, 0); + VERIFY0(nvlist_add_uint16(nvl, name, val)); } void fnvlist_add_int32(nvlist_t *nvl, const char *name, int32_t val) { - VERIFY3U(nvlist_add_int32(nvl, name, val), ==, 0); + VERIFY0(nvlist_add_int32(nvl, name, val)); } void fnvlist_add_uint32(nvlist_t *nvl, const char *name, uint32_t val) { - VERIFY3U(nvlist_add_uint32(nvl, name, val), ==, 0); + VERIFY0(nvlist_add_uint32(nvl, name, val)); } void fnvlist_add_int64(nvlist_t *nvl, const char *name, int64_t val) { - VERIFY3U(nvlist_add_int64(nvl, name, val), ==, 0); + VERIFY0(nvlist_add_int64(nvl, name, val)); } void fnvlist_add_uint64(nvlist_t *nvl, const char *name, uint64_t val) { - VERIFY3U(nvlist_add_uint64(nvl, name, val), ==, 0); + VERIFY0(nvlist_add_uint64(nvl, name, val)); } void fnvlist_add_string(nvlist_t *nvl, const char *name, const char *val) { - VERIFY3U(nvlist_add_string(nvl, name, val), ==, 0); + VERIFY0(nvlist_add_string(nvl, name, val)); } void fnvlist_add_nvlist(nvlist_t *nvl, const char *name, nvlist_t *val) { - VERIFY3U(nvlist_add_nvlist(nvl, name, val), ==, 0); + VERIFY0(nvlist_add_nvlist(nvl, name, val)); } void fnvlist_add_nvpair(nvlist_t *nvl, nvpair_t *pair) { - VERIFY3U(nvlist_add_nvpair(nvl, pair), ==, 0); + VERIFY0(nvlist_add_nvpair(nvl, pair)); } void fnvlist_add_boolean_array(nvlist_t *nvl, const char *name, boolean_t *val, uint_t n) { - VERIFY3U(nvlist_add_boolean_array(nvl, name, val, n), ==, 0); + VERIFY0(nvlist_add_boolean_array(nvl, name, val, n)); } void fnvlist_add_byte_array(nvlist_t *nvl, const char *name, uchar_t *val, uint_t n) { - VERIFY3U(nvlist_add_byte_array(nvl, name, val, n), ==, 0); + VERIFY0(nvlist_add_byte_array(nvl, name, val, n)); } void fnvlist_add_int8_array(nvlist_t *nvl, const char *name, int8_t *val, uint_t n) { - VERIFY3U(nvlist_add_int8_array(nvl, name, val, n), ==, 0); + VERIFY0(nvlist_add_int8_array(nvl, name, val, n)); } void fnvlist_add_uint8_array(nvlist_t *nvl, const char *name, uint8_t *val, uint_t n) { - VERIFY3U(nvlist_add_uint8_array(nvl, name, val, n), ==, 0); + VERIFY0(nvlist_add_uint8_array(nvl, name, val, n)); } void fnvlist_add_int16_array(nvlist_t *nvl, const char *name, int16_t *val, uint_t n) { - VERIFY3U(nvlist_add_int16_array(nvl, name, val, n), ==, 0); + VERIFY0(nvlist_add_int16_array(nvl, name, val, n)); } void fnvlist_add_uint16_array(nvlist_t *nvl, const char *name, uint16_t *val, uint_t n) { - VERIFY3U(nvlist_add_uint16_array(nvl, name, val, n), ==, 0); + VERIFY0(nvlist_add_uint16_array(nvl, name, val, n)); } void fnvlist_add_int32_array(nvlist_t *nvl, const char *name, int32_t *val, uint_t n) { - VERIFY3U(nvlist_add_int32_array(nvl, name, val, n), ==, 0); + VERIFY0(nvlist_add_int32_array(nvl, name, val, n)); } void fnvlist_add_uint32_array(nvlist_t *nvl, const char *name, uint32_t *val, uint_t n) { - VERIFY3U(nvlist_add_uint32_array(nvl, name, val, n), ==, 0); + VERIFY0(nvlist_add_uint32_array(nvl, name, val, n)); } void fnvlist_add_int64_array(nvlist_t *nvl, const char *name, int64_t *val, uint_t n) { - VERIFY3U(nvlist_add_int64_array(nvl, name, val, n), ==, 0); + VERIFY0(nvlist_add_int64_array(nvl, name, val, n)); } void fnvlist_add_uint64_array(nvlist_t *nvl, const char *name, uint64_t *val, uint_t n) { - VERIFY3U(nvlist_add_uint64_array(nvl, name, val, n), ==, 0); + VERIFY0(nvlist_add_uint64_array(nvl, name, val, n)); } void fnvlist_add_string_array(nvlist_t *nvl, const char *name, char * const *val, uint_t n) { - VERIFY3U(nvlist_add_string_array(nvl, name, val, n), ==, 0); + VERIFY0(nvlist_add_string_array(nvl, name, val, n)); } void fnvlist_add_nvlist_array(nvlist_t *nvl, const char *name, nvlist_t **val, uint_t n) { - VERIFY3U(nvlist_add_nvlist_array(nvl, name, val, n), ==, 0); + VERIFY0(nvlist_add_nvlist_array(nvl, name, val, n)); } void fnvlist_remove(nvlist_t *nvl, const char *name) { - VERIFY3U(nvlist_remove_all(nvl, name), ==, 0); + VERIFY0(nvlist_remove_all(nvl, name)); } void fnvlist_remove_nvpair(nvlist_t *nvl, nvpair_t *pair) { - VERIFY3U(nvlist_remove_nvpair(nvl, pair), ==, 0); + VERIFY0(nvlist_remove_nvpair(nvl, pair)); } nvpair_t * fnvlist_lookup_nvpair(nvlist_t *nvl, const char *name) { nvpair_t *rv; - VERIFY3U(nvlist_lookup_nvpair(nvl, name, &rv), ==, 0); + VERIFY0(nvlist_lookup_nvpair(nvl, name, &rv)); return (rv); } @@ -307,7 +307,7 @@ boolean_t fnvlist_lookup_boolean_value(nvlist_t *nvl, const char *name) { boolean_t rv; - VERIFY3U(nvlist_lookup_boolean_value(nvl, name, &rv), ==, 0); + VERIFY0(nvlist_lookup_boolean_value(nvl, name, &rv)); return (rv); } @@ -315,7 +315,7 @@ uchar_t fnvlist_lookup_byte(nvlist_t *nvl, const char *name) { uchar_t rv; - VERIFY3U(nvlist_lookup_byte(nvl, name, &rv), ==, 0); + VERIFY0(nvlist_lookup_byte(nvl, name, &rv)); return (rv); } @@ -323,7 +323,7 @@ int8_t fnvlist_lookup_int8(nvlist_t *nvl, const char *name) { int8_t rv; - VERIFY3U(nvlist_lookup_int8(nvl, name, &rv), ==, 0); + VERIFY0(nvlist_lookup_int8(nvl, name, &rv)); return (rv); } @@ -331,7 +331,7 @@ int16_t fnvlist_lookup_int16(nvlist_t *nvl, const char *name) { int16_t rv; - VERIFY3U(nvlist_lookup_int16(nvl, name, &rv), ==, 0); + VERIFY0(nvlist_lookup_int16(nvl, name, &rv)); return (rv); } @@ -339,7 +339,7 @@ int32_t fnvlist_lookup_int32(nvlist_t *nvl, const char *name) { int32_t rv; - VERIFY3U(nvlist_lookup_int32(nvl, name, &rv), ==, 0); + VERIFY0(nvlist_lookup_int32(nvl, name, &rv)); return (rv); } @@ -347,7 +347,7 @@ int64_t fnvlist_lookup_int64(nvlist_t *nvl, const char *name) { int64_t rv; - VERIFY3U(nvlist_lookup_int64(nvl, name, &rv), ==, 0); + VERIFY0(nvlist_lookup_int64(nvl, name, &rv)); return (rv); } @@ -355,7 +355,7 @@ uint8_t fnvlist_lookup_uint8_t(nvlist_t *nvl, const char *name) { uint8_t rv; - VERIFY3U(nvlist_lookup_uint8(nvl, name, &rv), ==, 0); + VERIFY0(nvlist_lookup_uint8(nvl, name, &rv)); return (rv); } @@ -363,7 +363,7 @@ uint16_t fnvlist_lookup_uint16(nvlist_t *nvl, const char *name) { uint16_t rv; - VERIFY3U(nvlist_lookup_uint16(nvl, name, &rv), ==, 0); + VERIFY0(nvlist_lookup_uint16(nvl, name, &rv)); return (rv); } @@ -371,7 +371,7 @@ uint32_t fnvlist_lookup_uint32(nvlist_t *nvl, const char *name) { uint32_t rv; - VERIFY3U(nvlist_lookup_uint32(nvl, name, &rv), ==, 0); + VERIFY0(nvlist_lookup_uint32(nvl, name, &rv)); return (rv); } @@ -379,7 +379,7 @@ uint64_t fnvlist_lookup_uint64(nvlist_t *nvl, const char *name) { uint64_t rv; - VERIFY3U(nvlist_lookup_uint64(nvl, name, &rv), ==, 0); + VERIFY0(nvlist_lookup_uint64(nvl, name, &rv)); return (rv); } @@ -387,7 +387,7 @@ char * fnvlist_lookup_string(nvlist_t *nvl, const char *name) { char *rv; - VERIFY3U(nvlist_lookup_string(nvl, name, &rv), ==, 0); + VERIFY0(nvlist_lookup_string(nvl, name, &rv)); return (rv); } @@ -395,7 +395,7 @@ nvlist_t * fnvlist_lookup_nvlist(nvlist_t *nvl, const char *name) { nvlist_t *rv; - VERIFY3U(nvlist_lookup_nvlist(nvl, name, &rv), ==, 0); + VERIFY0(nvlist_lookup_nvlist(nvl, name, &rv)); return (rv); } @@ -403,7 +403,7 @@ boolean_t fnvpair_value_boolean_value(nvpair_t *nvp) { boolean_t rv; - VERIFY3U(nvpair_value_boolean_value(nvp, &rv), ==, 0); + VERIFY0(nvpair_value_boolean_value(nvp, &rv)); return (rv); } @@ -411,7 +411,7 @@ uchar_t fnvpair_value_byte(nvpair_t *nvp) { uchar_t rv; - VERIFY3U(nvpair_value_byte(nvp, &rv), ==, 0); + VERIFY0(nvpair_value_byte(nvp, &rv)); return (rv); } @@ -419,7 +419,7 @@ int8_t fnvpair_value_int8(nvpair_t *nvp) { int8_t rv; - VERIFY3U(nvpair_value_int8(nvp, &rv), ==, 0); + VERIFY0(nvpair_value_int8(nvp, &rv)); return (rv); } @@ -427,7 +427,7 @@ int16_t fnvpair_value_int16(nvpair_t *nvp) { int16_t rv; - VERIFY3U(nvpair_value_int16(nvp, &rv), ==, 0); + VERIFY0(nvpair_value_int16(nvp, &rv)); return (rv); } @@ -435,7 +435,7 @@ int32_t fnvpair_value_int32(nvpair_t *nvp) { int32_t rv; - VERIFY3U(nvpair_value_int32(nvp, &rv), ==, 0); + VERIFY0(nvpair_value_int32(nvp, &rv)); return (rv); } @@ -443,7 +443,7 @@ int64_t fnvpair_value_int64(nvpair_t *nvp) { int64_t rv; - VERIFY3U(nvpair_value_int64(nvp, &rv), ==, 0); + VERIFY0(nvpair_value_int64(nvp, &rv)); return (rv); } @@ -451,7 +451,7 @@ uint8_t fnvpair_value_uint8_t(nvpair_t *nvp) { uint8_t rv; - VERIFY3U(nvpair_value_uint8(nvp, &rv), ==, 0); + VERIFY0(nvpair_value_uint8(nvp, &rv)); return (rv); } @@ -459,7 +459,7 @@ uint16_t fnvpair_value_uint16(nvpair_t *nvp) { uint16_t rv; - VERIFY3U(nvpair_value_uint16(nvp, &rv), ==, 0); + VERIFY0(nvpair_value_uint16(nvp, &rv)); return (rv); } @@ -467,7 +467,7 @@ uint32_t fnvpair_value_uint32(nvpair_t *nvp) { uint32_t rv; - VERIFY3U(nvpair_value_uint32(nvp, &rv), ==, 0); + VERIFY0(nvpair_value_uint32(nvp, &rv)); return (rv); } @@ -475,7 +475,7 @@ uint64_t fnvpair_value_uint64(nvpair_t *nvp) { uint64_t rv; - VERIFY3U(nvpair_value_uint64(nvp, &rv), ==, 0); + VERIFY0(nvpair_value_uint64(nvp, &rv)); return (rv); } @@ -483,7 +483,7 @@ char * fnvpair_value_string(nvpair_t *nvp) { char *rv; - VERIFY3U(nvpair_value_string(nvp, &rv), ==, 0); + VERIFY0(nvpair_value_string(nvp, &rv)); return (rv); } @@ -491,6 +491,6 @@ nvlist_t * fnvpair_value_nvlist(nvpair_t *nvp) { nvlist_t *rv; - VERIFY3U(nvpair_value_nvlist(nvp, &rv), ==, 0); + VERIFY0(nvpair_value_nvlist(nvp, &rv)); return (rv); } diff --git a/lib/libzpool/common/sys/zfs_context.h b/lib/libzpool/common/sys/zfs_context.h index 8ca60b762552..9e6fd4455c1f 100644 --- a/lib/libzpool/common/sys/zfs_context.h +++ b/lib/libzpool/common/sys/zfs_context.h @@ -36,7 +36,6 @@ extern "C" { #define _SYS_RWLOCK_H #define _SYS_CONDVAR_H #define _SYS_SYSTM_H -#define _SYS_DEBUG_H #define _SYS_T_LOCK_H #define _SYS_VNODE_H #define _SYS_VFS_H @@ -79,6 +78,7 @@ extern "C" { #include #include #include +#include /* * Debugging @@ -111,60 +111,6 @@ extern void vpanic(const char *, __va_list); extern int aok; -/* This definition is copied from assert.h. */ -#if defined(__STDC__) -#if __STDC_VERSION__ - 0 >= 199901L -#define zverify(EX) (void)((EX) || (aok) || \ - (__assert_c99(#EX, __FILE__, __LINE__, __func__), 0)) -#else -#define zverify(EX) (void)((EX) || (aok) || \ - (__assert(#EX, __FILE__, __LINE__), 0)) -#endif /* __STDC_VERSION__ - 0 >= 199901L */ -#else -#define zverify(EX) (void)((EX) || (aok) || \ - (_assert("EX", __FILE__, __LINE__), 0)) -#endif /* __STDC__ */ - - -#define VERIFY zverify -#define ASSERT zverify -#undef assert -#define assert zverify - -extern void __assert(const char *, const char *, int); - -#ifdef lint -#define VERIFY3_IMPL(x, y, z, t) if (x == z) ((void)0) -#else -/* BEGIN CSTYLED */ -#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) do { \ - const TYPE __left = (TYPE)(LEFT); \ - const TYPE __right = (TYPE)(RIGHT); \ - if (!(__left OP __right) && (!aok)) { \ - char *__buf = alloca(256); \ - (void) snprintf(__buf, 256, "%s %s %s (0x%llx %s 0x%llx)", \ - #LEFT, #OP, #RIGHT, \ - (u_longlong_t)__left, #OP, (u_longlong_t)__right); \ - __assert(__buf, __FILE__, __LINE__); \ - } \ -_NOTE(CONSTCOND) } while (0) -/* END CSTYLED */ -#endif /* lint */ - -#define VERIFY3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t) -#define VERIFY3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t) -#define VERIFY3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t) - -#ifdef NDEBUG -#define ASSERT3S(x, y, z) ((void)0) -#define ASSERT3U(x, y, z) ((void)0) -#define ASSERT3P(x, y, z) ((void)0) -#else -#define ASSERT3S(x, y, z) VERIFY3S(x, y, z) -#define ASSERT3U(x, y, z) VERIFY3U(x, y, z) -#define ASSERT3P(x, y, z) VERIFY3P(x, y, z) -#endif - /* * DTrace SDT probes have different signatures in userland than they do in * kernel. If they're being used in kernel code, re-define them out of diff --git a/man/man1m/zfs.1m b/man/man1m/zfs.1m index 19d44973b737..0fcb40bb8186 100644 --- a/man/man1m/zfs.1m +++ b/man/man1m/zfs.1m @@ -1,12 +1,31 @@ -'\" te +'\" t +.\" +.\" CDDL HEADER START +.\" +.\" The contents of this file are subject to the terms of the +.\" 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. +.\" See the License for the specific language governing permissions +.\" and limitations under the License. +.\" +.\" When distributing Covered Code, include this CDDL HEADER in each +.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. +.\" If applicable, add the following below this CDDL HEADER, with the +.\" fields enclosed by brackets "[]" replaced with your own identifying +.\" information: Portions Copyright [yyyy] [name of copyright owner] +.\" +.\" CDDL HEADER END +.\" +.\" .\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved. -.\" Copyright (c) 2012 by Delphix. All rights reserved. -.\" Copyright (c) 2012 Nexenta Systems, Inc. All Rights Reserved. -.\" Copyright (c) 2012, Joyent, Inc. All rights reserved. -.\" The contents of this file are subject to the terms of the 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. -.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with -.\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .\" Copyright 2011 Joshua M. Clulow +.\" Copyright (c) 2012 by Delphix. All rights reserved. +.\" Copyright (c) 2012, Joyent, Inc. All rights reserved. +.\" Copyright 2012 Nexenta Systems, Inc. All Rights Reserved. +.\" .TH ZFS 1M "Aug 16, 2012" .SH NAME zfs \- configures ZFS file systems @@ -107,14 +126,14 @@ zfs \- configures ZFS file systems .LP .nf -\fBzfs\fR \fBuserspace\fR [\fB-niHp\fR] [\fB-o\fR \fIfield\fR[,...]] [\fB-sS\fR \fIfield\fR] ... - [\fB-t\fR \fItype\fR[,...]] \fIfilesystem\fR|\fIsnapshot\fR +\fBzfs\fR \fBuserspace\fR [\fB-Hinp\fR] [\fB-o\fR \fIfield\fR[,...]] [\fB-s\fR \fIfield\fR] ... + [\fB-S\fR \fIfield\fR] ... [\fB-t\fR \fItype\fR[,...]] \fIfilesystem\fR|\fIsnapshot\fR .fi .LP .nf -\fBzfs\fR \fBgroupspace\fR [\fB-niHp\fR] [\fB-o\fR \fIfield\fR[,...]] [\fB-sS\fR \fIfield\fR] ... - [\fB-t\fR \fItype\fR[,...]] \fIfilesystem\fR|\fIsnapshot\fR +\fBzfs\fR \fBgroupspace\fR [\fB-Hinp\fR] [\fB-o\fR \fIfield\fR[,...]] [\fB-s\fR \fIfield\fR] ... + [\fB-S\fR \fIfield\fR] ... [\fB-t\fR \fItype\fR[,...]] \fIfilesystem\fR|\fIsnapshot\fR .fi .LP @@ -2407,9 +2426,10 @@ supported by this software. .sp .ne 2 .na -\fB\fBzfs userspace\fR [\fB-niHp\fR] [\fB-o\fR \fIfield\fR[,...]] [\fB-sS\fR -\fIfield\fR]... [\fB-t\fR \fItype\fR [,...]] \fIfilesystem\fR | -\fIsnapshot\fR\fR +\fBzfs\fR \fBuserspace\fR [\fB-Hinp\fR] [\fB-o\fR \fIfield\fR[,...]] +[\fB-s\fR \fIfield\fR] ... +[\fB-S\fR \fIfield\fR] ... +[\fB-t\fR \fItype\fR[,...]] \fIfilesystem\fR|\fIsnapshot\fR .ad .sp .6 .RS 4n @@ -2443,7 +2463,7 @@ Do not print headers, use tab-delimited output. .ad .sp .6 .RS 4n -Use exact (parseable) numeric output. +Use exact (parsable) numeric output. .RE .sp @@ -2453,8 +2473,8 @@ Use exact (parseable) numeric output. .ad .sp .6 .RS 4n -Display only the specified fields from the following set, -\fBtype,name,used,quota\fR.The default is to display all fields. +Display only the specified fields from the following +set: \fBtype, name, used, quota\fR. The default is to display all fields. .RE .sp @@ -2486,12 +2506,10 @@ Sort by this field in reverse order. See \fB-s\fR. .ad .sp .6 .RS 4n -Print only the specified types from the following set, -\fBall,posixuser,smbuser,posixgroup,smbgroup\fR. -.sp -The default is \fB-t posixuser,smbuser\fR -.sp -The default can be changed to include group types. +Print only the specified types from the following +set: \fBall, posixuser, smbuser, posixgroup, smbgroup\fR. The default +is \fB-t posixuser,smbuser\fR. The default can be changed to include group +types. .RE .sp @@ -2506,7 +2524,7 @@ Normal POSIX interfaces (for example, \fBstat\fR(2), \fBls\fR \fB-l\fR) perform this translation, so the \fB-i\fR option allows the output from \fBzfs userspace\fR to be compared directly with those utilities. However, \fB-i\fR may lead to confusion if some files were created by an SMB user before a -SMB-to-POSIX name mapping was established. In such a case, some files are owned +SMB-to-POSIX name mapping was established. In such a case, some files will be owned by the SMB entity and some by the POSIX entity. However, the \fB-i\fR option will report that the POSIX entity has the total usage and quota for both. .RE @@ -2516,23 +2534,16 @@ will report that the POSIX entity has the total usage and quota for both. .sp .ne 2 .na -\fB\fBzfs groupspace\fR [\fB-niHp\fR] [\fB-o\fR \fIfield\fR[,...]] [\fB-sS\fR -\fIfield\fR]... [\fB-t\fR \fItype\fR [,...]] \fIfilesystem\fR | -\fIsnapshot\fR\fR +\fBzfs\fR \fBgroupspace\fR [\fB-Hinp\fR] [\fB-o\fR \fIfield\fR[,...]] +[\fB-s\fR \fIfield\fR] ... +[\fB-S\fR \fIfield\fR] ... +[\fB-t\fR \fItype\fR[,...]] \fIfilesystem\fR|\fIsnapshot\fR .ad .sp .6 .RS 4n Displays space consumed by, and quotas on, each group in the specified filesystem or snapshot. This subcommand is identical to \fBzfs userspace\fR, except that the default types to display are \fB-t posixgroup,smbgroup\fR. -.sp -.in +2 -.nf -- -.fi -.in -2 -.sp - .RE .sp diff --git a/uts/common/fs/zfs/arc.c b/uts/common/fs/zfs/arc.c index 630a4477ad99..e6a2df18e98d 100644 --- a/uts/common/fs/zfs/arc.c +++ b/uts/common/fs/zfs/arc.c @@ -1064,7 +1064,7 @@ add_reference(arc_buf_hdr_t *ab, kmutex_t *hash_lock, void *tag) ASSERT(list_link_active(&ab->b_arc_node)); list_remove(list, ab); if (GHOST_STATE(ab->b_state)) { - ASSERT3U(ab->b_datacnt, ==, 0); + ASSERT0(ab->b_datacnt); ASSERT3P(ab->b_buf, ==, NULL); delta = ab->b_size; } @@ -1691,7 +1691,7 @@ arc_evict(arc_state_t *state, uint64_t spa, int64_t bytes, boolean_t recycle, hash_lock = HDR_LOCK(ab); have_lock = MUTEX_HELD(hash_lock); if (have_lock || mutex_tryenter(hash_lock)) { - ASSERT3U(refcount_count(&ab->b_refcnt), ==, 0); + ASSERT0(refcount_count(&ab->b_refcnt)); ASSERT(ab->b_datacnt > 0); while (ab->b_buf) { arc_buf_t *buf = ab->b_buf; @@ -2519,7 +2519,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock) * This is a prefetch access... * move this block back to the MRU state. */ - ASSERT3U(refcount_count(&buf->b_refcnt), ==, 0); + ASSERT0(refcount_count(&buf->b_refcnt)); new_state = arc_mru; } @@ -2861,7 +2861,7 @@ arc_read_nolock(zio_t *pio, spa_t *spa, const blkptr_t *bp, /* this block is in the ghost cache */ ASSERT(GHOST_STATE(hdr->b_state)); ASSERT(!HDR_IO_IN_PROGRESS(hdr)); - ASSERT3U(refcount_count(&hdr->b_refcnt), ==, 0); + ASSERT0(refcount_count(&hdr->b_refcnt)); ASSERT(hdr->b_buf == NULL); /* if this is a prefetch, we don't have a reference */ @@ -4436,7 +4436,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz) mutex_exit(&l2arc_buflist_mtx); if (pio == NULL) { - ASSERT3U(write_sz, ==, 0); + ASSERT0(write_sz); kmem_cache_free(hdr_cache, head); return (0); } diff --git a/uts/common/fs/zfs/bpobj.c b/uts/common/fs/zfs/bpobj.c index d5f8d4072d11..1920da4408c8 100644 --- a/uts/common/fs/zfs/bpobj.c +++ b/uts/common/fs/zfs/bpobj.c @@ -43,7 +43,7 @@ bpobj_alloc_empty(objset_t *os, int blocksize, dmu_tx_t *tx) if (spa_feature_is_enabled(spa, empty_bpobj_feat)) { if (!spa_feature_is_active(spa, empty_bpobj_feat)) { - ASSERT3U(dp->dp_empty_bpobj, ==, 0); + ASSERT0(dp->dp_empty_bpobj); dp->dp_empty_bpobj = bpobj_alloc(os, SPA_MAXBLOCKSIZE, tx); VERIFY(zap_add(os, diff --git a/uts/common/fs/zfs/bptree.c b/uts/common/fs/zfs/bptree.c index ca4cd254689c..1a009cfe5739 100644 --- a/uts/common/fs/zfs/bptree.c +++ b/uts/common/fs/zfs/bptree.c @@ -94,9 +94,9 @@ bptree_free(objset_t *os, uint64_t obj, dmu_tx_t *tx) VERIFY3U(0, ==, dmu_bonus_hold(os, obj, FTAG, &db)); bt = db->db_data; ASSERT3U(bt->bt_begin, ==, bt->bt_end); - ASSERT3U(bt->bt_bytes, ==, 0); - ASSERT3U(bt->bt_comp, ==, 0); - ASSERT3U(bt->bt_uncomp, ==, 0); + ASSERT0(bt->bt_bytes); + ASSERT0(bt->bt_comp); + ASSERT0(bt->bt_uncomp); dmu_buf_rele(db, FTAG); return (dmu_object_free(os, obj, tx)); @@ -198,7 +198,7 @@ bptree_iterate(objset_t *os, uint64_t obj, boolean_t free, bptree_itor_t func, /* save bookmark for future resume */ ASSERT3U(bte.be_zb.zb_objset, ==, ZB_DESTROYED_OBJSET); - ASSERT3U(bte.be_zb.zb_level, ==, 0); + ASSERT0(bte.be_zb.zb_level); dmu_write(os, obj, i * sizeof (bte), sizeof (bte), &bte, tx); break; @@ -214,9 +214,9 @@ bptree_iterate(objset_t *os, uint64_t obj, boolean_t free, bptree_itor_t func, /* if all blocks are free there should be no used space */ if (ba.ba_phys->bt_begin == ba.ba_phys->bt_end) { - ASSERT3U(ba.ba_phys->bt_bytes, ==, 0); - ASSERT3U(ba.ba_phys->bt_comp, ==, 0); - ASSERT3U(ba.ba_phys->bt_uncomp, ==, 0); + ASSERT0(ba.ba_phys->bt_bytes); + ASSERT0(ba.ba_phys->bt_comp); + ASSERT0(ba.ba_phys->bt_uncomp); } dmu_buf_rele(db, FTAG); diff --git a/uts/common/fs/zfs/dbuf.c b/uts/common/fs/zfs/dbuf.c index 145cc01c67dd..a6048bb51178 100644 --- a/uts/common/fs/zfs/dbuf.c +++ b/uts/common/fs/zfs/dbuf.c @@ -328,7 +328,7 @@ dbuf_verify(dmu_buf_impl_t *db) } else if (db->db_blkid == DMU_SPILL_BLKID) { ASSERT(dn != NULL); ASSERT3U(db->db.db_size, >=, dn->dn_bonuslen); - ASSERT3U(db->db.db_offset, ==, 0); + ASSERT0(db->db.db_offset); } else { ASSERT3U(db->db.db_offset, ==, db->db_blkid * db->db.db_size); } @@ -2308,7 +2308,7 @@ dbuf_sync_leaf(dbuf_dirty_record_t *dr, dmu_tx_t *tx) dbuf_dirty_record_t **drp; ASSERT(*datap != NULL); - ASSERT3U(db->db_level, ==, 0); + ASSERT0(db->db_level); ASSERT3U(dn->dn_phys->dn_bonuslen, <=, DN_MAX_BONUSLEN); bcopy(*datap, DN_BONUS(dn->dn_phys), dn->dn_phys->dn_bonuslen); DB_DNODE_EXIT(db); @@ -2507,7 +2507,7 @@ dbuf_write_done(zio_t *zio, arc_buf_t *buf, void *vdb) uint64_t txg = zio->io_txg; dbuf_dirty_record_t **drp, *dr; - ASSERT3U(zio->io_error, ==, 0); + ASSERT0(zio->io_error); ASSERT(db->db_blkptr == bp); if (zio->io_flags & ZIO_FLAG_IO_REWRITE) { diff --git a/uts/common/fs/zfs/dmu_send.c b/uts/common/fs/zfs/dmu_send.c index e2b0c822bbce..e5644b5a0c2a 100644 --- a/uts/common/fs/zfs/dmu_send.c +++ b/uts/common/fs/zfs/dmu_send.c @@ -57,7 +57,7 @@ dump_bytes(dmu_sendarg_t *dsp, void *buf, int len) { dsl_dataset_t *ds = dsp->dsa_os->os_dsl_dataset; ssize_t resid; /* have to get resid to get detailed errno */ - ASSERT3U(len % 8, ==, 0); + ASSERT0(len % 8); fletcher_4_incremental_native(buf, len, &dsp->dsa_zc); dsp->dsa_err = vn_rdwr(UIO_WRITE, dsp->dsa_vp, @@ -961,7 +961,7 @@ restore_read(struct restorearg *ra, int len) int done = 0; /* some things will require 8-byte alignment, so everything must */ - ASSERT3U(len % 8, ==, 0); + ASSERT0(len % 8); while (done < len) { ssize_t resid; @@ -1638,7 +1638,7 @@ dmu_recv_existing_end(dmu_recv_cookie_t *drc) (void) add_ds_to_guidmap(drc->drc_guid_to_ds_map, ds); dsl_dataset_disown(ds, dmu_recv_tag); myerr = dsl_dataset_destroy(drc->drc_real_ds, dmu_recv_tag, B_FALSE); - ASSERT3U(myerr, ==, 0); + ASSERT0(myerr); return (err); } diff --git a/uts/common/fs/zfs/dmu_traverse.c b/uts/common/fs/zfs/dmu_traverse.c index a01c11bbab1d..34f19cdcbb0d 100644 --- a/uts/common/fs/zfs/dmu_traverse.c +++ b/uts/common/fs/zfs/dmu_traverse.c @@ -176,7 +176,7 @@ static void traverse_pause(traverse_data_t *td, const zbookmark_t *zb) { ASSERT(td->td_resume != NULL); - ASSERT3U(zb->zb_level, ==, 0); + ASSERT0(zb->zb_level); bcopy(zb, td->td_resume, sizeof (*td->td_resume)); } diff --git a/uts/common/fs/zfs/dmu_tx.c b/uts/common/fs/zfs/dmu_tx.c index 5e3971ad451e..4af740441c00 100644 --- a/uts/common/fs/zfs/dmu_tx.c +++ b/uts/common/fs/zfs/dmu_tx.c @@ -911,7 +911,7 @@ dmu_tx_try_assign(dmu_tx_t *tx, uint64_t txg_how) uint64_t memory, asize, fsize, usize; uint64_t towrite, tofree, tooverwrite, tounref, tohold, fudge; - ASSERT3U(tx->tx_txg, ==, 0); + ASSERT0(tx->tx_txg); if (tx->tx_err) return (tx->tx_err); diff --git a/uts/common/fs/zfs/dnode.c b/uts/common/fs/zfs/dnode.c index 05ccf9fc62d3..6838576dcf09 100644 --- a/uts/common/fs/zfs/dnode.c +++ b/uts/common/fs/zfs/dnode.c @@ -137,32 +137,32 @@ dnode_dest(void *arg, void *unused) ASSERT(!list_link_active(&dn->dn_dirty_link[i])); avl_destroy(&dn->dn_ranges[i]); list_destroy(&dn->dn_dirty_records[i]); - ASSERT3U(dn->dn_next_nblkptr[i], ==, 0); - ASSERT3U(dn->dn_next_nlevels[i], ==, 0); - ASSERT3U(dn->dn_next_indblkshift[i], ==, 0); - ASSERT3U(dn->dn_next_bonustype[i], ==, 0); - ASSERT3U(dn->dn_rm_spillblk[i], ==, 0); - ASSERT3U(dn->dn_next_bonuslen[i], ==, 0); - ASSERT3U(dn->dn_next_blksz[i], ==, 0); + ASSERT0(dn->dn_next_nblkptr[i]); + ASSERT0(dn->dn_next_nlevels[i]); + ASSERT0(dn->dn_next_indblkshift[i]); + ASSERT0(dn->dn_next_bonustype[i]); + ASSERT0(dn->dn_rm_spillblk[i]); + ASSERT0(dn->dn_next_bonuslen[i]); + ASSERT0(dn->dn_next_blksz[i]); } - ASSERT3U(dn->dn_allocated_txg, ==, 0); - ASSERT3U(dn->dn_free_txg, ==, 0); - ASSERT3U(dn->dn_assigned_txg, ==, 0); - ASSERT3U(dn->dn_dirtyctx, ==, 0); + ASSERT0(dn->dn_allocated_txg); + ASSERT0(dn->dn_free_txg); + ASSERT0(dn->dn_assigned_txg); + ASSERT0(dn->dn_dirtyctx); ASSERT3P(dn->dn_dirtyctx_firstset, ==, NULL); ASSERT3P(dn->dn_bonus, ==, NULL); ASSERT(!dn->dn_have_spill); ASSERT3P(dn->dn_zio, ==, NULL); - ASSERT3U(dn->dn_oldused, ==, 0); - ASSERT3U(dn->dn_oldflags, ==, 0); - ASSERT3U(dn->dn_olduid, ==, 0); - ASSERT3U(dn->dn_oldgid, ==, 0); - ASSERT3U(dn->dn_newuid, ==, 0); - ASSERT3U(dn->dn_newgid, ==, 0); - ASSERT3U(dn->dn_id_flags, ==, 0); + ASSERT0(dn->dn_oldused); + ASSERT0(dn->dn_oldflags); + ASSERT0(dn->dn_olduid); + ASSERT0(dn->dn_oldgid); + ASSERT0(dn->dn_newuid); + ASSERT0(dn->dn_newgid); + ASSERT0(dn->dn_id_flags); - ASSERT3U(dn->dn_dbufs_count, ==, 0); + ASSERT0(dn->dn_dbufs_count); list_destroy(&dn->dn_dbufs); } @@ -361,7 +361,7 @@ dnode_rm_spill(dnode_t *dn, dmu_tx_t *tx) static void dnode_setdblksz(dnode_t *dn, int size) { - ASSERT3U(P2PHASE(size, SPA_MINBLOCKSIZE), ==, 0); + ASSERT0(P2PHASE(size, SPA_MINBLOCKSIZE)); ASSERT3U(size, <=, SPA_MAXBLOCKSIZE); ASSERT3U(size, >=, SPA_MINBLOCKSIZE); ASSERT3U(size >> SPA_MINBLOCKSHIFT, <, @@ -506,24 +506,24 @@ dnode_allocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, int ibs, ASSERT(DMU_OT_IS_VALID(bonustype)); ASSERT3U(bonuslen, <=, DN_MAX_BONUSLEN); ASSERT(dn->dn_type == DMU_OT_NONE); - ASSERT3U(dn->dn_maxblkid, ==, 0); - ASSERT3U(dn->dn_allocated_txg, ==, 0); - ASSERT3U(dn->dn_assigned_txg, ==, 0); + ASSERT0(dn->dn_maxblkid); + ASSERT0(dn->dn_allocated_txg); + ASSERT0(dn->dn_assigned_txg); ASSERT(refcount_is_zero(&dn->dn_tx_holds)); ASSERT3U(refcount_count(&dn->dn_holds), <=, 1); ASSERT3P(list_head(&dn->dn_dbufs), ==, NULL); for (i = 0; i < TXG_SIZE; i++) { - ASSERT3U(dn->dn_next_nblkptr[i], ==, 0); - ASSERT3U(dn->dn_next_nlevels[i], ==, 0); - ASSERT3U(dn->dn_next_indblkshift[i], ==, 0); - ASSERT3U(dn->dn_next_bonuslen[i], ==, 0); - ASSERT3U(dn->dn_next_bonustype[i], ==, 0); - ASSERT3U(dn->dn_rm_spillblk[i], ==, 0); - ASSERT3U(dn->dn_next_blksz[i], ==, 0); + ASSERT0(dn->dn_next_nblkptr[i]); + ASSERT0(dn->dn_next_nlevels[i]); + ASSERT0(dn->dn_next_indblkshift[i]); + ASSERT0(dn->dn_next_bonuslen[i]); + ASSERT0(dn->dn_next_bonustype[i]); + ASSERT0(dn->dn_rm_spillblk[i]); + ASSERT0(dn->dn_next_blksz[i]); ASSERT(!list_link_active(&dn->dn_dirty_link[i])); ASSERT3P(list_head(&dn->dn_dirty_records[i]), ==, NULL); - ASSERT3U(avl_numnodes(&dn->dn_ranges[i]), ==, 0); + ASSERT0(avl_numnodes(&dn->dn_ranges[i])); } dn->dn_type = ot; @@ -565,7 +565,7 @@ dnode_reallocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, ASSERT3U(blocksize, >=, SPA_MINBLOCKSIZE); ASSERT3U(blocksize, <=, SPA_MAXBLOCKSIZE); - ASSERT3U(blocksize % SPA_MINBLOCKSIZE, ==, 0); + ASSERT0(blocksize % SPA_MINBLOCKSIZE); ASSERT(dn->dn_object != DMU_META_DNODE_OBJECT || dmu_tx_private_ok(tx)); ASSERT(tx->tx_txg != 0); ASSERT((bonustype == DMU_OT_NONE && bonuslen == 0) || @@ -1235,9 +1235,9 @@ dnode_setdirty(dnode_t *dn, dmu_tx_t *tx) ASSERT(!refcount_is_zero(&dn->dn_holds) || list_head(&dn->dn_dbufs)); ASSERT(dn->dn_datablksz != 0); - ASSERT3U(dn->dn_next_bonuslen[txg&TXG_MASK], ==, 0); - ASSERT3U(dn->dn_next_blksz[txg&TXG_MASK], ==, 0); - ASSERT3U(dn->dn_next_bonustype[txg&TXG_MASK], ==, 0); + ASSERT0(dn->dn_next_bonuslen[txg&TXG_MASK]); + ASSERT0(dn->dn_next_blksz[txg&TXG_MASK]); + ASSERT0(dn->dn_next_bonustype[txg&TXG_MASK]); dprintf_ds(os->os_dsl_dataset, "obj=%llu txg=%llu\n", dn->dn_object, txg); @@ -1587,7 +1587,7 @@ dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx) else tail = P2PHASE(len, blksz); - ASSERT3U(P2PHASE(off, blksz), ==, 0); + ASSERT0(P2PHASE(off, blksz)); /* zero out any partial block data at the end of the range */ if (tail) { if (len < tail) @@ -1769,7 +1769,7 @@ dnode_diduse_space(dnode_t *dn, int64_t delta) space += delta; if (spa_version(dn->dn_objset->os_spa) < SPA_VERSION_DNODE_BYTES) { ASSERT((dn->dn_phys->dn_flags & DNODE_FLAG_USED_BYTES) == 0); - ASSERT3U(P2PHASE(space, 1<dn_phys->dn_used = space >> DEV_BSHIFT; } else { dn->dn_phys->dn_used = space; diff --git a/uts/common/fs/zfs/dnode_sync.c b/uts/common/fs/zfs/dnode_sync.c index 8d817919b34a..38dab665fc63 100644 --- a/uts/common/fs/zfs/dnode_sync.c +++ b/uts/common/fs/zfs/dnode_sync.c @@ -274,7 +274,7 @@ free_children(dmu_buf_impl_t *db, uint64_t blkid, uint64_t nblks, int trunc, continue; rw_enter(&dn->dn_struct_rwlock, RW_READER); err = dbuf_hold_impl(dn, db->db_level-1, i, TRUE, FTAG, &subdb); - ASSERT3U(err, ==, 0); + ASSERT0(err); rw_exit(&dn->dn_struct_rwlock); if (free_children(subdb, blkid, nblks, trunc, tx) == ALL) { @@ -294,7 +294,7 @@ free_children(dmu_buf_impl_t *db, uint64_t blkid, uint64_t nblks, int trunc, continue; else if (i == end && !trunc) continue; - ASSERT3U(bp->blk_birth, ==, 0); + ASSERT0(bp->blk_birth); } #endif ASSERT(all || blocks_freed == 0 || db->db_last_dirty); @@ -350,7 +350,7 @@ dnode_sync_free_range(dnode_t *dn, uint64_t blkid, uint64_t nblks, dmu_tx_t *tx) continue; rw_enter(&dn->dn_struct_rwlock, RW_READER); err = dbuf_hold_impl(dn, dnlevel-1, i, TRUE, FTAG, &db); - ASSERT3U(err, ==, 0); + ASSERT0(err); rw_exit(&dn->dn_struct_rwlock); if (free_children(db, blkid, nblks, trunc, tx) == ALL) { @@ -471,7 +471,7 @@ dnode_sync_free(dnode_t *dn, dmu_tx_t *tx) * Our contents should have been freed in dnode_sync() by the * free range record inserted by the caller of dnode_free(). */ - ASSERT3U(DN_USED_BYTES(dn->dn_phys), ==, 0); + ASSERT0(DN_USED_BYTES(dn->dn_phys)); ASSERT(BP_IS_HOLE(dn->dn_phys->dn_blkptr)); dnode_undirty_dbufs(&dn->dn_dirty_records[txgoff]); diff --git a/uts/common/fs/zfs/dsl_dataset.c b/uts/common/fs/zfs/dsl_dataset.c index 4571fa8743a3..6625444e5abb 100644 --- a/uts/common/fs/zfs/dsl_dataset.c +++ b/uts/common/fs/zfs/dsl_dataset.c @@ -1498,7 +1498,7 @@ remove_from_next_clones(dsl_dataset_t *ds, uint64_t obj, dmu_tx_t *tx) * remove this one. */ if (err != ENOENT) { - VERIFY3U(err, ==, 0); + VERIFY0(err); } ASSERT3U(0, ==, zap_count(mos, ds->ds_phys->ds_next_clones_obj, &count)); @@ -1585,7 +1585,7 @@ process_old_deadlist(dsl_dataset_t *ds, dsl_dataset_t *ds_prev, poa.pio = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED); VERIFY3U(0, ==, bpobj_iterate(&ds_next->ds_deadlist.dl_bpobj, process_old_cb, &poa, tx)); - VERIFY3U(zio_wait(poa.pio), ==, 0); + VERIFY0(zio_wait(poa.pio)); ASSERT3U(poa.used, ==, ds->ds_phys->ds_unique_bytes); /* change snapused */ @@ -1620,7 +1620,7 @@ old_synchronous_dataset_destroy(dsl_dataset_t *ds, dmu_tx_t *tx) err = traverse_dataset(ds, ds->ds_phys->ds_prev_snap_txg, TRAVERSE_POST, kill_blkptr, &ka); - ASSERT3U(err, ==, 0); + ASSERT0(err); ASSERT(!DS_UNIQUE_IS_ACCURATE(ds) || ds->ds_phys->ds_unique_bytes == 0); return (err); @@ -1676,7 +1676,7 @@ dsl_dataset_destroy_sync(void *arg1, void *tag, dmu_tx_t *tx) psa.psa_effective_value = 0; /* predict default value */ dsl_dataset_set_reservation_sync(ds, &psa, tx); - ASSERT3U(ds->ds_reserved, ==, 0); + ASSERT0(ds->ds_reserved); } ASSERT(RW_WRITE_HELD(&dp->dp_config_rwlock)); @@ -1943,7 +1943,7 @@ dsl_dataset_destroy_sync(void *arg1, void *tag, dmu_tx_t *tx) err = dsl_dataset_snap_lookup(ds_head, ds->ds_snapname, &val); - ASSERT3U(err, ==, 0); + ASSERT0(err); ASSERT3U(val, ==, obj); } #endif @@ -2437,13 +2437,13 @@ dsl_dataset_snapshot_rename_sync(void *arg1, void *arg2, dmu_tx_t *tx) VERIFY(0 == dsl_dataset_get_snapname(ds)); err = dsl_dataset_snap_remove(hds, ds->ds_snapname, tx); - ASSERT3U(err, ==, 0); + ASSERT0(err); mutex_enter(&ds->ds_lock); (void) strcpy(ds->ds_snapname, newsnapname); mutex_exit(&ds->ds_lock); err = zap_add(mos, hds->ds_phys->ds_snapnames_zapobj, ds->ds_snapname, 8, 1, &ds->ds_object, tx); - ASSERT3U(err, ==, 0); + ASSERT0(err); spa_history_log_internal_ds(ds, "rename", tx, "-> @%s", newsnapname); @@ -2897,7 +2897,7 @@ dsl_dataset_promote_sync(void *arg1, void *arg2, dmu_tx_t *tx) zap_cursor_fini(&zc); } - ASSERT3U(dsl_prop_numcb(ds), ==, 0); + ASSERT0(dsl_prop_numcb(ds)); } /* diff --git a/uts/common/fs/zfs/dsl_dir.c b/uts/common/fs/zfs/dsl_dir.c index e58260cdf484..df3f02b1df3e 100644 --- a/uts/common/fs/zfs/dsl_dir.c +++ b/uts/common/fs/zfs/dsl_dir.c @@ -492,10 +492,10 @@ dsl_dir_destroy_sync(void *arg1, void *tag, dmu_tx_t *tx) */ dsl_dir_set_reservation_sync_impl(dd, 0, tx); - ASSERT3U(dd->dd_phys->dd_used_bytes, ==, 0); - ASSERT3U(dd->dd_phys->dd_reserved, ==, 0); + ASSERT0(dd->dd_phys->dd_used_bytes); + ASSERT0(dd->dd_phys->dd_reserved); for (t = 0; t < DD_USED_NUM; t++) - ASSERT3U(dd->dd_phys->dd_used_breakdown[t], ==, 0); + ASSERT0(dd->dd_phys->dd_used_breakdown[t]); VERIFY(0 == zap_destroy(mos, dd->dd_phys->dd_child_dir_zapobj, tx)); VERIFY(0 == zap_destroy(mos, dd->dd_phys->dd_props_zapobj, tx)); @@ -584,7 +584,7 @@ dsl_dir_sync(dsl_dir_t *dd, dmu_tx_t *tx) ASSERT(dmu_tx_is_syncing(tx)); mutex_enter(&dd->dd_lock); - ASSERT3U(dd->dd_tempreserved[tx->tx_txg&TXG_MASK], ==, 0); + ASSERT0(dd->dd_tempreserved[tx->tx_txg&TXG_MASK]); dprintf_dd(dd, "txg=%llu towrite=%lluK\n", tx->tx_txg, dd->dd_space_towrite[tx->tx_txg&TXG_MASK] / 1024); dd->dd_space_towrite[tx->tx_txg&TXG_MASK] = 0; @@ -1326,7 +1326,7 @@ dsl_dir_rename_sync(void *arg1, void *arg2, dmu_tx_t *tx) /* remove from old parent zapobj */ err = zap_remove(mos, dd->dd_parent->dd_phys->dd_child_dir_zapobj, dd->dd_myname, tx); - ASSERT3U(err, ==, 0); + ASSERT0(err); (void) strcpy(dd->dd_myname, ra->mynewname); dsl_dir_close(dd->dd_parent, dd); @@ -1337,7 +1337,7 @@ dsl_dir_rename_sync(void *arg1, void *arg2, dmu_tx_t *tx) /* add to new parent zapobj */ err = zap_add(mos, ra->newparent->dd_phys->dd_child_dir_zapobj, dd->dd_myname, 8, 1, &dd->dd_object, tx); - ASSERT3U(err, ==, 0); + ASSERT0(err); } diff --git a/uts/common/fs/zfs/dsl_pool.c b/uts/common/fs/zfs/dsl_pool.c index c17deb68dfa5..8ab6655b6f1d 100644 --- a/uts/common/fs/zfs/dsl_pool.c +++ b/uts/common/fs/zfs/dsl_pool.c @@ -264,7 +264,7 @@ dsl_pool_create(spa_t *spa, nvlist_t *zplprops, uint64_t txg) /* create the pool directory */ err = zap_create_claim(dp->dp_meta_objset, DMU_POOL_DIRECTORY_OBJECT, DMU_OT_OBJECT_DIRECTORY, DMU_OT_NONE, 0, tx); - ASSERT3U(err, ==, 0); + ASSERT0(err); /* Initialize scan structures */ VERIFY3U(0, ==, dsl_scan_init(dp, txg)); diff --git a/uts/common/fs/zfs/dsl_synctask.c b/uts/common/fs/zfs/dsl_synctask.c index 4e56d28d8237..e2481281e06a 100644 --- a/uts/common/fs/zfs/dsl_synctask.c +++ b/uts/common/fs/zfs/dsl_synctask.c @@ -163,7 +163,7 @@ dsl_sync_task_group_sync(dsl_sync_task_group_t *dstg, dmu_tx_t *tx) dsl_pool_t *dp = dstg->dstg_pool; uint64_t quota, used; - ASSERT3U(dstg->dstg_err, ==, 0); + ASSERT0(dstg->dstg_err); /* * Check for sufficient space. We just check against what's diff --git a/uts/common/fs/zfs/metaslab.c b/uts/common/fs/zfs/metaslab.c index 2f7c882c8c51..9ccd5c04d3fe 100644 --- a/uts/common/fs/zfs/metaslab.c +++ b/uts/common/fs/zfs/metaslab.c @@ -769,7 +769,7 @@ metaslab_fini(metaslab_t *msp) for (int t = 0; t < TXG_DEFER_SIZE; t++) space_map_destroy(&msp->ms_defermap[t]); - ASSERT3S(msp->ms_deferspace, ==, 0); + ASSERT0(msp->ms_deferspace); mutex_exit(&msp->ms_lock); mutex_destroy(&msp->ms_lock); diff --git a/uts/common/fs/zfs/spa.c b/uts/common/fs/zfs/spa.c index 80b05983e76c..d9cd70f1c8ec 100644 --- a/uts/common/fs/zfs/spa.c +++ b/uts/common/fs/zfs/spa.c @@ -714,7 +714,7 @@ spa_change_guid_sync(void *arg1, void *arg2, dmu_tx_t *tx) vdev_config_dirty(rvd); spa_config_exit(spa, SCL_STATE, FTAG); - spa_history_log_internal(spa, "guid change", tx, "old=%llu new=%llu", + spa_history_log_internal(spa, "guid change", tx, "old=%lld new=%lld", oldguid, *newguid); } @@ -5027,7 +5027,7 @@ spa_vdev_remove_evacuate(spa_t *spa, vdev_t *vd) * The evacuation succeeded. Remove any remaining MOS metadata * associated with this vdev, and wait for these changes to sync. */ - ASSERT3U(vd->vdev_stat.vs_alloc, ==, 0); + ASSERT0(vd->vdev_stat.vs_alloc); txg = spa_vdev_config_enter(spa); vd->vdev_removing = B_TRUE; vdev_dirty(vd, 0, NULL, txg); @@ -6019,7 +6019,7 @@ spa_sync(spa_t *spa, uint64_t txg) zio_t *zio = zio_root(spa, NULL, NULL, 0); VERIFY3U(bpobj_iterate(defer_bpo, spa_free_sync_cb, zio, tx), ==, 0); - VERIFY3U(zio_wait(zio), ==, 0); + VERIFY0(zio_wait(zio)); } /* diff --git a/uts/common/fs/zfs/space_map.c b/uts/common/fs/zfs/space_map.c index 1ce7b2a3d466..20c997385a84 100644 --- a/uts/common/fs/zfs/space_map.c +++ b/uts/common/fs/zfs/space_map.c @@ -22,6 +22,9 @@ * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ #include #include @@ -73,7 +76,7 @@ void space_map_destroy(space_map_t *sm) { ASSERT(!sm->sm_loaded && !sm->sm_loading); - VERIFY3U(sm->sm_space, ==, 0); + VERIFY0(sm->sm_space); avl_destroy(&sm->sm_root); cv_destroy(&sm->sm_load_cv); } @@ -286,7 +289,7 @@ space_map_load(space_map_t *sm, space_map_ops_t *ops, uint8_t maptype, space = smo->smo_alloc; ASSERT(sm->sm_ops == NULL); - VERIFY3U(sm->sm_space, ==, 0); + VERIFY0(sm->sm_space); if (maptype == SM_FREE) { space_map_add(sm, sm->sm_start, sm->sm_size); @@ -475,7 +478,7 @@ space_map_sync(space_map_t *sm, uint8_t maptype, zio_buf_free(entry_map, bufsize); - VERIFY3U(sm->sm_space, ==, 0); + VERIFY0(sm->sm_space); } void diff --git a/uts/common/fs/zfs/vdev.c b/uts/common/fs/zfs/vdev.c index 0b8e073f90f0..fa0a579e6694 100644 --- a/uts/common/fs/zfs/vdev.c +++ b/uts/common/fs/zfs/vdev.c @@ -592,9 +592,9 @@ vdev_free(vdev_t *vd) metaslab_group_destroy(vd->vdev_mg); } - ASSERT3U(vd->vdev_stat.vs_space, ==, 0); - ASSERT3U(vd->vdev_stat.vs_dspace, ==, 0); - ASSERT3U(vd->vdev_stat.vs_alloc, ==, 0); + ASSERT0(vd->vdev_stat.vs_space); + ASSERT0(vd->vdev_stat.vs_dspace); + ASSERT0(vd->vdev_stat.vs_alloc); /* * Remove this vdev from its parent's child list. @@ -1805,7 +1805,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); + ASSERT0(err); smo->smo_object = 0; } dmu_tx_commit(tx); @@ -2005,7 +2005,7 @@ vdev_remove(vdev_t *vd, uint64_t txg) tx = dmu_tx_create_assigned(spa_get_dsl(spa), txg); if (vd->vdev_dtl_smo.smo_object) { - ASSERT3U(vd->vdev_dtl_smo.smo_alloc, ==, 0); + ASSERT0(vd->vdev_dtl_smo.smo_alloc); (void) dmu_object_free(mos, vd->vdev_dtl_smo.smo_object, tx); vd->vdev_dtl_smo.smo_object = 0; } @@ -2017,7 +2017,7 @@ vdev_remove(vdev_t *vd, uint64_t txg) if (msp == NULL || msp->ms_smo.smo_object == 0) continue; - ASSERT3U(msp->ms_smo.smo_alloc, ==, 0); + ASSERT0(msp->ms_smo.smo_alloc); (void) dmu_object_free(mos, msp->ms_smo.smo_object, tx); msp->ms_smo.smo_object = 0; } @@ -2295,7 +2295,7 @@ vdev_offline_locked(spa_t *spa, uint64_t guid, uint64_t flags) (void) spa_vdev_state_exit(spa, vd, 0); goto top; } - ASSERT3U(tvd->vdev_stat.vs_alloc, ==, 0); + ASSERT0(tvd->vdev_stat.vs_alloc); } /* diff --git a/uts/common/fs/zfs/vdev_raidz.c b/uts/common/fs/zfs/vdev_raidz.c index 030ea4293002..efae53425724 100644 --- a/uts/common/fs/zfs/vdev_raidz.c +++ b/uts/common/fs/zfs/vdev_raidz.c @@ -281,7 +281,7 @@ vdev_raidz_map_free_vsd(zio_t *zio) { raidz_map_t *rm = zio->io_vsd; - ASSERT3U(rm->rm_freed, ==, 0); + ASSERT0(rm->rm_freed); rm->rm_freed = 1; if (rm->rm_reports == 0) @@ -1134,7 +1134,7 @@ vdev_raidz_matrix_invert(raidz_map_t *rm, int n, int nmissing, int *missing, */ for (i = 0; i < nmissing; i++) { for (j = 0; j < missing[i]; j++) { - ASSERT3U(rows[i][j], ==, 0); + ASSERT0(rows[i][j]); } ASSERT3U(rows[i][missing[i]], !=, 0); @@ -1175,7 +1175,7 @@ vdev_raidz_matrix_invert(raidz_map_t *rm, int n, int nmissing, int *missing, if (j == missing[i]) { ASSERT3U(rows[i][j], ==, 1); } else { - ASSERT3U(rows[i][j], ==, 0); + ASSERT0(rows[i][j]); } } } diff --git a/uts/common/fs/zfs/zap.c b/uts/common/fs/zfs/zap.c index c22f2ce6730e..009f0a4dd625 100644 --- a/uts/common/fs/zfs/zap.c +++ b/uts/common/fs/zfs/zap.c @@ -162,7 +162,7 @@ zap_table_grow(zap_t *zap, zap_table_phys_t *tbl, } else { newblk = zap_allocate_blocks(zap, tbl->zt_numblks * 2); tbl->zt_nextblk = newblk; - ASSERT3U(tbl->zt_blks_copied, ==, 0); + ASSERT0(tbl->zt_blks_copied); dmu_prefetch(zap->zap_objset, zap->zap_object, tbl->zt_blk << bs, tbl->zt_numblks << bs); } @@ -339,7 +339,7 @@ zap_grow_ptrtbl(zap_t *zap, dmu_tx_t *tx) ASSERT3U(zap->zap_f.zap_phys->zap_ptrtbl.zt_shift, ==, ZAP_EMBEDDED_PTRTBL_SHIFT(zap)); - ASSERT3U(zap->zap_f.zap_phys->zap_ptrtbl.zt_blk, ==, 0); + ASSERT0(zap->zap_f.zap_phys->zap_ptrtbl.zt_blk); newblk = zap_allocate_blocks(zap, 1); err = dmu_buf_hold(zap->zap_objset, zap->zap_object, @@ -475,7 +475,7 @@ zap_open_leaf(uint64_t blkid, dmu_buf_t *db) * chain. There should be no chained leafs (as we have removed * support for them). */ - ASSERT3U(l->l_phys->l_hdr.lh_pad1, ==, 0); + ASSERT0(l->l_phys->l_hdr.lh_pad1); /* * There should be more hash entries than there can be @@ -658,9 +658,9 @@ zap_expand_leaf(zap_name_t *zn, zap_leaf_t *l, dmu_tx_t *tx, zap_leaf_t **lp) zap_leaf_split(l, nl, zap->zap_normflags != 0); /* set sibling pointers */ - for (i = 0; i < (1ULL<l_blkid, tx); - ASSERT3U(err, ==, 0); /* we checked for i/o errors above */ + ASSERT0(err); /* we checked for i/o errors above */ } if (hash & (1ULL << (64 - l->l_phys->l_hdr.lh_prefix_len))) { diff --git a/uts/common/fs/zfs/zap_micro.c b/uts/common/fs/zfs/zap_micro.c index 3e80fb9c5d80..62ea8a63b9e6 100644 --- a/uts/common/fs/zfs/zap_micro.c +++ b/uts/common/fs/zfs/zap_micro.c @@ -506,7 +506,7 @@ zap_lockdir(objset_t *os, uint64_t obj, dmu_tx_t *tx, return (mzap_upgrade(zapp, tx, 0)); } err = dmu_object_set_blocksize(os, obj, newsz, 0, tx); - ASSERT3U(err, ==, 0); + ASSERT0(err); zap->zap_m.zap_num_chunks = db->db_size / MZAP_ENT_LEN - 1; } diff --git a/uts/common/fs/zfs/zfs_debug.c b/uts/common/fs/zfs/zfs_debug.c index d0f411a99350..44824e15a0a0 100644 --- a/uts/common/fs/zfs/zfs_debug.c +++ b/uts/common/fs/zfs/zfs_debug.c @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -48,12 +49,12 @@ zfs_dbgmsg_fini(void) zfs_dbgmsg_size -= size; } mutex_destroy(&zfs_dbgmsgs_lock); - ASSERT3U(zfs_dbgmsg_size, ==, 0); + ASSERT0(zfs_dbgmsg_size); } /* * Print these messages by running: - * echo ::zfs_dbgmsg | mdb -k + * echo ::zfs_dbgmsg | mdb -k * * Monitor these messages by running: * dtrace -q -n 'zfs-dbgmsg{printf("%s\n", stringof(arg0))}' diff --git a/uts/common/fs/zfs/zfs_ioctl.c b/uts/common/fs/zfs/zfs_ioctl.c index b45ee7476e59..723d516552fb 100644 --- a/uts/common/fs/zfs/zfs_ioctl.c +++ b/uts/common/fs/zfs/zfs_ioctl.c @@ -1958,7 +1958,7 @@ zfs_ioc_objset_stats_impl(zfs_cmd_t *zc, objset_t *os) error = zvol_get_stats(os, nv); if (error == EIO) return (error); - VERIFY3S(error, ==, 0); + VERIFY0(error); } error = put_nvlist(zc, nv); nvlist_free(nv); diff --git a/uts/common/fs/zfs/zfs_rlock.c b/uts/common/fs/zfs/zfs_rlock.c index 7fd8f6020d08..08f88b80dea1 100644 --- a/uts/common/fs/zfs/zfs_rlock.c +++ b/uts/common/fs/zfs/zfs_rlock.c @@ -22,6 +22,9 @@ * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ /* * This file contains the code to implement file range locking in @@ -481,9 +484,9 @@ zfs_range_unlock_reader(znode_t *zp, rl_t *remove) cv_destroy(&remove->r_rd_cv); } } else { - ASSERT3U(remove->r_cnt, ==, 0); - ASSERT3U(remove->r_write_wanted, ==, 0); - ASSERT3U(remove->r_read_wanted, ==, 0); + ASSERT0(remove->r_cnt); + ASSERT0(remove->r_write_wanted); + ASSERT0(remove->r_read_wanted); /* * Find start proxy representing this reader lock, * then decrement ref count on all proxies diff --git a/uts/common/fs/zfs/zfs_vfsops.c b/uts/common/fs/zfs/zfs_vfsops.c index 8c3e9b093b21..1552ff03c667 100644 --- a/uts/common/fs/zfs/zfs_vfsops.c +++ b/uts/common/fs/zfs/zfs_vfsops.c @@ -2243,7 +2243,7 @@ zfs_set_version(zfsvfs_t *zfsvfs, uint64_t newvers) error = zap_add(os, MASTER_NODE_OBJ, ZFS_SA_ATTRS, 8, 1, &sa_obj, tx); - ASSERT3U(error, ==, 0); + ASSERT0(error); VERIFY(0 == sa_set_sa_object(os, sa_obj)); sa_register_update_callback(os, zfs_sa_upgrade); diff --git a/uts/common/fs/zfs/zfs_vnops.c b/uts/common/fs/zfs/zfs_vnops.c index 0c39274caf18..c5d8ad7f45ce 100644 --- a/uts/common/fs/zfs/zfs_vnops.c +++ b/uts/common/fs/zfs/zfs_vnops.c @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ /* Portions Copyright 2007 Jeremy Teo */ @@ -1641,7 +1642,7 @@ zfs_remove(vnode_t *dvp, char *name, cred_t *cr, caller_context_t *ct, &xattr_obj, sizeof (xattr_obj)); if (error == 0 && xattr_obj) { error = zfs_zget(zfsvfs, xattr_obj, &xzp); - ASSERT3U(error, ==, 0); + ASSERT0(error); dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_TRUE); dmu_tx_hold_sa(tx, xzp->z_sa_hdl, B_FALSE); } @@ -1719,11 +1720,11 @@ zfs_remove(vnode_t *dvp, char *name, cred_t *cr, caller_context_t *ct, error = sa_update(zp->z_sa_hdl, SA_ZPL_XATTR(zfsvfs), &null_xattr, sizeof (uint64_t), tx); - ASSERT3U(error, ==, 0); + ASSERT0(error); } mutex_enter(&vp->v_lock); vp->v_count--; - ASSERT3U(vp->v_count, ==, 0); + ASSERT0(vp->v_count); mutex_exit(&vp->v_lock); mutex_exit(&zp->z_lock); zfs_znode_delete(zp, tx); @@ -3096,7 +3097,7 @@ zfs_setattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, zp->z_mode = new_mode; ASSERT3U((uintptr_t)aclp, !=, NULL); err = zfs_aclset_common(zp, aclp, cr, tx); - ASSERT3U(err, ==, 0); + ASSERT0(err); if (zp->z_acl_cached) zfs_acl_free(zp->z_acl_cached); zp->z_acl_cached = aclp; @@ -3619,7 +3620,7 @@ zfs_rename(vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm, cred_t *cr, error = sa_update(szp->z_sa_hdl, SA_ZPL_FLAGS(zfsvfs), (void *)&szp->z_pflags, sizeof (uint64_t), tx); - ASSERT3U(error, ==, 0); + ASSERT0(error); error = zfs_link_destroy(sdl, szp, tx, ZRENAMING, NULL); if (error == 0) { diff --git a/uts/common/fs/zfs/zfs_znode.c b/uts/common/fs/zfs/zfs_znode.c index 12639a44a9c4..0c86cac42717 100644 --- a/uts/common/fs/zfs/zfs_znode.c +++ b/uts/common/fs/zfs/zfs_znode.c @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ /* Portions Copyright 2007 Jeremy Teo */ @@ -806,7 +807,7 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr, err = zap_create_claim_norm(zfsvfs->z_os, obj, zfsvfs->z_norm, DMU_OT_DIRECTORY_CONTENTS, obj_type, bonuslen, tx); - ASSERT3U(err, ==, 0); + ASSERT0(err); } else { obj = zap_create_norm(zfsvfs->z_os, zfsvfs->z_norm, DMU_OT_DIRECTORY_CONTENTS, @@ -817,7 +818,7 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr, err = dmu_object_claim(zfsvfs->z_os, obj, DMU_OT_PLAIN_FILE_CONTENTS, 0, obj_type, bonuslen, tx); - ASSERT3U(err, ==, 0); + ASSERT0(err); } else { obj = dmu_object_alloc(zfsvfs->z_os, DMU_OT_PLAIN_FILE_CONTENTS, 0, @@ -999,7 +1000,7 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr, if (obj_type == DMU_OT_ZNODE || acl_ids->z_aclp->z_version < ZFS_ACL_VERSION_FUID) { err = zfs_aclset_common(*zpp, acl_ids->z_aclp, cr, tx); - ASSERT3P(err, ==, 0); + ASSERT0(err); } ZFS_OBJ_HOLD_EXIT(zfsvfs, obj); } @@ -1420,7 +1421,7 @@ zfs_grow_blocksize(znode_t *zp, uint64_t size, dmu_tx_t *tx) if (error == ENOTSUP) return; - ASSERT3U(error, ==, 0); + ASSERT0(error); /* What blocksize did we actually get? */ dmu_object_size_from_db(sa_get_db(zp->z_sa_hdl), &zp->z_blksz, &dummy); diff --git a/uts/common/fs/zfs/zil.c b/uts/common/fs/zfs/zil.c index 0ae4c22d3a4b..969723471e72 100644 --- a/uts/common/fs/zfs/zil.c +++ b/uts/common/fs/zfs/zil.c @@ -1102,7 +1102,7 @@ zil_lwb_commit(zilog_t *zilog, itx_t *itx, lwb_t *lwb) lwb->lwb_nused += reclen + dlen; lwb->lwb_max_txg = MAX(lwb->lwb_max_txg, txg); ASSERT3U(lwb->lwb_nused, <=, lwb->lwb_sz); - ASSERT3U(P2PHASE(lwb->lwb_nused, sizeof (uint64_t)), ==, 0); + ASSERT0(P2PHASE(lwb->lwb_nused, sizeof (uint64_t))); return (lwb); } diff --git a/uts/common/fs/zfs/zio.c b/uts/common/fs/zfs/zio.c index 33807a1a16fc..88684b9ce312 100644 --- a/uts/common/fs/zfs/zio.c +++ b/uts/common/fs/zfs/zio.c @@ -2148,7 +2148,7 @@ zio_dva_allocate(zio_t *zio) } ASSERT(BP_IS_HOLE(bp)); - ASSERT3U(BP_GET_NDVAS(bp), ==, 0); + ASSERT0(BP_GET_NDVAS(bp)); ASSERT3U(zio->io_prop.zp_copies, >, 0); ASSERT3U(zio->io_prop.zp_copies, <=, spa_max_replication(spa)); ASSERT3U(zio->io_size, ==, BP_GET_PSIZE(bp)); diff --git a/uts/common/sys/debug.h b/uts/common/sys/debug.h index 4de39d255e71..85b8ab5f90eb 100644 --- a/uts/common/sys/debug.h +++ b/uts/common/sys/debug.h @@ -23,6 +23,10 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ @@ -114,14 +118,18 @@ _NOTE(CONSTCOND) } while (0) #define VERIFY3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t) #define VERIFY3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t) #define VERIFY3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t) +#define VERIFY0(x) VERIFY3_IMPL(x, ==, 0, uintmax_t) + #if DEBUG #define ASSERT3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t) #define ASSERT3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t) #define ASSERT3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t) +#define ASSERT0(x) VERIFY3_IMPL(x, ==, 0, uintmax_t) #else #define ASSERT3S(x, y, z) ((void)0) #define ASSERT3U(x, y, z) ((void)0) #define ASSERT3P(x, y, z) ((void)0) +#define ASSERT0(x) ((void)0) #endif #ifdef _KERNEL From eb424c124f2834521149013e9b5402100b83cbfc Mon Sep 17 00:00:00 2001 From: Martin Matuska Date: Mon, 10 Sep 2012 21:24:41 +0000 Subject: [PATCH 3/4] Update vendor/illumos/dist to illumos-gate 13810:4b38a0c01186 (zfs changes, illumos issue #3098) --- cmd/zfs/zfs_main.c | 19 +++++++++---------- lib/libzfs/common/libzfs_dataset.c | 29 +++++++++++++++++------------ 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index 28a808ab5345..a59d45eced73 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -2288,10 +2288,8 @@ userspace_cb(void *arg, const char *domain, uid_t rid, uint64_t space) if (!cb->cb_sid2posix) { e = directory_name_from_sid(NULL, sid, &name, &classes); - if (e != NULL) { + if (e != NULL) directory_error_free(e); - return (1); - } if (name == NULL) name = sid; } @@ -2534,7 +2532,7 @@ zfs_do_userspace(int argc, char **argv) boolean_t prtnum = B_FALSE; boolean_t parsable = B_FALSE; boolean_t sid2posix = B_FALSE; - int error = 0; + int ret = 0; int c; zfs_sort_column_t *sortcol = NULL; int types = USTYPE_PSX_USR | USTYPE_SMB_USR; @@ -2679,18 +2677,19 @@ zfs_do_userspace(int argc, char **argv) !(types & (USTYPE_PSX_GRP | USTYPE_SMB_GRP)))) continue; cb.cb_prop = p; - error = zfs_userspace(zhp, p, userspace_cb, &cb); - if (error) - break; + if ((ret = zfs_userspace(zhp, p, userspace_cb, &cb)) != 0) + return (ret); } /* Sort the list */ + if ((node = uu_avl_first(avl_tree)) == NULL) + return (0); + us_populated = B_TRUE; + listpool = uu_list_pool_create("tmplist", sizeof (us_node_t), offsetof(us_node_t, usn_listnode), NULL, UU_DEFAULT); list = uu_list_create(listpool, NULL, UU_DEFAULT); - - node = uu_avl_first(avl_tree); uu_list_node_init(node, &node->usn_listnode, listpool); while (node != NULL) { @@ -2731,7 +2730,7 @@ zfs_do_userspace(int argc, char **argv) uu_avl_destroy(avl_tree); uu_avl_pool_destroy(avl_pool); - return (error); + return (ret); } /* diff --git a/lib/libzfs/common/libzfs_dataset.c b/lib/libzfs/common/libzfs_dataset.c index 809e203b68ba..35d27d9d1ffb 100644 --- a/lib/libzfs/common/libzfs_dataset.c +++ b/lib/libzfs/common/libzfs_dataset.c @@ -21,9 +21,9 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2010 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved. + * Copyright 2012 Nexenta Systems, Inc. All rights reserved. */ #include @@ -4023,35 +4023,40 @@ zfs_userspace(zfs_handle_t *zhp, zfs_userquota_prop_t type, zfs_userspace_cb_t func, void *arg) { zfs_cmd_t zc = { 0 }; - int error; zfs_useracct_t buf[100]; + libzfs_handle_t *hdl = zhp->zfs_hdl; + int ret; (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name)); zc.zc_objset_type = type; zc.zc_nvlist_dst = (uintptr_t)buf; - /* CONSTCOND */ - while (1) { + for (;;) { zfs_useracct_t *zua = buf; zc.zc_nvlist_dst_size = sizeof (buf); - error = ioctl(zhp->zfs_hdl->libzfs_fd, - ZFS_IOC_USERSPACE_MANY, &zc); - if (error || zc.zc_nvlist_dst_size == 0) + if (zfs_ioctl(hdl, ZFS_IOC_USERSPACE_MANY, &zc) != 0) { + char errbuf[ZFS_MAXNAMELEN + 32]; + + (void) snprintf(errbuf, sizeof (errbuf), + dgettext(TEXT_DOMAIN, + "cannot get used/quota for %s"), zc.zc_name); + return (zfs_standard_error_fmt(hdl, errno, errbuf)); + } + if (zc.zc_nvlist_dst_size == 0) break; while (zc.zc_nvlist_dst_size > 0) { - error = func(arg, zua->zu_domain, zua->zu_rid, - zua->zu_space); - if (error != 0) - return (error); + if ((ret = func(arg, zua->zu_domain, zua->zu_rid, + zua->zu_space)) != 0) + return (ret); zua++; zc.zc_nvlist_dst_size -= sizeof (zfs_useracct_t); } } - return (error); + return (0); } int From 7e4318b7e245401af9cfd80dbc386627f9ce6ed8 Mon Sep 17 00:00:00 2001 From: Martin Matuska Date: Tue, 11 Sep 2012 08:49:22 +0000 Subject: [PATCH 4/4] Update vendor/illumos/dist to illumos-gate 13811:4dadf1a8e003 (zfs, illumos issue #3064) --- cmd/zpool/zpool_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index 36b12017773b..4f8a16950e4a 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -3271,7 +3271,7 @@ zpool_do_split(int argc, char **argv) if (zpool_get_state(zhp) != POOL_STATE_UNAVAIL && zpool_enable_datasets(zhp, mntopts, 0) != 0) { ret = 1; - (void) fprintf(stderr, gettext("Split was succssful, but " + (void) fprintf(stderr, gettext("Split was successful, but " "the datasets could not all be mounted\n")); (void) fprintf(stderr, gettext("Try doing '%s' with a " "different altroot\n"), "zpool import");