]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/gfs2/aops.c
GFS2: Fold quota data into the reservations struct
[karo-tx-linux.git] / fs / gfs2 / aops.c
index aba77b5720bc53e61d34a68757310fdf7259088e..d6526347d3860eb8269f5ac5fb2f9817220af6b5 100644 (file)
@@ -614,7 +614,6 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
        unsigned int data_blocks = 0, ind_blocks = 0, rblocks;
        int alloc_required;
        int error = 0;
-       struct gfs2_qadata *qa = NULL;
        pgoff_t index = pos >> PAGE_CACHE_SHIFT;
        unsigned from = pos & (PAGE_CACHE_SIZE - 1);
        struct page *page;
@@ -638,15 +637,9 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
                gfs2_write_calc_reserv(ip, len, &data_blocks, &ind_blocks);
 
        if (alloc_required) {
-               qa = gfs2_qadata_get(ip);
-               if (!qa) {
-                       error = -ENOMEM;
-                       goto out_unlock;
-               }
-
                error = gfs2_quota_lock_check(ip);
                if (error)
-                       goto out_alloc_put;
+                       goto out_unlock;
 
                error = gfs2_inplace_reserve(ip, data_blocks + ind_blocks);
                if (error)
@@ -708,8 +701,6 @@ out_trans_fail:
                gfs2_inplace_release(ip);
 out_qunlock:
                gfs2_quota_unlock(ip);
-out_alloc_put:
-               gfs2_qadata_put(ip);
        }
 out_unlock:
        if (&ip->i_inode == sdp->sd_rindex) {
@@ -846,7 +837,6 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping,
        struct gfs2_sbd *sdp = GFS2_SB(inode);
        struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode);
        struct buffer_head *dibh;
-       struct gfs2_qadata *qa = ip->i_qadata;
        unsigned int from = pos & (PAGE_CACHE_SIZE - 1);
        unsigned int to = from + len;
        int ret;
@@ -880,10 +870,8 @@ failed:
        gfs2_trans_end(sdp);
        if (gfs2_mb_reserved(ip))
                gfs2_inplace_release(ip);
-       if (qa) {
+       if (ip->i_res->rs_qa_qd_num)
                gfs2_quota_unlock(ip);
-               gfs2_qadata_put(ip);
-       }
        if (inode == sdp->sd_rindex) {
                gfs2_glock_dq(&m_ip->i_gh);
                gfs2_holder_uninit(&m_ip->i_gh);