diff options
Diffstat (limited to 'usr/src/cmd')
| -rw-r--r-- | usr/src/cmd/sgs/libld/common/unwind.c | 21 | ||||
| -rw-r--r-- | usr/src/cmd/zdb/zdb.c | 59 | ||||
| -rw-r--r-- | usr/src/cmd/zfs/zfs_main.c | 11 | ||||
| -rw-r--r-- | usr/src/cmd/zstreamdump/zstreamdump.c | 19 | ||||
| -rw-r--r-- | usr/src/cmd/ztest/ztest.c | 14 | 
5 files changed, 96 insertions, 28 deletions
| diff --git a/usr/src/cmd/sgs/libld/common/unwind.c b/usr/src/cmd/sgs/libld/common/unwind.c index 1e10b4664d..adaf253287 100644 --- a/usr/src/cmd/sgs/libld/common/unwind.c +++ b/usr/src/cmd/sgs/libld/common/unwind.c @@ -21,6 +21,7 @@  /*   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2014 Nexenta Systems, Inc.   */  #include	<string.h> @@ -409,15 +410,10 @@ ld_unwind_make_hdr(Ofl_desc *ofl)  				 */  				if (id == 0) {  					uint_t	cieversion; -					/* -					 * The only CIE version supported -					 * is '1' - quick sanity check -					 * here. -					 */  					cieversion = data[off + ndx];  					ndx += 1;  					/* BEGIN CSTYLED */ -					if (cieversion != 1) { +					if (cieversion != 1 && cieversion != 3) {  					    ld_eprintf(ofl, ERR_FATAL,  						MSG_INTL(MSG_UNW_BADCIEVERS),  						isp->is_file->ifl_name, @@ -582,6 +578,7 @@ ld_unwind_populate_hdr(Ofl_desc *ofl)  			if (id == 0) {  				char	*cieaugstr;  				uint_t	cieaugndx; +				uint_t	cieversion;  				ciePflag = 0;  				cieRflag = 0; @@ -592,10 +589,8 @@ ld_unwind_populate_hdr(Ofl_desc *ofl)  				 * are encoded.  				 */ -				/* -				 * burn through version -				 */ -				ndx++; +				cieversion = data[off + ndx]; +				ndx += 1;  				/*  				 * augstr @@ -612,8 +607,10 @@ ld_unwind_populate_hdr(Ofl_desc *ofl)  				/*  				 * retreg  				 */ -				ndx++; - +				if (cieversion == 1) +					ndx++; +				else +					(void) uleb_extract(&data[off], &ndx);  				/*  				 * we walk through the augmentation  				 * section now looking for the Rflag diff --git a/usr/src/cmd/zdb/zdb.c b/usr/src/cmd/zdb/zdb.c index 63752a51de..36c4a8515b 100644 --- a/usr/src/cmd/zdb/zdb.c +++ b/usr/src/cmd/zdb/zdb.c @@ -77,9 +77,11 @@  #ifndef lint  extern boolean_t zfs_recover;  extern uint64_t zfs_arc_max, zfs_arc_meta_limit; +extern int zfs_vdev_async_read_max_active;  #else  boolean_t zfs_recover;  uint64_t zfs_arc_max, zfs_arc_meta_limit; +int zfs_vdev_async_read_max_active;  #endif  const char cmdname[] = "zdb"; @@ -2118,6 +2120,8 @@ dump_label(const char *dev)  	(void) close(fd);  } +static uint64_t num_large_blocks; +  /*ARGSUSED*/  static int  dump_one_dir(const char *dsname, void *arg) @@ -2130,6 +2134,8 @@ dump_one_dir(const char *dsname, void *arg)  		(void) printf("Could not open %s, error %d\n", dsname, error);  		return (0);  	} +	if (dmu_objset_ds(os)->ds_large_blocks) +		num_large_blocks++;  	dump_dir(os);  	dmu_objset_disown(os, FTAG);  	fuid_table_destroy(); @@ -2140,7 +2146,7 @@ dump_one_dir(const char *dsname, void *arg)  /*   * Block statistics.   */ -#define	PSIZE_HISTO_SIZE (SPA_MAXBLOCKSIZE / SPA_MINBLOCKSIZE + 1) +#define	PSIZE_HISTO_SIZE (SPA_OLD_MAXBLOCKSIZE / SPA_MINBLOCKSIZE + 2)  typedef struct zdb_blkstats {  	uint64_t zb_asize;  	uint64_t zb_lsize; @@ -2205,7 +2211,15 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const blkptr_t *bp,  		zb->zb_lsize += BP_GET_LSIZE(bp);  		zb->zb_psize += BP_GET_PSIZE(bp);  		zb->zb_count++; -		zb->zb_psize_histogram[BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT]++; + +		/* +		 * The histogram is only big enough to record blocks up to +		 * SPA_OLD_MAXBLOCKSIZE; larger blocks go into the last, +		 * "other", bucket. +		 */ +		int idx = BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT; +		idx = MIN(idx, SPA_OLD_MAXBLOCKSIZE / SPA_MINBLOCKSIZE + 1); +		zb->zb_psize_histogram[idx]++;  		zb->zb_gangs += BP_COUNT_GANG(bp); @@ -2355,8 +2369,14 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,  	zcb->zcb_readfails = 0; -	if (dump_opt['b'] < 5 && -	    gethrtime() > zcb->zcb_lastprint + NANOSEC) { +	/* only call gethrtime() every 100 blocks */ +	static int iters; +	if (++iters > 100) +		iters = 0; +	else +		return (0); + +	if (dump_opt['b'] < 5 && gethrtime() > zcb->zcb_lastprint + NANOSEC) {  		uint64_t now = gethrtime();  		char buf[10];  		uint64_t bytes = zcb->zcb_type[ZB_TOTAL][ZDB_OT_TOTAL].zb_asize; @@ -2465,6 +2485,14 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)  					    (longlong_t)vd->vdev_ms_count);  					msp->ms_ops = &zdb_metaslab_ops; + +					/* +					 * We don't want to spend the CPU +					 * manipulating the size-ordered +					 * tree, so clear the range_tree +					 * ops. +					 */ +					msp->ms_tree->rt_ops = NULL;  					VERIFY0(space_map_load(msp->ms_sm,  					    msp->ms_tree, SM_ALLOC));  					msp->ms_loaded = B_TRUE; @@ -2901,6 +2929,7 @@ dump_zpool(spa_t *spa)  		dump_metaslab_groups(spa);  	if (dump_opt['d'] || dump_opt['i']) { +		uint64_t refcount;  		dump_dir(dp->dp_meta_objset);  		if (dump_opt['d'] >= 3) {  			dump_bpobj(&spa->spa_deferred_bpobj, @@ -2920,8 +2949,21 @@ dump_zpool(spa_t *spa)  		}  		(void) dmu_objset_find(spa_name(spa), dump_one_dir,  		    NULL, DS_FIND_SNAPSHOTS | DS_FIND_CHILDREN); + +		(void) feature_get_refcount(spa, +		    &spa_feature_table[SPA_FEATURE_LARGE_BLOCKS], &refcount); +		if (num_large_blocks != refcount) { +			(void) printf("large_blocks feature refcount mismatch: " +			    "expected %lld != actual %lld\n", +			    (longlong_t)num_large_blocks, +			    (longlong_t)refcount); +			rc = 2; +		} else { +			(void) printf("Verified large_blocks feature refcount " +			    "is correct (%llu)\n", (longlong_t)refcount); +		}  	} -	if (dump_opt['b'] || dump_opt['c']) +	if (rc == 0 && (dump_opt['b'] || dump_opt['c']))  		rc = dump_block_stats(spa);  	if (rc == 0) @@ -3478,6 +3520,13 @@ main(int argc, char **argv)  	 */  	zfs_arc_max = zfs_arc_meta_limit = 256 * 1024 * 1024; +	/* +	 * "zdb -c" uses checksum-verifying scrub i/os which are async reads. +	 * "zdb -b" uses traversal prefetch which uses async reads. +	 * For good performance, let several of them be active at once. +	 */ +	zfs_vdev_async_read_max_active = 10; +  	kernel_init(FREAD);  	g_zfs = libzfs_init();  	ASSERT(g_zfs != NULL); diff --git a/usr/src/cmd/zfs/zfs_main.c b/usr/src/cmd/zfs/zfs_main.c index 8d035f4253..4228f5c50a 100644 --- a/usr/src/cmd/zfs/zfs_main.c +++ b/usr/src/cmd/zfs/zfs_main.c @@ -256,9 +256,9 @@ get_usage(zfs_help_t idx)  	case HELP_ROLLBACK:  		return (gettext("\trollback [-rRf] <snapshot>\n"));  	case HELP_SEND: -		return (gettext("\tsend [-DnPpRve] [-[iI] snapshot] " +		return (gettext("\tsend [-DnPpRvLe] [-[iI] snapshot] "  		    "<snapshot>\n" -		    "\tsend [-e] [-i snapshot|bookmark] " +		    "\tsend [-Le] [-i snapshot|bookmark] "  		    "<filesystem|volume|snapshot>\n"));  	case HELP_SET:  		return (gettext("\tset <property=value> " @@ -3720,7 +3720,7 @@ zfs_do_send(int argc, char **argv)  	boolean_t extraverbose = B_FALSE;  	/* check options */ -	while ((c = getopt(argc, argv, ":i:I:RDpvnPe")) != -1) { +	while ((c = getopt(argc, argv, ":i:I:RDpvnPLe")) != -1) {  		switch (c) {  		case 'i':  			if (fromname) @@ -3755,6 +3755,9 @@ zfs_do_send(int argc, char **argv)  		case 'n':  			flags.dryrun = B_TRUE;  			break; +		case 'L': +			flags.largeblock = B_TRUE; +			break;  		case 'e':  			flags.embed_data = B_TRUE;  			break; @@ -3811,6 +3814,8 @@ zfs_do_send(int argc, char **argv)  		if (zhp == NULL)  			return (1); +		if (flags.largeblock) +			lzc_flags |= LZC_SEND_FLAG_LARGE_BLOCK;  		if (flags.embed_data)  			lzc_flags |= LZC_SEND_FLAG_EMBED_DATA; diff --git a/usr/src/cmd/zstreamdump/zstreamdump.c b/usr/src/cmd/zstreamdump/zstreamdump.c index dce1cb3d76..d99d8014f0 100644 --- a/usr/src/cmd/zstreamdump/zstreamdump.c +++ b/usr/src/cmd/zstreamdump/zstreamdump.c @@ -54,7 +54,6 @@ uint64_t total_stream_len = 0;  FILE *send_stream = 0;  boolean_t do_byteswap = B_FALSE;  boolean_t do_cksum = B_TRUE; -#define	INITIAL_BUFLEN (1<<20)  static void  usage(void) @@ -67,6 +66,18 @@ usage(void)  	exit(1);  } +static void * +safe_malloc(size_t size) +{ +	void *rv = malloc(size); +	if (rv == NULL) { +		(void) fprintf(stderr, "ERROR; failed to allocate %zu bytes\n", +		    size); +		abort(); +	} +	return (rv); +} +  /*   * ssread - send stream read.   * @@ -158,7 +169,7 @@ print_block(char *buf, int length)  int  main(int argc, char *argv[])  { -	char *buf = malloc(INITIAL_BUFLEN); +	char *buf = safe_malloc(SPA_MAXBLOCKSIZE);  	uint64_t drr_record_count[DRR_NUMTYPES] = { 0 };  	uint64_t total_records = 0;  	dmu_replay_record_t thedrr; @@ -307,9 +318,9 @@ main(int argc, char *argv[])  				nvlist_t *nv;  				int sz = drr->drr_payloadlen; -				if (sz > INITIAL_BUFLEN) { +				if (sz > SPA_MAXBLOCKSIZE) {  					free(buf); -					buf = malloc(sz); +					buf = safe_malloc(sz);  				}  				(void) ssread(buf, sz, &zc);  				if (ferror(send_stream)) diff --git a/usr/src/cmd/ztest/ztest.c b/usr/src/cmd/ztest/ztest.c index 6a29b2f32c..a5f9600804 100644 --- a/usr/src/cmd/ztest/ztest.c +++ b/usr/src/cmd/ztest/ztest.c @@ -985,9 +985,15 @@ ztest_spa_get_ashift() {  static int  ztest_random_blocksize(void)  { -	// Choose a block size >= the ashift. -	uint64_t block_shift = -	    ztest_random(SPA_MAXBLOCKSHIFT - ztest_spa_get_ashift() + 1); +	uint64_t block_shift; +	/* +	 * Choose a block size >= the ashift. +	 * If the SPA supports new MAXBLOCKSIZE, test up to 1MB blocks. +	 */ +	int maxbs = SPA_OLD_MAXBLOCKSHIFT; +	if (spa_maxblocksize(ztest_spa) == SPA_MAXBLOCKSIZE) +		maxbs = 20; +	block_shift = ztest_random(maxbs - ztest_spa_get_ashift() + 1);  	return (1 << (SPA_MINBLOCKSHIFT + block_shift));  } @@ -4787,7 +4793,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)  	char path0[MAXPATHLEN];  	char pathrand[MAXPATHLEN];  	size_t fsize; -	int bshift = SPA_MAXBLOCKSHIFT + 2;	/* don't scrog all labels */ +	int bshift = SPA_OLD_MAXBLOCKSHIFT + 2;	/* don't scrog all labels */  	int iters = 1000;  	int maxfaults;  	int mirror_save; | 
