Skip to content

Commit 4fc7ec3

Browse files
AstralBobAndreas Gruenbacher
authored andcommitted
gfs2: Use resource group glock sharing
This patch takes advantage of the new glock holder sharing feature for resource groups. We have already introduced local resource group locking in a previous patch, so competing accesses of local processes are already under control. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent 06e908c commit 4fc7ec3

5 files changed

Lines changed: 15 additions & 12 deletions

File tree

fs/gfs2/bmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@ static int sweep_bh_for_rgrps(struct gfs2_inode *ip, struct gfs2_holder *rd_gh,
15381538
goto out;
15391539
}
15401540
ret = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE,
1541-
0, rd_gh);
1541+
LM_FLAG_NODE_SCOPE, rd_gh);
15421542
if (ret)
15431543
goto out;
15441544

fs/gfs2/inode.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,7 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
11451145
if (!rgd)
11461146
goto out_inodes;
11471147

1148-
gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2);
1148+
gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, LM_FLAG_NODE_SCOPE, ghs + 2);
11491149

11501150

11511151
error = gfs2_glock_nq(ghs); /* parent */
@@ -1450,8 +1450,8 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
14501450
error = -ENOENT;
14511451
goto out_gunlock;
14521452
}
1453-
error = gfs2_glock_nq_init(nrgd->rd_gl, LM_ST_EXCLUSIVE, 0,
1454-
&rd_gh);
1453+
error = gfs2_glock_nq_init(nrgd->rd_gl, LM_ST_EXCLUSIVE,
1454+
LM_FLAG_NODE_SCOPE, &rd_gh);
14551455
if (error)
14561456
goto out_gunlock;
14571457
}

fs/gfs2/rgrp.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,7 +1442,8 @@ int gfs2_fitrim(struct file *filp, void __user *argp)
14421442

14431443
while (1) {
14441444

1445-
ret = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, &gh);
1445+
ret = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE,
1446+
LM_FLAG_NODE_SCOPE, &gh);
14461447
if (ret)
14471448
goto out;
14481449

@@ -2055,7 +2056,7 @@ int gfs2_inplace_reserve(struct gfs2_inode *ip, struct gfs2_alloc_parms *ap)
20552056
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
20562057
struct gfs2_rgrpd *begin = NULL;
20572058
struct gfs2_blkreserv *rs = &ip->i_res;
2058-
int error = 0, flags = 0;
2059+
int error = 0, flags = LM_FLAG_NODE_SCOPE;
20592060
bool rg_locked;
20602061
u64 last_unlinked = NO_BLOCK;
20612062
u32 target = ap->target;
@@ -2736,9 +2737,8 @@ void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist)
27362737
sizeof(struct gfs2_holder),
27372738
GFP_NOFS | __GFP_NOFAIL);
27382739
for (x = 0; x < rlist->rl_rgrps; x++)
2739-
gfs2_holder_init(rlist->rl_rgd[x]->rd_gl,
2740-
LM_ST_EXCLUSIVE, 0,
2741-
&rlist->rl_ghs[x]);
2740+
gfs2_holder_init(rlist->rl_rgd[x]->rd_gl, LM_ST_EXCLUSIVE,
2741+
LM_FLAG_NODE_SCOPE, &rlist->rl_ghs[x]);
27422742
}
27432743

27442744
/**

fs/gfs2/super.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,8 @@ static int gfs2_dinode_dealloc(struct gfs2_inode *ip)
12291229
goto out_qs;
12301230
}
12311231

1232-
error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, &gh);
1232+
error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE,
1233+
LM_FLAG_NODE_SCOPE, &gh);
12331234
if (error)
12341235
goto out_qs;
12351236

fs/gfs2/xattr.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
259259
return -EIO;
260260
}
261261

262-
error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, &rg_gh);
262+
error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE,
263+
LM_FLAG_NODE_SCOPE, &rg_gh);
263264
if (error)
264265
return error;
265266

@@ -1385,7 +1386,8 @@ static int ea_dealloc_block(struct gfs2_inode *ip)
13851386
return -EIO;
13861387
}
13871388

1388-
error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, &gh);
1389+
error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE,
1390+
LM_FLAG_NODE_SCOPE, &gh);
13891391
if (error)
13901392
return error;
13911393

0 commit comments

Comments
 (0)