Skip to content

Commit 4ad0208

Browse files
author
Andreas Gruenbacher
committed
gfs2: Make gfs2_glock_hold return its glock argument
This allows code like 'gl = gfs2_glock_hold(...)'. Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 70376c7 commit 4ad0208

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

fs/gfs2/file.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,14 +1445,13 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
14451445

14461446
static void __flock_holder_uninit(struct file *file, struct gfs2_holder *fl_gh)
14471447
{
1448-
struct gfs2_glock *gl = fl_gh->gh_gl;
1448+
struct gfs2_glock *gl = gfs2_glock_hold(fl_gh->gh_gl);
14491449

14501450
/*
14511451
* Make sure gfs2_glock_put() won't sleep under the file->f_lock
14521452
* spinlock.
14531453
*/
14541454

1455-
gfs2_glock_hold(gl);
14561455
spin_lock(&file->f_lock);
14571456
gfs2_holder_uninit(fl_gh);
14581457
spin_unlock(&file->f_lock);

fs/gfs2/glock.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,11 @@ void gfs2_glock_free(struct gfs2_glock *gl)
186186
*
187187
*/
188188

189-
void gfs2_glock_hold(struct gfs2_glock *gl)
189+
struct gfs2_glock *gfs2_glock_hold(struct gfs2_glock *gl)
190190
{
191191
GLOCK_BUG_ON(gl, __lockref_is_dead(&gl->gl_lockref));
192192
lockref_get(&gl->gl_lockref);
193+
return gl;
193194
}
194195

195196
/**
@@ -1256,13 +1257,12 @@ void __gfs2_holder_init(struct gfs2_glock *gl, unsigned int state, u16 flags,
12561257
struct gfs2_holder *gh, unsigned long ip)
12571258
{
12581259
INIT_LIST_HEAD(&gh->gh_list);
1259-
gh->gh_gl = gl;
1260+
gh->gh_gl = gfs2_glock_hold(gl);
12601261
gh->gh_ip = ip;
12611262
gh->gh_owner_pid = get_pid(task_pid(current));
12621263
gh->gh_state = state;
12631264
gh->gh_flags = flags;
12641265
gh->gh_iflags = 0;
1265-
gfs2_glock_hold(gl);
12661266
}
12671267

12681268
/**

fs/gfs2/glock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ static inline struct address_space *gfs2_glock2aspace(struct gfs2_glock *gl)
196196
extern int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
197197
const struct gfs2_glock_operations *glops,
198198
int create, struct gfs2_glock **glp);
199-
extern void gfs2_glock_hold(struct gfs2_glock *gl);
199+
extern struct gfs2_glock *gfs2_glock_hold(struct gfs2_glock *gl);
200200
extern void gfs2_glock_put(struct gfs2_glock *gl);
201201
extern void gfs2_glock_queue_put(struct gfs2_glock *gl);
202202

0 commit comments

Comments
 (0)