gfs2: Split gfs2_rsqa_delete into gfs2_rs_delete and gfs2_qa_put
authorAndreas Gruenbacher <agruenba@redhat.com>
Fri, 6 Mar 2020 16:32:35 +0000 (10:32 -0600)
committerBob Peterson <rpeterso@redhat.com>
Fri, 27 Mar 2020 19:08:04 +0000 (14:08 -0500)
Keeping reservations and quotas separate helps reviewing the code.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
fs/gfs2/bmap.c
fs/gfs2/file.c
fs/gfs2/inode.c
fs/gfs2/rgrp.c
fs/gfs2/rgrp.h
fs/gfs2/super.c

index d510a45..936a8ec 100644 (file)
@@ -2194,7 +2194,8 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize)
 
        ret = do_shrink(inode, newsize);
 out:
-       gfs2_rsqa_delete(ip, NULL);
+       gfs2_rs_delete(ip, NULL);
+       gfs2_qa_put(ip);
        return ret;
 }
 
index f18876c..99a75e7 100644 (file)
@@ -701,8 +701,10 @@ static int gfs2_release(struct inode *inode, struct file *file)
        kfree(file->private_data);
        file->private_data = NULL;
 
-       if (file->f_mode & FMODE_WRITE)
-               gfs2_rsqa_delete(ip, &inode->i_writecount);
+       if (file->f_mode & FMODE_WRITE) {
+               gfs2_rs_delete(ip, &inode->i_writecount);
+               gfs2_qa_put(ip);
+       }
        return 0;
 }
 
index d1a2475..980a6fe 100644 (file)
@@ -781,7 +781,8 @@ fail_free_inode:
                glock_clear_object(ip->i_gl, ip);
                gfs2_glock_put(ip->i_gl);
        }
-       gfs2_rsqa_delete(ip, NULL);
+       gfs2_rs_delete(ip, NULL);
+       gfs2_qa_put(ip);
 fail_free_acls:
        posix_acl_release(default_acl);
        posix_acl_release(acl);
index 04e3e13..692dc11 100644 (file)
@@ -662,18 +662,17 @@ void gfs2_rs_deltree(struct gfs2_blkreserv *rs)
 }
 
 /**
- * gfs2_rsqa_delete - delete a multi-block reservation and quota allocation
+ * gfs2_rs_delete - delete a multi-block reservation
  * @ip: The inode for this reservation
  * @wcount: The inode's write count, or NULL
  *
  */
-void gfs2_rsqa_delete(struct gfs2_inode *ip, atomic_t *wcount)
+void gfs2_rs_delete(struct gfs2_inode *ip, atomic_t *wcount)
 {
        down_write(&ip->i_rw_mutex);
        if ((wcount == NULL) || (atomic_read(wcount) <= 1))
                gfs2_rs_deltree(&ip->i_res);
        up_write(&ip->i_rw_mutex);
-       gfs2_qa_put(ip);
 }
 
 /**
index 92cebb7..a1d7e14 100644 (file)
@@ -45,7 +45,7 @@ extern int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *n,
                             bool dinode, u64 *generation);
 
 extern void gfs2_rs_deltree(struct gfs2_blkreserv *rs);
-extern void gfs2_rsqa_delete(struct gfs2_inode *ip, atomic_t *wcount);
+extern void gfs2_rs_delete(struct gfs2_inode *ip, atomic_t *wcount);
 extern void __gfs2_free_blocks(struct gfs2_inode *ip, struct gfs2_rgrpd *rgd,
                               u64 bstart, u32 blen, int meta);
 extern void gfs2_free_meta(struct gfs2_inode *ip, struct gfs2_rgrpd *rgd,
index 68d934f..37fc416 100644 (file)
@@ -1403,7 +1403,8 @@ out:
        truncate_inode_pages_final(&inode->i_data);
        if (ip->i_qadata)
                gfs2_assert_warn(sdp, ip->i_qadata->qa_ref == 0);
-       gfs2_rsqa_delete(ip, NULL);
+       gfs2_rs_delete(ip, NULL);
+       gfs2_qa_put(ip);
        gfs2_ordered_del_inode(ip);
        clear_inode(inode);
        gfs2_dir_hash_inval(ip);