summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd/zdb/zdb.c39
-rw-r--r--include/sys/zap.h7
-rw-r--r--include/sys/zap_impl.h1
-rw-r--r--module/zfs/zap.c25
-rw-r--r--module/zfs/zap_micro.c41
5 files changed, 39 insertions, 74 deletions
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
index 29d26abc5..25f44212a 100644
--- a/cmd/zdb/zdb.c
+++ b/cmd/zdb/zdb.c
@@ -2213,6 +2213,8 @@ typedef struct zdb_blkstats {
uint64_t zb_lsize;
uint64_t zb_psize;
uint64_t zb_count;
+ uint64_t zb_gangs;
+ uint64_t zb_ditto_samevdev;
uint64_t zb_psize_histogram[PSIZE_HISTO_SIZE];
} zdb_blkstats_t;
@@ -2264,6 +2266,7 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const blkptr_t *bp,
for (i = 0; i < 4; i++) {
int l = (i < 2) ? BP_GET_LEVEL(bp) : ZB_TOTAL;
int t = (i & 1) ? type : ZDB_OT_TOTAL;
+ int equal;
zdb_blkstats_t *zb = &zcb->zcb_type[l][t];
zb->zb_asize += BP_GET_ASIZE(bp);
@@ -2271,6 +2274,27 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const blkptr_t *bp,
zb->zb_psize += BP_GET_PSIZE(bp);
zb->zb_count++;
zb->zb_psize_histogram[BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT]++;
+
+ zb->zb_gangs += BP_COUNT_GANG(bp);
+
+ switch (BP_GET_NDVAS(bp)) {
+ case 2:
+ if (DVA_GET_VDEV(&bp->blk_dva[0]) ==
+ DVA_GET_VDEV(&bp->blk_dva[1]))
+ zb->zb_ditto_samevdev++;
+ break;
+ case 3:
+ equal = (DVA_GET_VDEV(&bp->blk_dva[0]) ==
+ DVA_GET_VDEV(&bp->blk_dva[1])) +
+ (DVA_GET_VDEV(&bp->blk_dva[0]) ==
+ DVA_GET_VDEV(&bp->blk_dva[2])) +
+ (DVA_GET_VDEV(&bp->blk_dva[1]) ==
+ DVA_GET_VDEV(&bp->blk_dva[2]));
+ if (equal != 0)
+ zb->zb_ditto_samevdev++;
+ break;
+ }
+
}
if (BP_IS_EMBEDDED(bp)) {
@@ -2685,6 +2709,8 @@ dump_block_stats(spa_t *spa)
(void) printf("\n");
(void) printf("\tbp count: %10llu\n",
(u_longlong_t)tzb->zb_count);
+ (void) printf("\tganged count: %10llu\n",
+ (longlong_t)tzb->zb_gangs);
(void) printf("\tbp logical: %10llu avg: %6llu\n",
(u_longlong_t)tzb->zb_lsize,
(u_longlong_t)(tzb->zb_lsize / tzb->zb_count));
@@ -2723,6 +2749,11 @@ dump_block_stats(spa_t *spa)
}
}
+ if (tzb->zb_ditto_samevdev != 0) {
+ (void) printf("\tDittoed blocks on same vdev: %llu\n",
+ (longlong_t)tzb->zb_ditto_samevdev);
+ }
+
if (dump_opt['b'] >= 2) {
int l, t, level;
(void) printf("\nBlocks\tLSIZE\tPSIZE\tASIZE"
@@ -2730,7 +2761,7 @@ dump_block_stats(spa_t *spa)
for (t = 0; t <= ZDB_OT_TOTAL; t++) {
char csize[32], lsize[32], psize[32], asize[32];
- char avg[32];
+ char avg[32], gang[32];
char *typename;
if (t < DMU_OT_NUMTYPES)
@@ -2771,6 +2802,7 @@ dump_block_stats(spa_t *spa)
zdb_nicenum(zb->zb_psize, psize);
zdb_nicenum(zb->zb_asize, asize);
zdb_nicenum(zb->zb_asize / zb->zb_count, avg);
+ zdb_nicenum(zb->zb_gangs, gang);
(void) printf("%6s\t%5s\t%5s\t%5s\t%5s"
"\t%5.2f\t%6.2f\t",
@@ -2784,6 +2816,11 @@ dump_block_stats(spa_t *spa)
(void) printf(" L%d %s\n",
level, typename);
+ if (dump_opt['b'] >= 3 && zb->zb_gangs > 0) {
+ (void) printf("\t number of ganged "
+ "blocks: %s\n", gang);
+ }
+
if (dump_opt['b'] >= 4) {
(void) printf("psize "
"(in 512-byte sectors): "
diff --git a/include/sys/zap.h b/include/sys/zap.h
index fbd513098..bc15237bf 100644
--- a/include/sys/zap.h
+++ b/include/sys/zap.h
@@ -20,7 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
#ifndef _SYS_ZAP_H
@@ -381,11 +381,6 @@ void zap_cursor_advance(zap_cursor_t *zc);
uint64_t zap_cursor_serialize(zap_cursor_t *zc);
/*
- * Advance the cursor to the attribute having the given key.
- */
-int zap_cursor_move_to_key(zap_cursor_t *zc, const char *name, matchtype_t mt);
-
-/*
* Initialize a zap cursor pointing to the position recorded by
* zap_cursor_serialize (in the "serialized" argument). You can also
* use a "serialized" argument of 0 to start at the beginning of the
diff --git a/include/sys/zap_impl.h b/include/sys/zap_impl.h
index 028018a16..528402f79 100644
--- a/include/sys/zap_impl.h
+++ b/include/sys/zap_impl.h
@@ -230,7 +230,6 @@ int fzap_add_cd(zap_name_t *zn,
uint64_t integer_size, uint64_t num_integers,
const void *val, uint32_t cd, dmu_tx_t *tx);
void fzap_upgrade(zap_t *zap, dmu_tx_t *tx, zap_flags_t flags);
-int fzap_cursor_move_to_key(zap_cursor_t *zc, zap_name_t *zn);
#ifdef __cplusplus
}
diff --git a/module/zfs/zap.c b/module/zfs/zap.c
index fa2dfc7d5..c5ea392b6 100644
--- a/module/zfs/zap.c
+++ b/module/zfs/zap.c
@@ -1251,31 +1251,6 @@ zap_stats_ptrtbl(zap_t *zap, uint64_t *tbl, int len, zap_stats_t *zs)
}
}
-int
-fzap_cursor_move_to_key(zap_cursor_t *zc, zap_name_t *zn)
-{
- int err;
- zap_leaf_t *l;
- zap_entry_handle_t zeh;
-
- if (zn->zn_key_orig_numints * zn->zn_key_intlen > ZAP_MAXNAMELEN)
- return (SET_ERROR(ENAMETOOLONG));
-
- err = zap_deref_leaf(zc->zc_zap, zn->zn_hash, NULL, RW_READER, &l);
- if (err != 0)
- return (err);
-
- err = zap_leaf_lookup(l, zn, &zeh);
- if (err == 0) {
- zc->zc_leaf = l;
- zc->zc_hash = zeh.zeh_hash;
- zc->zc_cd = zeh.zeh_cd;
- }
-
- rw_exit(&l->l_rwlock);
- return (err);
-}
-
void
fzap_get_stats(zap_t *zap, zap_stats_t *zs)
{
diff --git a/module/zfs/zap_micro.c b/module/zfs/zap_micro.c
index 256bc8de9..5af98c2bc 100644
--- a/module/zfs/zap_micro.c
+++ b/module/zfs/zap_micro.c
@@ -1318,46 +1318,6 @@ zap_cursor_advance(zap_cursor_t *zc)
}
int
-zap_cursor_move_to_key(zap_cursor_t *zc, const char *name, matchtype_t mt)
-{
- int err = 0;
- mzap_ent_t *mze;
- zap_name_t *zn;
-
- if (zc->zc_zap == NULL) {
- err = zap_lockdir(zc->zc_objset, zc->zc_zapobj, NULL,
- RW_READER, TRUE, FALSE, &zc->zc_zap);
- if (err)
- return (err);
- } else {
- rw_enter(&zc->zc_zap->zap_rwlock, RW_READER);
- }
-
- zn = zap_name_alloc(zc->zc_zap, name, mt);
- if (zn == NULL) {
- rw_exit(&zc->zc_zap->zap_rwlock);
- return (SET_ERROR(ENOTSUP));
- }
-
- if (!zc->zc_zap->zap_ismicro) {
- err = fzap_cursor_move_to_key(zc, zn);
- } else {
- mze = mze_find(zn);
- if (mze == NULL) {
- err = SET_ERROR(ENOENT);
- goto out;
- }
- zc->zc_hash = mze->mze_hash;
- zc->zc_cd = mze->mze_cd;
- }
-
-out:
- zap_name_free(zn);
- rw_exit(&zc->zc_zap->zap_rwlock);
- return (err);
-}
-
-int
zap_get_stats(objset_t *os, uint64_t zapobj, zap_stats_t *zs)
{
int err;
@@ -1494,7 +1454,6 @@ EXPORT_SYMBOL(zap_cursor_fini);
EXPORT_SYMBOL(zap_cursor_retrieve);
EXPORT_SYMBOL(zap_cursor_advance);
EXPORT_SYMBOL(zap_cursor_serialize);
-EXPORT_SYMBOL(zap_cursor_move_to_key);
EXPORT_SYMBOL(zap_cursor_init_serialized);
EXPORT_SYMBOL(zap_get_stats);
#endif