cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH 1/2] fsck.gfs2: Improve reporting of pass timings
@ 2014-11-13 14:19 Andrew Price
  2014-11-13 14:19 ` [Cluster-devel] [PATCH 2/2] mkfs.gfs2: Revert default resource group size Andrew Price
  2014-11-14 16:44 ` [Cluster-devel] [PATCH 1/2] fsck.gfs2: Improve reporting of pass timings Bob Peterson
  0 siblings, 2 replies; 4+ messages in thread
From: Andrew Price @ 2014-11-13 14:19 UTC (permalink / raw)
  To: cluster-devel.redhat.com

The days value is not currently reported in the pass timings but the
hours value is still reported modulo 24.  Drop the use of gmtime(3) as
it's more appropriate for calendar time operations than elapsed time,
and add a simple duration reporting function which matches the existing
output format.

Signed-off-by: Andrew Price <anprice@redhat.com>
---
 gfs2/fsck/main.c | 48 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 34 insertions(+), 14 deletions(-)

diff --git a/gfs2/fsck/main.c b/gfs2/fsck/main.c
index b25d802..a4af25d 100644
--- a/gfs2/fsck/main.c
+++ b/gfs2/fsck/main.c
@@ -246,18 +246,46 @@ static const struct fsck_pass passes[] = {
 	{ .name = NULL, }
 };
 
+static void print_pass_duration(const char *name, struct timeval *start)
+{
+	char duration[17] = ""; /* strlen("XXdXXhXXmXX.XXXs") + 1 */
+	struct timeval end, diff;
+	unsigned d, h, m, s;
+	char *p = duration;
+
+	gettimeofday(&end, NULL);
+	timersub(&end, start, &diff);
+
+	s = diff.tv_sec % 60;
+	diff.tv_sec /= 60;
+	m = diff.tv_sec % 60;
+	diff.tv_sec /= 60;
+	h = diff.tv_sec % 24;
+	d = diff.tv_sec / 24;
+
+	if (d)
+		p += snprintf(p, 4, "%ud", d > 99 ? 99U : d);
+	if (h)
+		p += snprintf(p, 4, "%uh", h);
+	if (m)
+		p += snprintf(p, 4, "%um", m);
+
+	snprintf(p, 8, "%u.%03lus", s, diff.tv_usec / 1000);
+	log_notice(_("%s completed in %s\n"), name, duration);
+}
+
 static int fsck_pass(const struct fsck_pass *p, struct gfs2_sbd *sdp)
 {
 	int ret;
-	struct	timeval	before, after, diff;
-	time_t runtime;
-	struct tm *run_tm;
+	struct timeval timer;
 
 	if (fsck_abort)
 		return FSCK_CANCELED;
 	pass = p->name;
+
 	log_notice( _("Starting %s\n"), p->name);
-	gettimeofday(&before, 0);
+	gettimeofday(&timer, NULL);
+
 	ret = p->f(sdp);
 	if (ret)
 		exit(ret);
@@ -266,16 +294,8 @@ static int fsck_pass(const struct fsck_pass *p, struct gfs2_sbd *sdp)
 		log_notice( _("%s interrupted   \n"), p->name);
 		return FSCK_CANCELED;
 	}
-	gettimeofday(&after, 0);
-	timersub(&after, &before, &diff);
-	runtime = (time_t)diff.tv_sec;
-	run_tm = gmtime(&runtime);
-	log_notice( _("%s completed in "), p->name);
-	if (run_tm->tm_hour)
-		log_notice("%dh", run_tm->tm_hour);
-	if (run_tm->tm_min)
-		log_notice("%dm", run_tm->tm_min);
-	log_notice("%d.%03lds      \n", run_tm->tm_sec, diff.tv_usec / 1000);
+
+	print_pass_duration(p->name, &timer);
 	return 0;
 }
 
-- 
1.9.3



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Cluster-devel] [PATCH 2/2] mkfs.gfs2: Revert default resource group size
  2014-11-13 14:19 [Cluster-devel] [PATCH 1/2] fsck.gfs2: Improve reporting of pass timings Andrew Price
