ahrens commented on this pull request.
> @@ -3861,6 +3892,52 @@ zpool_do_scrub(int argc, char **argv)
return (for_each_pool(argc, argv, B_TRUE, NULL, scrub_callback, &cb));
}
+/*
+ * zpool trim [-s|-r <rate>] <pool> ...
+ *
+ * -s Stop. Stops any in-progress trim.
+ * -r <rate> Sets the TRIM rate.
perhaps document the units: bytes/second?
> @@ -3983,6 +4060,59 @@ print_scan_status(pool_scan_stat_t *ps)
}
static void
+print_trim_status(uint64_t trim_prog, uint64_t total_size, uint64_t rate,
+ uint64_t start_time_u64, uint64_t end_time_u64)
+{
+ time_t start_time = start_time_u64, end_time = end_time_u64;
+ char *buf;
+
+ assert(trim_prog <= total_size);
+ if (trim_prog != 0 && trim_prog != total_size) {
+ buf = ctime(&start_time);
+ buf[strlen(buf) - 1] = '\0'; /* strip trailing newline */
+ if (rate != 0) {
+ char rate_str[32];
+ zfs_nicenum(rate, rate_str, sizeof (rate_str));
+ (void) printf(" trim: %.02f%%\tstarted: %s\t"
+ "(rate: %s/s)\n", (((double)trim_prog) /
maybe instead of `rate`, `rate limit:`? Since this is not necessarily the rate
that we are trimming, it's just the limit of how fast we can trim (but we could
go slower).
> + time_t start_time = start_time_u64, end_time = end_time_u64;
+ char *buf;
+
+ assert(trim_prog <= total_size);
+ if (trim_prog != 0 && trim_prog != total_size) {
+ buf = ctime(&start_time);
+ buf[strlen(buf) - 1] = '\0'; /* strip trailing newline */
+ if (rate != 0) {
+ char rate_str[32];
+ zfs_nicenum(rate, rate_str, sizeof (rate_str));
+ (void) printf(" trim: %.02f%%\tstarted: %s\t"
+ "(rate: %s/s)\n", (((double)trim_prog) /
+ total_size) * 100, buf, rate_str);
+ } else {
+ (void) printf(" trim: %.02f%%\tstarted: %s\t"
+ "(rate: max)\n", (((double)trim_prog) /
`rate limit: none`?
> @@ -3983,6 +4060,59 @@ print_scan_status(pool_scan_stat_t *ps)
}
static void
+print_trim_status(uint64_t trim_prog, uint64_t total_size, uint64_t rate,
+ uint64_t start_time_u64, uint64_t end_time_u64)
this is only dealing with manual trim, right?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/172#pullrequestreview-38510071
------------------------------------------
openzfs-developer
Archives: https://openzfs.topicbox.com/groups/developer/
Powered by Topicbox: https://topicbox.com