cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [GFS2 PATCH 5/9] gfs2: Keep transactions on ail1 list until after issuing revokes
Date: Fri, 15 Feb 2019 11:56:53 +0000	[thread overview]
Message-ID: <24111c35-dcdb-1671-9c17-544f45c0ad6d@redhat.com> (raw)
In-Reply-To: <20190213152130.8047-6-rpeterso@redhat.com>

Hi,

On 13/02/2019 15:21, Bob Peterson wrote:
> Before this patch, function gfs2_write_revokes would call function
> gfs2_ail1_empty, then run the ail1 list, issuing revokes. But
> gfs2_ail1_empty can move transactions to the ail2 list, and thus,
> their revokes were never issued. This patch adds a new parameter to
> gfs2_ail1_empty that allows the transactions to remain on the ail1
> list until it can issue revokes for them. Then, if they have no more
> buffers, they're moved to the ail2 list after the revokes are added.
>
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>

Why would we need to do this?

Steve.

> ---
>   fs/gfs2/log.c | 30 ++++++++++++++++++------------
>   1 file changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
> index 81550038ace3..0d0dec3231c9 100644
> --- a/fs/gfs2/log.c
> +++ b/fs/gfs2/log.c
> @@ -217,11 +217,12 @@ static void gfs2_ail1_empty_one(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
>   /**
>    * gfs2_ail1_empty - Try to empty the ail1 lists
>    * @sdp: The superblock
> + * @move_empty_to_ail2: 1 if transaction to be moved to ail2 when empty
>    *
>    * Tries to empty the ail1 lists, starting with the oldest first
>    */
>   
> -static int gfs2_ail1_empty(struct gfs2_sbd *sdp)
> +static int gfs2_ail1_empty(struct gfs2_sbd *sdp, bool move_empty_to_ail2)
>   {
>   	struct gfs2_trans *tr, *s;
>   	int oldest_tr = 1;
> @@ -230,10 +231,12 @@ static int gfs2_ail1_empty(struct gfs2_sbd *sdp)
>   	spin_lock(&sdp->sd_ail_lock);
>   	list_for_each_entry_safe_reverse(tr, s, &sdp->sd_ail1_list, tr_list) {
>   		gfs2_ail1_empty_one(sdp, tr);
> -		if (list_empty(&tr->tr_ail1_list) && oldest_tr)
> -			list_move(&tr->tr_list, &sdp->sd_ail2_list);
> -		else
> +		if (list_empty(&tr->tr_ail1_list) && oldest_tr) {
> +			if (move_empty_to_ail2)
> +				list_move(&tr->tr_list, &sdp->sd_ail2_list);
> +		} else {
>   			oldest_tr = 0;
> +		}
>   	}
>   	ret = list_empty(&sdp->sd_ail1_list);
>   	spin_unlock(&sdp->sd_ail_lock);
> @@ -609,12 +612,12 @@ void gfs2_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
>   
>   void gfs2_write_revokes(struct gfs2_sbd *sdp)
>   {
> -	struct gfs2_trans *tr;
> +	struct gfs2_trans *tr, *s;
>   	struct gfs2_bufdata *bd, *tmp;
>   	int have_revokes = 0;
>   	int max_revokes = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_log_descriptor)) / sizeof(u64);
>   
> -	gfs2_ail1_empty(sdp);
> +	gfs2_ail1_empty(sdp, false);
>   	spin_lock(&sdp->sd_ail_lock);
>   	list_for_each_entry_reverse(tr, &sdp->sd_ail1_list, tr_list) {
>   		list_for_each_entry(bd, &tr->tr_ail2_list, bd_ail_st_list) {
> @@ -640,17 +643,20 @@ void gfs2_write_revokes(struct gfs2_sbd *sdp)
>   	}
>   	gfs2_log_lock(sdp);
>   	spin_lock(&sdp->sd_ail_lock);
> -	list_for_each_entry_reverse(tr, &sdp->sd_ail1_list, tr_list) {
> +	list_for_each_entry_safe_reverse(tr, s, &sdp->sd_ail1_list, tr_list) {
>   		list_for_each_entry_safe(bd, tmp, &tr->tr_ail2_list, bd_ail_st_list) {
>   			if (max_revokes == 0)
> -				goto out_of_blocks;
> +				break;
>   			if (!list_empty(&bd->bd_list))
>   				continue;
>   			gfs2_add_revoke(sdp, bd);
>   			max_revokes--;
>   		}
> +		if (list_empty(&tr->tr_ail1_list))
> +			list_move(&tr->tr_list, &sdp->sd_ail2_list);
> +		if (max_revokes == 0)
> +			break;
>   	}
> -out_of_blocks:
>   	spin_unlock(&sdp->sd_ail_lock);
>   	gfs2_log_unlock(sdp);
>   
> @@ -842,7 +848,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)
>   			for (;;) {
>   				gfs2_ail1_start(sdp);
>   				gfs2_ail1_wait(sdp);
> -				if (gfs2_ail1_empty(sdp))
> +				if (gfs2_ail1_empty(sdp, true))
>   					break;
>   			}
>   			atomic_dec(&sdp->sd_log_blks_free); /* Adjust for unreserved buffer */
> @@ -1008,7 +1014,7 @@ int gfs2_logd(void *data)
>   
>   		did_flush = false;
>   		if (gfs2_jrnl_flush_reqd(sdp) || t == 0) {
> -			gfs2_ail1_empty(sdp);
> +			gfs2_ail1_empty(sdp, true);
>   			if (test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags))
>   				gfs2_log_flush(sdp, NULL,
>   					       GFS2_LOG_HEAD_FLUSH_NORMAL |
> @@ -1019,7 +1025,7 @@ int gfs2_logd(void *data)
>   		if (gfs2_ail_flush_reqd(sdp)) {
>   			gfs2_ail1_start(sdp);
>   			gfs2_ail1_wait(sdp);
> -			gfs2_ail1_empty(sdp);
> +			gfs2_ail1_empty(sdp, true);
>   			if (test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags))
>   				gfs2_log_flush(sdp, NULL,
>   					       GFS2_LOG_HEAD_FLUSH_NORMAL |



  reply	other threads:[~2019-02-15 11:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-13 15:21 [Cluster-devel] [GFS2 PATCH 0/9] GFS2: Withdraw corruption patches Bob Peterson
2019-02-13 15:21 ` [Cluster-devel] [GFS2 PATCH 1/9] gfs2: Introduce concept of a pending withdraw Bob Peterson
2019-02-15 11:37   ` Steven Whitehouse
2019-02-13 15:21 ` [Cluster-devel] [GFS2 PATCH 2/9] gfs2: Ignore recovery attempts if gfs2 has io error or is withdrawn Bob Peterson
2019-02-13 15:21 ` [Cluster-devel] [GFS2 PATCH 3/9] gfs2: Empty the ail for the glock when rgrps are invalidated Bob Peterson
2019-02-15 11:47   ` Steven Whitehouse
2019-02-13 15:21 ` [Cluster-devel] [GFS2 PATCH 4/9] gfs2: Force withdraw to replay journals and wait for it to finish Bob Peterson
2019-02-15 11:55   ` Steven Whitehouse
2019-02-13 15:21 ` [Cluster-devel] [GFS2 PATCH 5/9] gfs2: Keep transactions on ail1 list until after issuing revokes Bob Peterson
2019-02-15 11:56   ` Steven Whitehouse [this message]
2019-02-13 15:21 ` [Cluster-devel] [GFS2 PATCH 6/9] gfs2: Make secondary withdrawers wait for first withdrawer Bob Peterson
2019-02-13 15:21 ` [Cluster-devel] [GFS2 PATCH 7/9] gfs2: Check for log write errors and withdraw in rgrp_go_inval Bob Peterson
2019-02-13 15:21 ` [Cluster-devel] [GFS2 PATCH 8/9] gfs2: Do log_flush in gfs2_ail_empty_gl even if ail list is empty Bob Peterson
2019-02-15 12:01   ` Steven Whitehouse
2019-02-13 15:21 ` [Cluster-devel] [GFS2 PATCH 9/9] dlm: recover slot regardless of whether we still have a connection Bob Peterson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=24111c35-dcdb-1671-9c17-544f45c0ad6d@redhat.com \
    --to=swhiteho@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).