From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Gruenbacher Date: Mon, 20 Jan 2020 10:12:58 +0100 Subject: [Cluster-devel] [PATCH 04/11] gfs2: Turn gl_delete into a delayed work In-Reply-To: <20200120091305.24997-1-agruenba@redhat.com> References: <20200120091305.24997-1-agruenba@redhat.com> Message-ID: <20200120091305.24997-5-agruenba@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit We'll want to queue a delayed work in a future patch. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/glock.c | 5 +++-- fs/gfs2/glops.c | 3 ++- fs/gfs2/incore.h | 4 ++-- fs/gfs2/rgrp.c | 3 ++- fs/gfs2/super.c | 3 ++- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 3a9502af895b..e71f23ebb99b 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -698,7 +698,8 @@ bool gfs2_inode_already_deleted(struct gfs2_glock *gl, u64 generation) static void delete_work_func(struct work_struct *work) { - struct gfs2_glock *gl = container_of(work, struct gfs2_glock, gl_delete); + struct delayed_work *dwork = to_delayed_work(work); + struct gfs2_glock *gl = container_of(dwork, struct gfs2_glock, gl_delete); struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; struct inode *inode; u64 no_addr = gl->gl_name.ln_number; @@ -871,7 +872,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, gl->gl_object = NULL; gl->gl_hold_time = GL_GLOCK_DFT_HOLD; INIT_DELAYED_WORK(&gl->gl_work, glock_work_func); - INIT_WORK(&gl->gl_delete, delete_work_func); + INIT_DELAYED_WORK(&gl->gl_delete, delete_work_func); mapping = gfs2_glock2aspace(gl); if (mapping) { diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index 4b4676fb8c3e..3534878db98d 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c @@ -577,7 +577,8 @@ static void iopen_go_callback(struct gfs2_glock *gl, bool remote) if (gl->gl_demote_state == LM_ST_UNLOCKED && gl->gl_state == LM_ST_SHARED && ip) { gl->gl_lockref.count++; - if (queue_work(gfs2_delete_workqueue, &gl->gl_delete) == 0) + if (!queue_delayed_work(gfs2_delete_workqueue, + &gl->gl_delete, 0)) gl->gl_lockref.count--; } } diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 5f89c515f5bb..d7282356cbf5 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h @@ -375,8 +375,8 @@ struct gfs2_glock { atomic_t gl_revokes; struct delayed_work gl_work; union { - /* For inode and iopen glocks only */ - struct work_struct gl_delete; + /* For iopen glocks only */ + struct delayed_work gl_delete; /* For rgrp glocks only */ struct { loff_t start; diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 2466bb44a23c..34a8fab53e5b 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c @@ -1873,7 +1873,8 @@ static void try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked, u64 skip */ ip = gl->gl_object; - if (ip || queue_work(gfs2_delete_workqueue, &gl->gl_delete) == 0) + if (ip || !queue_delayed_work(gfs2_delete_workqueue, + &gl->gl_delete, 0)) gfs2_glock_put(gl); else found++; diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index b108b6379fb7..1a029beaaaca 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c @@ -1017,7 +1017,8 @@ static int gfs2_drop_inode(struct inode *inode) struct gfs2_glock *gl = ip->i_iopen_gh.gh_gl; gfs2_glock_hold(gl); - if (queue_work(gfs2_delete_workqueue, &gl->gl_delete) == 0) + if (!queue_delayed_work(gfs2_delete_workqueue, + &gl->gl_delete, 0)) gfs2_glock_queue_put(gl); return false; } -- 2.20.1