Merge commit 'refs/top-bases/zfs-branch' into zfs-branch

This commit is contained in:
Brian Behlendorf 2009-03-11 14:08:51 -07:00
commit 1ca6578ebc
12 changed files with 36 additions and 34 deletions

View File

@ -645,7 +645,7 @@ zfs_do_create(int argc, char **argv)
zfs_prop_t resv_prop; zfs_prop_t resv_prop;
char *strval; char *strval;
if (p = strchr(argv[0], '/')) if ((p = strchr(argv[0], '/')))
*p = '\0'; *p = '\0';
zpool_handle = zpool_open(g_zfs, argv[0]); zpool_handle = zpool_open(g_zfs, argv[0]);
if (p != NULL) if (p != NULL)

View File

@ -131,7 +131,7 @@ pool_list_get(int argc, char **argv, zprop_list_t **proplist, int *err)
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
zpool_handle_t *zhp; zpool_handle_t *zhp;
if (zhp = zpool_open_canfail(g_zfs, argv[i])) { if ((zhp = zpool_open_canfail(g_zfs, argv[i]))) {
if (add_pool(zhp, zlp) != 0) if (add_pool(zhp, zlp) != 0)
*err = B_TRUE; *err = B_TRUE;
} else { } else {

View File

@ -636,7 +636,7 @@ libzfs_mnttab_fini(libzfs_handle_t *hdl)
void *cookie = NULL; void *cookie = NULL;
mnttab_node_t *mtn; mnttab_node_t *mtn;
while (mtn = avl_destroy_nodes(&hdl->libzfs_mnttab_cache, &cookie)) { while ((mtn = avl_destroy_nodes(&hdl->libzfs_mnttab_cache, &cookie))) {
free(mtn->mtn_mt.mnt_special); free(mtn->mtn_mt.mnt_special);
free(mtn->mtn_mt.mnt_mountp); free(mtn->mtn_mt.mnt_mountp);
free(mtn->mtn_mt.mnt_fstype); free(mtn->mtn_mt.mnt_fstype);
@ -688,7 +688,7 @@ libzfs_mnttab_remove(libzfs_handle_t *hdl, const char *fsname)
mnttab_node_t *ret; mnttab_node_t *ret;
find.mtn_mt.mnt_special = (char *)fsname; find.mtn_mt.mnt_special = (char *)fsname;
if (ret = avl_find(&hdl->libzfs_mnttab_cache, (void *)&find, NULL)) { if ((ret = avl_find(&hdl->libzfs_mnttab_cache, (void *)&find, NULL))) {
avl_remove(&hdl->libzfs_mnttab_cache, ret); avl_remove(&hdl->libzfs_mnttab_cache, ret);
free(ret->mtn_mt.mnt_special); free(ret->mtn_mt.mnt_special);
free(ret->mtn_mt.mnt_mountp); free(ret->mtn_mt.mnt_mountp);

View File

@ -145,8 +145,9 @@
/* The following are some convenience macros. */ /* The following are some convenience macros. */
#define U8_PUT_3BYTES_INTO_UTF32(u, b1, b2, b3) \ #define U8_PUT_3BYTES_INTO_UTF32(u, b1, b2, b3) \
(u) = ((uint32_t)(b1) & 0x0F) << 12 | ((uint32_t)(b2) & 0x3F) << 6 | \ (u) = ((((uint32_t)(b1) & 0x0F) << 12) | \
(uint32_t)(b3) & 0x3F; (((uint32_t)(b2) & 0x3F) << 6) | \
((uint32_t)(b3) & 0x3F));
#define U8_SIMPLE_SWAP(a, b, t) \ #define U8_SIMPLE_SWAP(a, b, t) \
(t) = (a); \ (t) = (a); \

View File

@ -1115,7 +1115,7 @@ dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx)
int shift = epbs + dn->dn_datablkshift; int shift = epbs + dn->dn_datablkshift;
first = blkid >> epbs; first = blkid >> epbs;
if (db = dbuf_hold_level(dn, 1, first, FTAG)) { if ((db = dbuf_hold_level(dn, 1, first, FTAG))) {
dbuf_will_dirty(db, tx); dbuf_will_dirty(db, tx);
dbuf_rele(db, FTAG); dbuf_rele(db, FTAG);
} }

View File

@ -591,7 +591,7 @@ dnode_sync(dnode_t *dn, dmu_tx_t *tx)
mutex_exit(&dn->dn_mtx); mutex_exit(&dn->dn_mtx);
/* process all the "freed" ranges in the file */ /* process all the "freed" ranges in the file */
while (rp = avl_last(&dn->dn_ranges[txgoff])) { while ((rp = avl_last(&dn->dn_ranges[txgoff]))) {
dnode_sync_free_range(dn, rp->fr_blkid, rp->fr_nblks, tx); dnode_sync_free_range(dn, rp->fr_blkid, rp->fr_nblks, tx);
/* grab the mutex so we don't race with dnode_block_freed() */ /* grab the mutex so we don't race with dnode_block_freed() */
mutex_enter(&dn->dn_mtx); mutex_enter(&dn->dn_mtx);

View File

@ -2334,8 +2334,8 @@ dsl_dataset_promote_check(void *arg1, void *arg2, dmu_tx_t *tx)
if (ds->ds_phys->ds_prev_snap_obj == 0) if (ds->ds_phys->ds_prev_snap_obj == 0)
continue; continue;
if (err = bplist_space(&ds->ds_deadlist, if ((err = bplist_space(&ds->ds_deadlist,
&dlused, &dlcomp, &dluncomp)) &dlused, &dlcomp, &dluncomp)))
return (err); return (err);
pa->used += dlused; pa->used += dlused;
pa->comp += dlcomp; pa->comp += dlcomp;

View File

@ -313,12 +313,12 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t txg)
ASSERT(err == 0); ASSERT(err == 0);
DTRACE_PROBE(pool_sync__2rootzio); DTRACE_PROBE(pool_sync__2rootzio);
while (dstg = txg_list_remove(&dp->dp_sync_tasks, txg)) while ((dstg = txg_list_remove(&dp->dp_sync_tasks, txg)))
dsl_sync_task_group_sync(dstg, tx); dsl_sync_task_group_sync(dstg, tx);
DTRACE_PROBE(pool_sync__3task); DTRACE_PROBE(pool_sync__3task);
start = gethrtime(); start = gethrtime();
while (dd = txg_list_remove(&dp->dp_dirty_dirs, txg)) while ((dd = txg_list_remove(&dp->dp_dirty_dirs, txg)))
dsl_dir_sync(dd, tx); dsl_dir_sync(dd, tx);
write_time += gethrtime() - start; write_time += gethrtime() - start;

View File

@ -215,8 +215,8 @@ spa_prop_get(spa_t *spa, nvlist_t **nvp)
dp = spa_get_dsl(spa); dp = spa_get_dsl(spa);
rw_enter(&dp->dp_config_rwlock, RW_READER); rw_enter(&dp->dp_config_rwlock, RW_READER);
if (err = dsl_dataset_hold_obj(dp, if ((err = dsl_dataset_hold_obj(dp,
za.za_first_integer, FTAG, &ds)) { za.za_first_integer, FTAG, &ds))) {
rw_exit(&dp->dp_config_rwlock); rw_exit(&dp->dp_config_rwlock);
break; break;
} }
@ -336,8 +336,8 @@ spa_prop_validate(spa_t *spa, nvlist_t *props)
break; break;
} }
if (error = dmu_objset_open(strval, DMU_OST_ZFS, if ((error = dmu_objset_open(strval,DMU_OST_ZFS,
DS_MODE_USER | DS_MODE_READONLY, &os)) DS_MODE_USER | DS_MODE_READONLY, &os)))
break; break;
/* We don't support gzip bootable datasets */ /* We don't support gzip bootable datasets */
@ -2369,7 +2369,7 @@ spa_check_rootconf(char *devpath, char *devid, nvlist_t **bestconf,
uint64_t txg; uint64_t txg;
int error; int error;
if (error = vdev_disk_read_rootlabel(devpath, devid, &config)) if ((error = vdev_disk_read_rootlabel(devpath, devid, &config)))
return (error); return (error);
VERIFY(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_TXG, &txg) == 0); VERIFY(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_TXG, &txg) == 0);
@ -2415,7 +2415,7 @@ spa_get_rootconf(char *devpath, char *devid, nvlist_t **bestconf)
if (devpath && ((tmp = strchr(devpath, ' ')) != NULL)) if (devpath && ((tmp = strchr(devpath, ' ')) != NULL))
*tmp = '\0'; *tmp = '\0';
if (error = spa_check_rootconf(devpath, devid, &conf, &txg)) { if ((error = spa_check_rootconf(devpath, devid, &conf, &txg))) {
cmn_err(CE_NOTE, "error reading device label"); cmn_err(CE_NOTE, "error reading device label");
return (error); return (error);
} }
@ -2499,7 +2499,7 @@ spa_import_rootpool(char *devpath, char *devid)
* Get the vdev pathname and configuation from the most * Get the vdev pathname and configuation from the most
* recently updated vdev (highest txg). * recently updated vdev (highest txg).
*/ */
if (error = spa_get_rootconf(devpath, devid, &conf)) if ((error = spa_get_rootconf(devpath, devid, &conf)))
goto msg_out; goto msg_out;
/* /*

View File

@ -161,12 +161,12 @@ zfs_fuid_table_destroy(avl_tree_t *idx_tree, avl_tree_t *domain_tree)
void *cookie; void *cookie;
cookie = NULL; cookie = NULL;
while (domnode = avl_destroy_nodes(domain_tree, &cookie)) while ((domnode = avl_destroy_nodes(domain_tree, &cookie)))
ksiddomain_rele(domnode->f_ksid); ksiddomain_rele(domnode->f_ksid);
avl_destroy(domain_tree); avl_destroy(domain_tree);
cookie = NULL; cookie = NULL;
while (domnode = avl_destroy_nodes(idx_tree, &cookie)) while ((domnode = avl_destroy_nodes(idx_tree, &cookie)))
kmem_free(domnode, sizeof (fuid_domain_t)); kmem_free(domnode, sizeof (fuid_domain_t));
avl_destroy(idx_tree); avl_destroy(idx_tree);
} }

View File

@ -748,8 +748,8 @@ zfs_ioc_pool_create(zfs_cmd_t *zc)
nvlist_t *zplprops = NULL; nvlist_t *zplprops = NULL;
char *buf; char *buf;
if (error = get_nvlist(zc->zc_nvlist_conf, zc->zc_nvlist_conf_size, if ((error = get_nvlist(zc->zc_nvlist_conf,
&config)) zc->zc_nvlist_conf_size, &config)))
return (error); return (error);
if (zc->zc_nvlist_src_size != 0 && (error = if (zc->zc_nvlist_src_size != 0 && (error =
@ -1020,7 +1020,7 @@ zfs_ioc_dsobj_to_dsname(zfs_cmd_t *zc)
{ {
int error; int error;
if (error = dsl_dsobj_to_dsname(zc->zc_name, zc->zc_obj, zc->zc_value)) if ((error = dsl_dsobj_to_dsname(zc->zc_name,zc->zc_obj,zc->zc_value)))
return (error); return (error);
return (0); return (0);
@ -1203,8 +1203,8 @@ zfs_ioc_objset_stats(zfs_cmd_t *zc)
int error; int error;
nvlist_t *nv; nvlist_t *nv;
if (error = dmu_objset_open(zc->zc_name, if ((error = dmu_objset_open(zc->zc_name,
DMU_OST_ANY, DS_MODE_USER | DS_MODE_READONLY, &os)) DMU_OST_ANY, DS_MODE_USER | DS_MODE_READONLY, &os)))
return (error); return (error);
dmu_objset_fast_stat(os, &zc->zc_objset_stats); dmu_objset_fast_stat(os, &zc->zc_objset_stats);
@ -1261,8 +1261,8 @@ zfs_ioc_objset_zplprops(zfs_cmd_t *zc)
objset_t *os; objset_t *os;
int err; int err;
if (err = dmu_objset_open(zc->zc_name, if ((err = dmu_objset_open(zc->zc_name,
DMU_OST_ANY, DS_MODE_USER | DS_MODE_READONLY, &os)) DMU_OST_ANY, DS_MODE_USER | DS_MODE_READONLY, &os)))
return (err); return (err);
dmu_objset_fast_stat(os, &zc->zc_objset_stats); dmu_objset_fast_stat(os, &zc->zc_objset_stats);
@ -1310,8 +1310,8 @@ zfs_ioc_dataset_list_next(zfs_cmd_t *zc)
int error; int error;
char *p; char *p;
if (error = dmu_objset_open(zc->zc_name, if ((error = dmu_objset_open(zc->zc_name,
DMU_OST_ANY, DS_MODE_USER | DS_MODE_READONLY, &os)) { DMU_OST_ANY, DS_MODE_USER | DS_MODE_READONLY, &os))) {
if (error == ENOENT) if (error == ENOENT)
error = ESRCH; error = ESRCH;
return (error); return (error);
@ -1425,8 +1425,8 @@ zfs_set_prop_nvlist(const char *name, nvlist_t *nvl)
nvpair_type(elem) != DATA_TYPE_STRING) nvpair_type(elem) != DATA_TYPE_STRING)
return (EINVAL); return (EINVAL);
if (error = zfs_secpolicy_write_perms(name, if ((error = zfs_secpolicy_write_perms(name,
ZFS_DELEG_PERM_USERPROP, CRED())) ZFS_DELEG_PERM_USERPROP, CRED())))
return (error); return (error);
continue; continue;
} }

View File

@ -2204,11 +2204,12 @@ zio_done(zio_t *zio)
*/ */
ASSERT(vd == NULL && bp != NULL); ASSERT(vd == NULL && bp != NULL);
if (IO_IS_ALLOCATING(zio)) if (IO_IS_ALLOCATING(zio)) {
if (zio->io_error != ENOSPC) if (zio->io_error != ENOSPC)
zio->io_reexecute |= ZIO_REEXECUTE_NOW; zio->io_reexecute |= ZIO_REEXECUTE_NOW;
else else
zio->io_reexecute |= ZIO_REEXECUTE_SUSPEND; zio->io_reexecute |= ZIO_REEXECUTE_SUSPEND;
}
if ((zio->io_type == ZIO_TYPE_READ || if ((zio->io_type == ZIO_TYPE_READ ||
zio->io_type == ZIO_TYPE_FREE) && zio->io_type == ZIO_TYPE_FREE) &&