Skip to content

Commit 44dab00

Browse files
author
Andreas Gruenbacher
committed
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: Andreas Gruenbacher <agruenba@redhat.com>
1 parent fe39dc9 commit 44dab00

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

fs/gfs2/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2017,7 +2017,7 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len,
20172017
l_blocks++;
20182018
}
20192019

2020-
gfs2_rlist_alloc(&rlist);
2020+
gfs2_rlist_alloc(&rlist, LM_ST_EXCLUSIVE, LM_FLAG_NODE_SCOPE);
20212021

20222022
for (x = 0; x < rlist.rl_rgrps; x++) {
20232023
struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(rlist.rl_ghs[x].gh_gl);

fs/gfs2/glock.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,7 +1780,7 @@ static int glock_compare(const void *arg_a, const void *arg_b)
17801780
}
17811781

17821782
/**
1783-
* nq_m_sync - synchonously acquire more than one glock in deadlock free order
1783+
* nq_m_sync - synchronously acquire more than one glock in deadlock free order
17841784
* @num_gh: the number of structures
17851785
* @ghs: an array of struct gfs2_holder structures
17861786
* @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,
18011801
sort(p, num_gh, sizeof(struct gfs2_holder *), glock_compare, NULL);
18021802

18031803
for (x = 0; x < num_gh; x++) {
1804-
p[x]->gh_flags &= ~(LM_FLAG_TRY | GL_ASYNC);
1805-
18061804
error = gfs2_glock_nq(p[x]);
18071805
if (error) {
18081806
while (x--)
@@ -1819,7 +1817,6 @@ static int nq_m_sync(unsigned int num_gh, struct gfs2_holder *ghs,
18191817
* @num_gh: the number of structures
18201818
* @ghs: an array of struct gfs2_holder structures
18211819
*
1822-
*
18231820
* Returns: 0 on success (all glocks acquired),
18241821
* errno on failure (no glocks acquired)
18251822
*/
@@ -1834,7 +1831,6 @@ int gfs2_glock_nq_m(unsigned int num_gh, struct gfs2_holder *ghs)
18341831
case 0:
18351832
return 0;
18361833
case 1:
1837-
ghs->gh_flags &= ~(LM_FLAG_TRY | GL_ASYNC);
18381834
return gfs2_glock_nq(ghs);
18391835
default:
18401836
if (num_gh <= 4)

fs/gfs2/rgrp.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2720,21 +2720,24 @@ void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist,
27202720
* gfs2_rlist_alloc - all RGs have been added to the rlist, now allocate
27212721
* and initialize an array of glock holders for them
27222722
* @rlist: the list of resource groups
2723+
* @state: the state we're requesting
2724+
* @flags: the modifier flags
27232725
*
27242726
* FIXME: Don't use NOFAIL
27252727
*
27262728
*/
27272729

2728-
void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist)
2730+
void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist,
2731+
unsigned int state, u16 flags)
27292732
{
27302733
unsigned int x;
27312734

27322735
rlist->rl_ghs = kmalloc_array(rlist->rl_rgrps,
27332736
sizeof(struct gfs2_holder),
27342737
GFP_NOFS | __GFP_NOFAIL);
27352738
for (x = 0; x < rlist->rl_rgrps; x++)
2736-
gfs2_holder_init(rlist->rl_rgd[x]->rd_gl, LM_ST_EXCLUSIVE,
2737-
LM_FLAG_NODE_SCOPE, &rlist->rl_ghs[x]);
2739+
gfs2_holder_init(rlist->rl_rgd[x]->rd_gl, state, flags,
2740+
&rlist->rl_ghs[x]);
27382741
}
27392742

27402743
/**

fs/gfs2/rgrp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ struct gfs2_rgrp_list {
6464

6565
extern void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist,
6666
u64 block);
67-
extern void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist);
67+
extern void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist,
68+
unsigned int state, u16 flags);
6869
extern void gfs2_rlist_free(struct gfs2_rgrp_list *rlist);
6970
extern u64 gfs2_ri_total(struct gfs2_sbd *sdp);
7071
extern void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_rgrpd *rgd,

fs/gfs2/xattr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
13131313
else
13141314
goto out;
13151315

1316-
gfs2_rlist_alloc(&rlist);
1316+
gfs2_rlist_alloc(&rlist, LM_ST_EXCLUSIVE, LM_FLAG_NODE_SCOPE);
13171317

13181318
for (x = 0; x < rlist.rl_rgrps; x++) {
13191319
rgd = gfs2_glock2rgrp(rlist.rl_ghs[x].gh_gl);

0 commit comments

Comments
 (0)