@ 2014-11-13 14:19 ` Andrew Price
  2014-11-14 16:45   ` Bob Peterson
  2014-11-14 16:44 ` [Cluster-devel] [PATCH 1/2] fsck.gfs2: Improve reporting of pass timings Bob Peterson
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Price @ 2014-11-13 14:19 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Choose a more performant resource group size than the maximum by default
until gfs2 is more tuned for the larger number of bitmap blocks required
for 2GB resource groups.

Signed-off-by: Andrew Price <anprice@redhat.com>
---
 gfs2/mkfs/main_mkfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index b6353dd..2590ec8 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -147,7 +147,7 @@ static void opts_init(struct mkfs_opts *opts)
 	opts->bsize = GFS2_DEFAULT_BSIZE;
 	opts->jsize = GFS2_DEFAULT_JSIZE;
 	opts->qcsize = GFS2_DEFAULT_QCSIZE;
-	opts->rgsize = GFS2_MAX_RGSIZE;
+	opts->rgsize = GFS2_DEFAULT_RGSIZE;
 	opts->lockproto = "lock_dlm";
 	opts->locktable = "";
 	opts->confirm = 1;
-- 
1.9.3



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Cluster-devel] [PATCH 1/2] fsck.gfs2: Improve reporting of pass timings
  2014-11-13 14:19 [Cluster-devel] [PATCH 1/2] fsck.gfs2: Improve reporting of pass timings Andrew Price
  2014-11-13 14:19 ` [Cluster-devel] [PATCH 2/2] mkfs.gfs2: Revert default resource group size Andrew Price
@ 2014-11-14 16:44 ` Bob Peterson
  1 sibling, 0 replies; 4+ messages in thread
From: Bob Peterson @ 2014-11-14 16:44 UTC (permalink / raw)
  To: cluster-devel.redhat.com

----- Original Message -----
> The days value is not currently reported in the pass timings but the
> hours value is still reported modulo 24.  Drop the use of gmtime(3) as
> it's more appropriate for calendar time operations than elapsed time,
> and add a simple duration reporting function which matches the existing
> output format.
> 
> Signed-off-by: Andrew Price <anprice@redhat.com>
> ---

ACK

Bob Peterson
Red Hat File Systems



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Cluster-devel] [PATCH 2/2] mkfs.gfs2: Revert default resource group size
  2014-11-13 14:19 ` [Cluster-devel] [PATCH 2/2] mkfs.gfs2: Revert default resource group size Andrew Price
@ 2014-11-14 16:45   ` Bob Peterson
  0 siblings, 0 replies; 4+ messages in thread
From: Bob Peterson @ 2014-11-14 16:45 UTC (permalink / raw)
  To: cluster-devel.redhat.com

----- Original Message -----
> Choose a more performant resource group size than the maximum by default
> until gfs2 is more tuned for the larger number of bitmap blocks required
> for 2GB resource groups.
> 
> Signed-off-by: Andrew Price <anprice@redhat.com>
> ---
>  gfs2/mkfs/main_mkfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
> index b6353dd..2590ec8 100644
> --- a/gfs2/mkfs/main_mkfs.c
> +++ b/gfs2/mkfs/main_mkfs.c
> @@ -147,7 +147,7 @@ static void opts_init(struct mkfs_opts *opts)
>  	opts->bsize = GFS2_DEFAULT_BSIZE;
>  	opts->jsize = GFS2_DEFAULT_JSIZE;
>  	opts->qcsize = GFS2_DEFAULT_QCSIZE;
> -	opts->rgsize = GFS2_MAX_RGSIZE;
> +	opts->rgsize = GFS2_DEFAULT_RGSIZE;
>  	opts->lockproto = "lock_dlm";
>  	opts->locktable = "";
>  	opts->confirm = 1;
> --
> 1.9.3
> 

ACK

Bob Peterson
Red Hat File Systems



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-11-14 16:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-13 14:19 [Cluster-devel] [PATCH 1/2] fsck.gfs2: Improve reporting of pass timings Andrew Price
2014-11-13 14:19 ` [Cluster-devel] [PATCH 2/2] mkfs.gfs2: Revert default resource group size Andrew Price
2014-11-14 16:45   ` Bob Peterson
2014-11-14 16:44 ` [Cluster-devel] [PATCH 1/2] fsck.gfs2: Improve reporting of pass timings Bob Peterson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).