gfs2: Use resource group glock sharing
authorBob Peterson <rpeterso@redhat.com>
Tue, 24 Apr 2018 17:35:02 +0000 (10:35 -0700)
committerAndreas Gruenbacher <agruenba@redhat.com>
Wed, 17 Feb 2021 18:30:28 +0000 (19:30 +0100)
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>
fs/gfs2/bmap.c
fs/gfs2/inode.c
fs/gfs2/rgrp.c
fs/gfs2/super.c
fs/gfs2/xattr.c

index e2ee3703f7df93e796502441c54539677b0203af..cf6ccdd005871d65cc3efed7bc82612cead25ecc 100644 (file)
@@ -1538,7 +1538,7 @@ more_rgrps:
                                goto out;
                        }
                        ret = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE,
-                                                0, rd_gh);
+                                                LM_FLAG_NODE_SCOPE, rd_gh);
                        if (ret)
                                goto out;
 
index c1b77e8d6b1c30735c5f2c6a974bc7cd81d6c82f..4d3d8624a95be13065950a501e6d5ebcb3b7f0a9 100644 (file)
@@ -1145,7 +1145,7 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
        if (!rgd)
                goto out_inodes;
 
-       gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2);
+       gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, LM_FLAG_NODE_SCOPE, ghs + 2);
 
 
        error = gfs2_glock_nq(ghs); /* parent */
@@ -1450,8 +1450,8 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
                        error = -ENOENT;
                        goto out_gunlock;
                }
-               error = gfs2_glock_nq_init(nrgd->rd_gl, LM_ST_EXCLUSIVE, 0,
-                                          &rd_gh);
+               error = gfs2_glock_nq_init(nrgd->rd_gl, LM_ST_EXCLUSIVE,
+                                          LM_FLAG_NODE_SCOPE, &rd_gh);
                if (error)
                        goto out_gunlock;
        }
index f45b787307d02d0d8138ee82b8570172721f90ac..89c37a845e649b952f55f3369afe825a1e261a94 100644 (file)
@@ -1442,7 +1442,8 @@ int gfs2_fitrim(struct file *filp, void __user *argp)
 
        while (1) {
 
-               ret = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, &gh);
+               ret = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE,
+                                        LM_FLAG_NODE_SCOPE, &gh);
                if (ret)
                        goto out;
 
@@ -2055,7 +2056,7 @@ int gfs2_inplace_reserve(struct gfs2_inode *ip, struct gfs2_alloc_parms *ap)
        struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
        struct gfs2_rgrpd *begin = NULL;
        struct gfs2_blkreserv *rs = &ip->i_res;
-       int error = 0, flags = 0;
+       int error = 0, flags = LM_FLAG_NODE_SCOPE;
        bool rg_locked;
        u64 last_unlinked = NO_BLOCK;
        u32 target = ap->target;
@@ -2736,9 +2737,8 @@ void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist)
                                      sizeof(struct gfs2_holder),
                                      GFP_NOFS | __GFP_NOFAIL);
        for (x = 0; x < rlist->rl_rgrps; x++)
-               gfs2_holder_init(rlist->rl_rgd[x]->rd_gl,
-                               LM_ST_EXCLUSIVE, 0,
-                               &rlist->rl_ghs[x]);
+               gfs2_holder_init(rlist->rl_rgd[x]->rd_gl, LM_ST_EXCLUSIVE,
+                                LM_FLAG_NODE_SCOPE, &rlist->rl_ghs[x]);
 }
 
 /**
index 2f56acc41c0498184ea367085267e95b7c234611..e138a2d15c77674454304eef78cd6877287c2bef 100644 (file)
@@ -1229,7 +1229,8 @@ static int gfs2_dinode_dealloc(struct gfs2_inode *ip)
                goto out_qs;
        }
 
-       error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, &gh);
+       error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE,
+                                  LM_FLAG_NODE_SCOPE, &gh);
        if (error)
                goto out_qs;
 
index 9d7667bc429278bc742a4511db6785542334533c..d332bf31f0aeefccc7824ed0b6d397d8e2c51a12 100644 (file)
@@ -259,7 +259,8 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
                return -EIO;
        }
 
-       error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, &rg_gh);
+       error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE,
+                                  LM_FLAG_NODE_SCOPE, &rg_gh);
        if (error)
                return error;
 
@@ -1385,7 +1386,8 @@ static int ea_dealloc_block(struct gfs2_inode *ip)
                return -EIO;
        }
 
-       error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, &gh);
+       error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE,
+                                  LM_FLAG_NODE_SCOPE, &gh);
        if (error)
                return error;