diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2016-06-17 08:31:27 -0400 |
---|---|---|
committer | Bob Peterson <rpeterso@redhat.com> | 2016-06-27 10:47:09 -0400 |
commit | 6df9f9a253c7dc9f8ed18bf89d762de350a31813 (patch) | |
tree | a048f6fb09f9da9d1616b7f5a9c9254ce6f1d7ab /fs/gfs2/rgrp.c | |
parent | cda9dd4207aeb29d0aa2298085cc2d1ebcb87e04 (diff) |
gfs2: Lock holder cleanup
Make the code more readable by cleaning up the different ways of
initializing lock holders and checking for initialized lock holders:
mark lock holders as uninitialized by setting the holder's glock to NULL
(gfs2_holder_mark_uninitialized) instead of zeroing out the entire
object or using a separate flag. Recognize initialized holders by their
non-NULL glock (gfs2_holder_initialized). Don't zero out holder objects
which are immeditiately initialized via gfs2_holder_init or
gfs2_glock_nq_init.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Diffstat (limited to 'fs/gfs2/rgrp.c')
-rw-r--r-- | fs/gfs2/rgrp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 960aaf43d665..fba38ca94135 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -2100,7 +2100,7 @@ void gfs2_inplace_release(struct gfs2_inode *ip) | |||
2100 | { | 2100 | { |
2101 | struct gfs2_blkreserv *rs = &ip->i_res; | 2101 | struct gfs2_blkreserv *rs = &ip->i_res; |
2102 | 2102 | ||
2103 | if (rs->rs_rgd_gh.gh_gl) | 2103 | if (gfs2_holder_initialized(&rs->rs_rgd_gh)) |
2104 | gfs2_glock_dq_uninit(&rs->rs_rgd_gh); | 2104 | gfs2_glock_dq_uninit(&rs->rs_rgd_gh); |
2105 | } | 2105 | } |
2106 | 2106 | ||
@@ -2600,7 +2600,7 @@ void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist, unsigned int state) | |||
2600 | { | 2600 | { |
2601 | unsigned int x; | 2601 | unsigned int x; |
2602 | 2602 | ||
2603 | rlist->rl_ghs = kcalloc(rlist->rl_rgrps, sizeof(struct gfs2_holder), | 2603 | rlist->rl_ghs = kmalloc(rlist->rl_rgrps * sizeof(struct gfs2_holder), |
2604 | GFP_NOFS | __GFP_NOFAIL); | 2604 | GFP_NOFS | __GFP_NOFAIL); |
2605 | for (x = 0; x < rlist->rl_rgrps; x++) | 2605 | for (x = 0; x < rlist->rl_rgrps; x++) |
2606 | gfs2_holder_init(rlist->rl_rgd[x]->rd_gl, | 2606 | gfs2_holder_init(rlist->rl_rgd[x]->rd_gl, |