summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Ling <Lin.Ling@Sun.COM>2010-02-01 16:10:08 -0800
committerLin Ling <Lin.Ling@Sun.COM>2010-02-01 16:10:08 -0800
commitfb5dd802b9c6917629172c7c7fade7ee9d39cd71 (patch)
treeb504a9c8689a6044a79802fe5e355785451786da
parent59c5abfe9386b29302c15715915e36bfd1969cf1 (diff)
downloadillumos-joyent-fb5dd802b9c6917629172c7c7fade7ee9d39cd71.tar.gz
6918925 txg sync lasts a fraction of zfs_txg_synctime
-rw-r--r--usr/src/uts/common/fs/zfs/dsl_pool.c12
-rw-r--r--usr/src/uts/common/fs/zfs/sys/dsl_pool.h4
2 files changed, 10 insertions, 6 deletions
diff --git a/usr/src/uts/common/fs/zfs/dsl_pool.c b/usr/src/uts/common/fs/zfs/dsl_pool.c
index 858f446f52..a4ca02e54f 100644
--- a/usr/src/uts/common/fs/zfs/dsl_pool.c
+++ b/usr/src/uts/common/fs/zfs/dsl_pool.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -431,10 +431,14 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t txg)
* amount of write traffic allowed into each transaction group.
* Weight the throughput calculation towards the current value:
* thru = 3/4 old_thru + 1/4 new_thru
+ *
+ * Note: write_time is in nanosecs, so write_time/MICROSEC
+ * yields millisecs
*/
ASSERT(zfs_write_limit_min > 0);
- if (data_written > zfs_write_limit_min / 8 && write_time > 0) {
- uint64_t throughput = (data_written * NANOSEC) / write_time;
+ if (data_written > zfs_write_limit_min / 8 && write_time > MICROSEC) {
+ uint64_t throughput = data_written / (write_time / MICROSEC);
+
if (dp->dp_throughput)
dp->dp_throughput = throughput / 4 +
3 * dp->dp_throughput / 4;
@@ -442,7 +446,7 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t txg)
dp->dp_throughput = throughput;
dp->dp_write_limit = MIN(zfs_write_limit_inflated,
MAX(zfs_write_limit_min,
- dp->dp_throughput * zfs_txg_synctime_ms / MILLISEC));
+ dp->dp_throughput * zfs_txg_synctime_ms));
}
}
diff --git a/usr/src/uts/common/fs/zfs/sys/dsl_pool.h b/usr/src/uts/common/fs/zfs/sys/dsl_pool.h
index bfe94209fb..4e49d212a3 100644
--- a/usr/src/uts/common/fs/zfs/sys/dsl_pool.h
+++ b/usr/src/uts/common/fs/zfs/sys/dsl_pool.h
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -84,7 +84,7 @@ typedef struct dsl_pool {
blkptr_t dp_meta_rootbp;
list_t dp_synced_datasets;
hrtime_t dp_read_overhead;
- uint64_t dp_throughput;
+ uint64_t dp_throughput; /* bytes per millisec */
uint64_t dp_write_limit;
uint64_t dp_tmp_userrefs_obj;