]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/ocfs2/inode.c
ocfs2: Add quota calls for allocation and freeing of inodes and space
[linux-2.6-omap-h63xx.git] / fs / ocfs2 / inode.c
index 50dbc486ef713d90d7bea73a9a2a50f27ca86c75..288512c9dbc27fc87c94aaf3ee4fa374e1b504cc 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/slab.h>
 #include <linux/highmem.h>
 #include <linux/pagemap.h>
+#include <linux/quotaops.h>
 
 #include <asm/byteorder.h>
 
@@ -603,7 +604,8 @@ static int ocfs2_remove_inode(struct inode *inode,
                goto bail;
        }
 
-       handle = ocfs2_start_trans(osb, OCFS2_DELETE_INODE_CREDITS);
+       handle = ocfs2_start_trans(osb, OCFS2_DELETE_INODE_CREDITS +
+                                       ocfs2_quota_trans_credits(inode->i_sb));
        if (IS_ERR(handle)) {
                status = PTR_ERR(handle);
                mlog_errno(status);
@@ -635,6 +637,7 @@ static int ocfs2_remove_inode(struct inode *inode,
        }
 
        ocfs2_remove_from_cache(inode, di_bh);
+       vfs_dq_free_inode(inode);
 
        status = ocfs2_free_dinode(handle, inode_alloc_inode,
                                   inode_alloc_bh, di);
@@ -917,7 +920,10 @@ void ocfs2_delete_inode(struct inode *inode)
 
        mlog_entry("(inode->i_ino = %lu)\n", inode->i_ino);
 
-       if (is_bad_inode(inode)) {
+       /* When we fail in read_inode() we mark inode as bad. The second test
+        * catches the case when inode allocation fails before allocating
+        * a block for inode. */
+       if (is_bad_inode(inode) || !OCFS2_I(inode)->ip_blkno) {
                mlog(0, "Skipping delete of bad inode\n");
                goto bail;
        }