Skip to content

Commit 20128a0

Browse files
grwilsonChristopher Siden
authored andcommitted
3561 arc_meta_limit should be exposed via kstats
3116 zpool reguid may log negative guids to internal SPA history Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Adam Leventhal <ahl@delphix.com> Reviewed by: Christopher Siden <christopher.siden@delphix.com> Reviewed by: Gordon Ross <gordon.ross@nexenta.com> Approved by: Garrett D'Amore <garrett@damore.org>
1 parent c3a6601 commit 20128a0

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

usr/src/cmd/mdb/common/modules/zfs/zfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,12 +886,12 @@ arc_print(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
886886

887887
static const char *bytestats[] = {
888888
"p", "c", "c_min", "c_max", "size", "duplicate_buffers_size",
889+
"arc_meta_used", "arc_meta_limit", "arc_meta_max",
889890
NULL
890891
};
891892

892893
static const char *extras[] = {
893894
"arc_no_grow", "arc_tempreserve",
894-
"arc_meta_used", "arc_meta_limit", "arc_meta_max",
895895
NULL
896896
};
897897

usr/src/uts/common/fs/zfs/arc.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,9 @@ typedef struct arc_stats {
294294
kstat_named_t arcstat_duplicate_buffers;
295295
kstat_named_t arcstat_duplicate_buffers_size;
296296
kstat_named_t arcstat_duplicate_reads;
297+
kstat_named_t arcstat_meta_used;
298+
kstat_named_t arcstat_meta_limit;
299+
kstat_named_t arcstat_meta_max;
297300
} arc_stats_t;
298301

299302
static arc_stats_t arc_stats = {
@@ -352,7 +355,10 @@ static arc_stats_t arc_stats = {
352355
{ "memory_throttle_count", KSTAT_DATA_UINT64 },
353356
{ "duplicate_buffers", KSTAT_DATA_UINT64 },
354357
{ "duplicate_buffers_size", KSTAT_DATA_UINT64 },
355-
{ "duplicate_reads", KSTAT_DATA_UINT64 }
358+
{ "duplicate_reads", KSTAT_DATA_UINT64 },
359+
{ "arc_meta_used", KSTAT_DATA_UINT64 },
360+
{ "arc_meta_limit", KSTAT_DATA_UINT64 },
361+
{ "arc_meta_max", KSTAT_DATA_UINT64 }
356362
};
357363

358364
#define ARCSTAT(stat) (arc_stats.stat.value.ui64)
@@ -414,13 +420,13 @@ static arc_state_t *arc_l2c_only;
414420
#define arc_c ARCSTAT(arcstat_c) /* target size of cache */
415421
#define arc_c_min ARCSTAT(arcstat_c_min) /* min target cache size */
416422
#define arc_c_max ARCSTAT(arcstat_c_max) /* max target cache size */
423+
#define arc_meta_limit ARCSTAT(arcstat_meta_limit) /* max size for metadata */
424+
#define arc_meta_used ARCSTAT(arcstat_meta_used) /* size of metadata */
425+
#define arc_meta_max ARCSTAT(arcstat_meta_max) /* max size of metadata */
417426

418427
static int arc_no_grow; /* Don't try to grow cache size */
419428
static uint64_t arc_tempreserve;
420429
static uint64_t arc_loaned_bytes;
421-
static uint64_t arc_meta_used;
422-
static uint64_t arc_meta_limit;
423-
static uint64_t arc_meta_max = 0;
424430

425431
typedef struct l2arc_buf_hdr l2arc_buf_hdr_t;
426432

@@ -1218,7 +1224,7 @@ arc_space_consume(uint64_t space, arc_space_type_t type)
12181224
break;
12191225
}
12201226

1221-
atomic_add_64(&arc_meta_used, space);
1227+
ARCSTAT_INCR(arcstat_meta_used, space);
12221228
atomic_add_64(&arc_size, space);
12231229
}
12241230

@@ -1245,7 +1251,7 @@ arc_space_return(uint64_t space, arc_space_type_t type)
12451251
ASSERT(arc_meta_used >= space);
12461252
if (arc_meta_max < arc_meta_used)
12471253
arc_meta_max = arc_meta_used;
1248-
atomic_add_64(&arc_meta_used, -space);
1254+
ARCSTAT_INCR(arcstat_meta_used, -space);
12491255
ASSERT(arc_size >= space);
12501256
atomic_add_64(&arc_size, -space);
12511257
}

usr/src/uts/common/fs/zfs/spa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ spa_change_guid_sync(void *arg1, void *arg2, dmu_tx_t *tx)
715715
vdev_config_dirty(rvd);
716716
spa_config_exit(spa, SCL_STATE, FTAG);
717717

718-
spa_history_log_internal(spa, "guid change", tx, "old=%lld new=%lld",
718+
spa_history_log_internal(spa, "guid change", tx, "old=%llu new=%llu",
719719
oldguid, *newguid);
720720
}
721721

0 commit comments

Comments
 (0)