cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [GFS2 PATCH] GFS2: Wake up io waiters whenever a flush is done
       [not found] <30492855.8619529.1483759129940.JavaMail.zimbra@redhat.com>
@ 2017-01-07  3:19 ` Bob Peterson
  2017-01-09  9:28   ` Steven Whitehouse
  0 siblings, 1 reply; 2+ messages in thread
From: Bob Peterson @ 2017-01-07  3:19 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

Before this patch, if a process called function gfs2_log_reserve to
reserve some journal blocks, but the journal not enough blocks were
free, it would call io_schedule. However, in the log flush daemon,
it woke up the waiters only if an gfs2_ail_flush was no longer
required. This resulted in situations where processes would wait
forever because the number of blocks required was so high that it
pushed the journal into a perpetual state of flush being required.

This patch changes the logd daemon so that it wakes up io waiters
every time the log is actually flushed.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 4df349c..5028a9d 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -918,12 +918,15 @@ int gfs2_logd(void *data)
 	struct gfs2_sbd *sdp = data;
 	unsigned long t = 1;
 	DEFINE_WAIT(wait);
+	bool did_flush;
 
 	while (!kthread_should_stop()) {
 
+		did_flush = false;
 		if (gfs2_jrnl_flush_reqd(sdp) || t == 0) {
 			gfs2_ail1_empty(sdp);
 			gfs2_log_flush(sdp, NULL, NORMAL_FLUSH);
+			did_flush = true;
 		}
 
 		if (gfs2_ail_flush_reqd(sdp)) {
@@ -931,9 +934,10 @@ int gfs2_logd(void *data)
 			gfs2_ail1_wait(sdp);
 			gfs2_ail1_empty(sdp);
 			gfs2_log_flush(sdp, NULL, NORMAL_FLUSH);
+			did_flush = true;
 		}
 
-		if (!gfs2_ail_flush_reqd(sdp))
+		if (!gfs2_ail_flush_reqd(sdp) || did_flush)
 			wake_up(&sdp->sd_log_waitq);
 
 		t = gfs2_tune_get(sdp, gt_logd_secs) * HZ;



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

* [Cluster-devel] [GFS2 PATCH] GFS2: Wake up io waiters whenever a flush is done
  2017-01-07  3:19 ` [Cluster-devel] [GFS2 PATCH] GFS2: Wake up io waiters whenever a flush is done Bob Peterson
@ 2017-01-09  9:28   ` Steven Whitehouse
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Whitehouse @ 2017-01-09  9:28 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

Acked-by: Steven Whitehouse <swhiteho@redhat.com>

Steve.

On 07/01/17 03:19, Bob Peterson wrote:
> Hi,
>
> Before this patch, if a process called function gfs2_log_reserve to
> reserve some journal blocks, but the journal not enough blocks were
> free, it would call io_schedule. However, in the log flush daemon,
> it woke up the waiters only if an gfs2_ail_flush was no longer
> required. This resulted in situations where processes would wait
> forever because the number of blocks required was so high that it
> pushed the journal into a perpetual state of flush being required.
>
> This patch changes the logd daemon so that it wakes up io waiters
> every time the log is actually flushed.
>
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
> ---
> diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
> index 4df349c..5028a9d 100644
> --- a/fs/gfs2/log.c
> +++ b/fs/gfs2/log.c
> @@ -918,12 +918,15 @@ int gfs2_logd(void *data)
>   	struct gfs2_sbd *sdp = data;
>   	unsigned long t = 1;
>   	DEFINE_WAIT(wait);
> +	bool did_flush;
>   
>   	while (!kthread_should_stop()) {
>   
> +		did_flush = false;
>   		if (gfs2_jrnl_flush_reqd(sdp) || t == 0) {
>   			gfs2_ail1_empty(sdp);
>   			gfs2_log_flush(sdp, NULL, NORMAL_FLUSH);
> +			did_flush = true;
>   		}
>   
>   		if (gfs2_ail_flush_reqd(sdp)) {
> @@ -931,9 +934,10 @@ int gfs2_logd(void *data)
>   			gfs2_ail1_wait(sdp);
>   			gfs2_ail1_empty(sdp);
>   			gfs2_log_flush(sdp, NULL, NORMAL_FLUSH);
> +			did_flush = true;
>   		}
>   
> -		if (!gfs2_ail_flush_reqd(sdp))
> +		if (!gfs2_ail_flush_reqd(sdp) || did_flush)
>   			wake_up(&sdp->sd_log_waitq);
>   
>   		t = gfs2_tune_get(sdp, gt_logd_secs) * HZ;
>



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

end of thread, other threads:[~2017-01-09  9:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <30492855.8619529.1483759129940.JavaMail.zimbra@redhat.com>
2017-01-07  3:19 ` [Cluster-devel] [GFS2 PATCH] GFS2: Wake up io waiters whenever a flush is done Bob Peterson
2017-01-09  9:28   ` Steven Whitehouse

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).