patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / fs / ext3 / ialloc.c
index 624f0bb..0c21ea4 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/quotaops.h>
 #include <linux/buffer_head.h>
 #include <linux/random.h>
+#include <linux/vs_dlimit.h>
 
 #include <asm/bitops.h>
 #include <asm/byteorder.h>
@@ -124,6 +125,7 @@ void ext3_free_inode (handle_t *handle, struct inode * inode)
         */
        DQUOT_INIT(inode);
        ext3_xattr_delete_inode(handle, inode);
+       DLIMIT_FREE_INODE(sb, inode->i_xid);
        DQUOT_FREE_INODE(inode);
        DQUOT_DROP(inode);
 
@@ -444,6 +446,10 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode)
        inode = new_inode(sb);
        if (!inode)
                return ERR_PTR(-ENOMEM);
+       if (DLIMIT_ALLOC_INODE(sb, inode->i_xid)) {
+               err = -ENOSPC;
+               goto fail_dlim;
+       }
        ei = EXT3_I(inode);
 
        sbi = EXT3_SB(sb);
@@ -619,6 +625,8 @@ got:
        ext3_debug("allocating inode %lu\n", inode->i_ino);
        goto really_out;
 fail:
+       DLIMIT_FREE_INODE(sb, inode->i_xid);
+fail_dlim:
        ext3_std_error(sb, err);
 out:
        iput(inode);
@@ -628,6 +636,7 @@ really_out:
        return ret;
 
 fail2:
+       DLIMIT_FREE_INODE(sb, inode->i_xid);
        inode->i_flags |= S_NOQUOTA;
        inode->i_nlink = 0;
        iput(inode);