cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruenba@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 3/8] gfs2: Clean up glock work enqueuing
Date: Thu,  1 Jun 2017 17:43:38 +0200	[thread overview]
Message-ID: <1496331818-16134-1-git-send-email-agruenba@redhat.com> (raw)
In-Reply-To: <dfd58f62-74a7-0d6f-fa9b-6e3959125177@redhat.com>

On Thu, Jun 1, 2017 at 5:21 PM, Steven Whitehouse <swhiteho@redhat.com> wrote:
> On 31/05/17 16:03, Andreas Gruenbacher wrote:
> Looks generally like a nice clean up, but...
> [...]
>> @@ -623,16 +643,25 @@ static void glock_work_func(struct work_struct *work)
>>                 }
>>         }
>>         run_queue(gl, 0);
>> -       spin_unlock(&gl->gl_lockref.lock);
>> -       if (!delay)
>> -               gfs2_glock_put(gl);
>> -       else {
>> +       if (delay) {
>> +               /* Keep one glock reference for the work we requeue. */
>> +               drop_refs--;
>>                 if (gl->gl_name.ln_type != LM_TYPE_INODE)
>>                         delay = 0;
>> -               if (queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0)
>> -                       gfs2_glock_put(gl);
>> +               __gfs2_glock_queue_work(gl, delay);
>> +       }
>> +       if (drop_refs > 1) {
>> +               gl->gl_lockref.count -= drop_refs - 1;
>> +               drop_refs = 1;
>>         }
>
> This looks very confusing... is there no cleaner way to write this? After
> all the effort of cleaning up the queuing of the work, this could also do
> with tidying up too. Otherwise I think the patch looks good,

You mean like below, removing the refcount optimization?

Andreas

---
 fs/gfs2/glock.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 51ec6de..f833f1b 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -732,10 +732,6 @@ static void glock_work_func(struct work_struct *work)
 			delay = 0;
 		__gfs2_glock_queue_work(gl, delay);
 	}
-	if (drop_refs > 1) {
-		gl->gl_lockref.count -= drop_refs - 1;
-		drop_refs = 1;
-	}
 	spin_unlock(&gl->gl_lockref.lock);
 
 	/*
@@ -743,7 +739,7 @@ static void glock_work_func(struct work_struct *work)
 	 * the lockref spinlock: this allows tasks to safely drop glock
 	 * references under that spinlock (see __gfs2_glock_queue_work).
 	 */
-	if (drop_refs)
+	while (drop_refs--)
 		gfs2_glock_put(gl);
 }
 
-- 
2.7.4



  reply	other threads:[~2017-06-01 15:43 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31 15:03 [Cluster-devel] [PATCH 0/8] GFS2 shrinker deadlock Andreas Gruenbacher
2017-05-31 15:03 ` [Cluster-devel] [PATCH 1/8] gfs2: Get rid of flush_delayed_work in gfs2_evict_inode Andreas Gruenbacher
2017-06-01 15:13   ` Steven Whitehouse
2017-05-31 15:03 ` [Cluster-devel] [PATCH 2/8] gfs2: Protect gl->gl_object by spin lock Andreas Gruenbacher
2017-06-01 15:16   ` Steven Whitehouse
2017-05-31 15:03 ` [Cluster-devel] [PATCH 3/8] gfs2: Clean up glock work enqueuing Andreas Gruenbacher
2017-06-01 15:21   ` Steven Whitehouse
2017-06-01 15:43     ` Andreas Gruenbacher [this message]
2017-06-01 15:46       ` Steven Whitehouse
2017-06-02  9:19         ` Andreas Gruenbacher
2017-06-02  9:29           ` Steven Whitehouse
2017-05-31 15:03 ` [Cluster-devel] [PATCH 4/8] gfs2: Always check block type in gfs2_evict_inode Andreas Gruenbacher
2017-05-31 15:03 ` [Cluster-devel] [PATCH 5/8] gfs2: gfs2_glock_get: Wait on freeing glocks Andreas Gruenbacher
2017-05-31 15:03 ` [Cluster-devel] [PATCH 6/8] gfs2: Get rid of gfs2_set_nlink Andreas Gruenbacher
2017-05-31 15:03 ` [Cluster-devel] [PATCH 7/8] gfs2: gfs2_evict_inode: Put glocks asynchronously Andreas Gruenbacher
2017-06-01 10:51   ` Andreas Gruenbacher
2017-06-01 15:37   ` Steven Whitehouse
2017-06-02 13:57     ` Andreas Gruenbacher
2017-05-31 15:03 ` [Cluster-devel] [PATCH 8/8] gfs2: Warn when not deleting inodes under memory pressure Andreas Gruenbacher
2017-06-01 15:39   ` Steven Whitehouse

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=1496331818-16134-1-git-send-email-agruenba@redhat.com \
    --to=agruenba@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).