]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - fs/reiserfs/inode.c
dquot: move dquot initialization responsibility into the filesystem
[mirror_ubuntu-zesty-kernel.git] / fs / reiserfs / inode.c
index 2df0f5c7c60bf37b69b7949e239e2d81a57b0ab5..06995cb48e3999ce649cac19e258bb455f352aa7 100644 (file)
@@ -34,6 +34,9 @@ void reiserfs_delete_inode(struct inode *inode)
        int depth;
        int err;
 
+       if (!is_bad_inode(inode))
+               vfs_dq_init(inode);
+
        truncate_inode_pages(&inode->i_data, 0);
 
        depth = reiserfs_write_lock_once(inode->i_sb);
@@ -54,7 +57,7 @@ void reiserfs_delete_inode(struct inode *inode)
                 * after delete_object so that quota updates go into the same transaction as
                 * stat data deletion */
                if (!err) 
-                       vfs_dq_free_inode(inode);
+                       dquot_free_inode(inode);
 
                if (journal_end(&th, inode->i_sb, jbegin_count))
                        goto out;
@@ -1765,10 +1768,10 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
 
        BUG_ON(!th->t_trans_id);
 
-       if (vfs_dq_alloc_inode(inode)) {
-               err = -EDQUOT;
+       vfs_dq_init(inode);
+       err = dquot_alloc_inode(inode);
+       if (err)
                goto out_end_trans;
-       }
        if (!dir->i_nlink) {
                err = -EPERM;
                goto out_bad_inode;
@@ -1959,12 +1962,12 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
        INODE_PKEY(inode)->k_objectid = 0;
 
        /* Quota change must be inside a transaction for journaling */
-       vfs_dq_free_inode(inode);
+       dquot_free_inode(inode);
 
       out_end_trans:
        journal_end(th, th->t_super, th->t_blocks_allocated);
        /* Drop can be outside and it needs more credits so it's better to have it outside */
-       vfs_dq_drop(inode);
+       dquot_drop(inode);
        inode->i_flags |= S_NOQUOTA;
        make_bad_inode(inode);
 
@@ -3073,6 +3076,8 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
 
        depth = reiserfs_write_lock_once(inode->i_sb);
        if (attr->ia_valid & ATTR_SIZE) {
+               vfs_dq_init(inode);
+
                /* version 2 items will be caught by the s_maxbytes check
                 ** done for us in vmtruncate
                 */
@@ -3134,8 +3139,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
                                                  jbegin_count);
                                if (error)
                                        goto out;
-                               error =
-                                   vfs_dq_transfer(inode, attr) ? -EDQUOT : 0;
+                               error = dquot_transfer(inode, attr);
                                if (error) {
                                        journal_end(&th, inode->i_sb,
                                                    jbegin_count);