Commit 8f6b8f14 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher

gfs2: gfs2_glock_get cleanup

Clean up the messy code in gfs2_glock_get().  No change in
functionality.
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent c8758ad0
...@@ -1203,13 +1203,10 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, ...@@ -1203,13 +1203,10 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
.ln_sbd = sdp }; .ln_sbd = sdp };
struct gfs2_glock *gl, *tmp; struct gfs2_glock *gl, *tmp;
struct address_space *mapping; struct address_space *mapping;
int ret = 0;
gl = find_insert_glock(&name, NULL); gl = find_insert_glock(&name, NULL);
if (gl) { if (gl)
*glp = gl; goto found;
return 0;
}
if (!create) if (!create)
return -ENOENT; return -ENOENT;
...@@ -1271,23 +1268,19 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, ...@@ -1271,23 +1268,19 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
} }
tmp = find_insert_glock(&name, gl); tmp = find_insert_glock(&name, gl);
if (!tmp) { if (tmp) {
*glp = gl; gfs2_glock_dealloc(&gl->gl_rcu);
goto out; if (atomic_dec_and_test(&sdp->sd_glock_disposal))
} wake_up(&sdp->sd_kill_wait);
if (IS_ERR(tmp)) {
ret = PTR_ERR(tmp);
goto out_free;
}
*glp = tmp;
out_free: if (IS_ERR(tmp))
gfs2_glock_dealloc(&gl->gl_rcu); return PTR_ERR(tmp);
if (atomic_dec_and_test(&sdp->sd_glock_disposal)) gl = tmp;
wake_up(&sdp->sd_kill_wait); }
out: found:
return ret; *glp = gl;
return 0;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment