Commit 44dab005 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher

gfs2: Minor gfs2_glock_nq_m cleanup

Add state and flags arguments to gfs2_rlist_alloc() to make it somewhat more
obvious which state and flags an rlist uses.  With that, stop knocking off
flags in gfs2_glock_nq_m() and its nq_m_sync() helper that are never set in the
first place.
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent fe39dc98
...@@ -2017,7 +2017,7 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len, ...@@ -2017,7 +2017,7 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len,
l_blocks++; l_blocks++;
} }
gfs2_rlist_alloc(&rlist); gfs2_rlist_alloc(&rlist, LM_ST_EXCLUSIVE, LM_FLAG_NODE_SCOPE);
for (x = 0; x < rlist.rl_rgrps; x++) { for (x = 0; x < rlist.rl_rgrps; x++) {
struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(rlist.rl_ghs[x].gh_gl); struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(rlist.rl_ghs[x].gh_gl);
......
...@@ -1780,7 +1780,7 @@ static int glock_compare(const void *arg_a, const void *arg_b) ...@@ -1780,7 +1780,7 @@ static int glock_compare(const void *arg_a, const void *arg_b)
} }
/** /**
* nq_m_sync - synchonously acquire more than one glock in deadlock free order * nq_m_sync - synchronously acquire more than one glock in deadlock free order
* @num_gh: the number of structures * @num_gh: the number of structures
* @ghs: an array of struct gfs2_holder structures * @ghs: an array of struct gfs2_holder structures
* @p: placeholder for the holder structure to pass back * @p: placeholder for the holder structure to pass back
...@@ -1801,8 +1801,6 @@ static int nq_m_sync(unsigned int num_gh, struct gfs2_holder *ghs, ...@@ -1801,8 +1801,6 @@ static int nq_m_sync(unsigned int num_gh, struct gfs2_holder *ghs,
sort(p, num_gh, sizeof(struct gfs2_holder *), glock_compare, NULL); sort(p, num_gh, sizeof(struct gfs2_holder *), glock_compare, NULL);
for (x = 0; x < num_gh; x++) { for (x = 0; x < num_gh; x++) {
p[x]->gh_flags &= ~(LM_FLAG_TRY | GL_ASYNC);
error = gfs2_glock_nq(p[x]); error = gfs2_glock_nq(p[x]);
if (error) { if (error) {
while (x--) while (x--)
...@@ -1819,7 +1817,6 @@ static int nq_m_sync(unsigned int num_gh, struct gfs2_holder *ghs, ...@@ -1819,7 +1817,6 @@ static int nq_m_sync(unsigned int num_gh, struct gfs2_holder *ghs,
* @num_gh: the number of structures * @num_gh: the number of structures
* @ghs: an array of struct gfs2_holder structures * @ghs: an array of struct gfs2_holder structures
* *
*
* Returns: 0 on success (all glocks acquired), * Returns: 0 on success (all glocks acquired),
* errno on failure (no glocks acquired) * errno on failure (no glocks acquired)
*/ */
...@@ -1834,7 +1831,6 @@ int gfs2_glock_nq_m(unsigned int num_gh, struct gfs2_holder *ghs) ...@@ -1834,7 +1831,6 @@ int gfs2_glock_nq_m(unsigned int num_gh, struct gfs2_holder *ghs)
case 0: case 0:
return 0; return 0;
case 1: case 1:
ghs->gh_flags &= ~(LM_FLAG_TRY | GL_ASYNC);
return gfs2_glock_nq(ghs); return gfs2_glock_nq(ghs);
default: default:
if (num_gh <= 4) if (num_gh <= 4)
......
...@@ -2720,12 +2720,15 @@ void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist, ...@@ -2720,12 +2720,15 @@ void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist,
* gfs2_rlist_alloc - all RGs have been added to the rlist, now allocate * gfs2_rlist_alloc - all RGs have been added to the rlist, now allocate
* and initialize an array of glock holders for them * and initialize an array of glock holders for them
* @rlist: the list of resource groups * @rlist: the list of resource groups
* @state: the state we're requesting
* @flags: the modifier flags
* *
* FIXME: Don't use NOFAIL * FIXME: Don't use NOFAIL
* *
*/ */
void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist) void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist,
unsigned int state, u16 flags)
{ {
unsigned int x; unsigned int x;
...@@ -2733,8 +2736,8 @@ void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist) ...@@ -2733,8 +2736,8 @@ void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist)
sizeof(struct gfs2_holder), sizeof(struct gfs2_holder),
GFP_NOFS | __GFP_NOFAIL); GFP_NOFS | __GFP_NOFAIL);
for (x = 0; x < rlist->rl_rgrps; x++) for (x = 0; x < rlist->rl_rgrps; x++)
gfs2_holder_init(rlist->rl_rgd[x]->rd_gl, LM_ST_EXCLUSIVE, gfs2_holder_init(rlist->rl_rgd[x]->rd_gl, state, flags,
LM_FLAG_NODE_SCOPE, &rlist->rl_ghs[x]); &rlist->rl_ghs[x]);
} }
/** /**
......
...@@ -64,7 +64,8 @@ struct gfs2_rgrp_list { ...@@ -64,7 +64,8 @@ struct gfs2_rgrp_list {
extern void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist, extern void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist,
u64 block); u64 block);
extern void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist); extern void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist,
unsigned int state, u16 flags);
extern void gfs2_rlist_free(struct gfs2_rgrp_list *rlist); extern void gfs2_rlist_free(struct gfs2_rgrp_list *rlist);
extern u64 gfs2_ri_total(struct gfs2_sbd *sdp); extern u64 gfs2_ri_total(struct gfs2_sbd *sdp);
extern void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_rgrpd *rgd, extern void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_rgrpd *rgd,
......
...@@ -1313,7 +1313,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip) ...@@ -1313,7 +1313,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
else else
goto out; goto out;
gfs2_rlist_alloc(&rlist); gfs2_rlist_alloc(&rlist, LM_ST_EXCLUSIVE, LM_FLAG_NODE_SCOPE);
for (x = 0; x < rlist.rl_rgrps; x++) { for (x = 0; x < rlist.rl_rgrps; x++) {
rgd = gfs2_glock2rgrp(rlist.rl_ghs[x].gh_gl); rgd = gfs2_glock2rgrp(rlist.rl_ghs[x].gh_gl);
......
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