gfs2: Remove ghs[] from gfs2_unlink
authorAndrew Price <anprice@redhat.com>
Tue, 14 Mar 2023 13:18:29 +0000 (13:18 +0000)
committerAndreas Gruenbacher <agruenba@redhat.com>
Mon, 27 Mar 2023 12:42:16 +0000 (14:42 +0200)
Replace the 3-item array with three variables for readability.

Signed-off-by: Andrew Price <anprice@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/inode.c

index 9850267b9951a77482e8c73ac258b9a69889a2e6..17c994a0c0d09fe692c3eec2a0877c8be57e3965 100644 (file)
@@ -1143,7 +1143,7 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
        struct gfs2_sbd *sdp = GFS2_SB(dir);
        struct inode *inode = d_inode(dentry);
        struct gfs2_inode *ip = GFS2_I(inode);
-       struct gfs2_holder ghs[3];
+       struct gfs2_holder d_gh, r_gh, gh;
        struct gfs2_rgrpd *rgd;
        int error;
 
@@ -1153,21 +1153,21 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
 
        error = -EROFS;
 
-       gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs);
-       gfs2_holder_init(ip->i_gl,  LM_ST_EXCLUSIVE, 0, ghs + 1);
+       gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, &d_gh);
+       gfs2_holder_init(ip->i_gl,  LM_ST_EXCLUSIVE, 0, &gh);
 
        rgd = gfs2_blk2rgrpd(sdp, ip->i_no_addr, 1);
        if (!rgd)
                goto out_inodes;
 
-       gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, LM_FLAG_NODE_SCOPE, ghs + 2);
+       gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, LM_FLAG_NODE_SCOPE, &r_gh);
 
 
-       error = gfs2_glock_nq(ghs); /* parent */
+       error = gfs2_glock_nq(&d_gh);
        if (error)
                goto out_parent;
 
-       error = gfs2_glock_nq(ghs + 1); /* child */
+       error = gfs2_glock_nq(&gh);
        if (error)
                goto out_child;
 
@@ -1181,7 +1181,7 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
                        goto out_rgrp;
        }
 
-       error = gfs2_glock_nq(ghs + 2); /* rgrp */
+       error = gfs2_glock_nq(&r_gh); /* rgrp */
        if (error)
                goto out_rgrp;
 
@@ -1197,16 +1197,16 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
        gfs2_trans_end(sdp);
 
 out_gunlock:
-       gfs2_glock_dq(ghs + 2);
+       gfs2_glock_dq(&r_gh);
 out_rgrp:
-       gfs2_glock_dq(ghs + 1);
+       gfs2_glock_dq(&gh);
 out_child:
-       gfs2_glock_dq(ghs);
+       gfs2_glock_dq(&d_gh);
 out_parent:
-       gfs2_holder_uninit(ghs + 2);
+       gfs2_holder_uninit(&r_gh);
 out_inodes:
-       gfs2_holder_uninit(ghs + 1);
-       gfs2_holder_uninit(ghs);
+       gfs2_holder_uninit(&gh);
+       gfs2_holder_uninit(&d_gh);
        return error;
 }