aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/inode.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2008-10-09 13:38:40 -0400
committerMark Fasheh <mfasheh@suse.com>2009-01-05 11:40:23 -0500
commita90714c150e3ce677c57a9dac3ab1ec342c75a95 (patch)
tree43e3e744d86122940c0db39ac1bfed0d434b3216 /fs/ocfs2/inode.c
parent9e33d69f553aaf11377307e8d6f82deb3385e351 (diff)
ocfs2: Add quota calls for allocation and freeing of inodes and space
Add quota calls for allocation and freeing of inodes and space, also update estimates on number of needed credits for a transaction. Move out inode allocation from ocfs2_mknod_locked() because vfs_dq_init() must be called outside of a transaction. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/inode.c')
-rw-r--r--fs/ocfs2/inode.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 50dbc486ef71..288512c9dbc2 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -28,6 +28,7 @@
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/highmem.h> 29#include <linux/highmem.h>
30#include <linux/pagemap.h> 30#include <linux/pagemap.h>
31#include <linux/quotaops.h>
31 32
32#include <asm/byteorder.h> 33#include <asm/byteorder.h>
33 34
@@ -603,7 +604,8 @@ static int ocfs2_remove_inode(struct inode *inode,
603 goto bail; 604 goto bail;
604 } 605 }
605 606
606 handle = ocfs2_start_trans(osb, OCFS2_DELETE_INODE_CREDITS); 607 handle = ocfs2_start_trans(osb, OCFS2_DELETE_INODE_CREDITS +
608 ocfs2_quota_trans_credits(inode->i_sb));
607 if (IS_ERR(handle)) { 609 if (IS_ERR(handle)) {
608 status = PTR_ERR(handle); 610 status = PTR_ERR(handle);
609 mlog_errno(status); 611 mlog_errno(status);
@@ -635,6 +637,7 @@ static int ocfs2_remove_inode(struct inode *inode,
635 } 637 }
636 638
637 ocfs2_remove_from_cache(inode, di_bh); 639 ocfs2_remove_from_cache(inode, di_bh);
640 vfs_dq_free_inode(inode);
638 641
639 status = ocfs2_free_dinode(handle, inode_alloc_inode, 642 status = ocfs2_free_dinode(handle, inode_alloc_inode,
640 inode_alloc_bh, di); 643 inode_alloc_bh, di);
@@ -917,7 +920,10 @@ void ocfs2_delete_inode(struct inode *inode)
917 920
918 mlog_entry("(inode->i_ino = %lu)\n", inode->i_ino); 921 mlog_entry("(inode->i_ino = %lu)\n", inode->i_ino);
919 922
920 if (is_bad_inode(inode)) { 923 /* When we fail in read_inode() we mark inode as bad. The second test
924 * catches the case when inode allocation fails before allocating
925 * a block for inode. */
926 if (is_bad_inode(inode) || !OCFS2_I(inode)->ip_blkno) {
921 mlog(0, "Skipping delete of bad inode\n"); 927 mlog(0, "Skipping delete of bad inode\n");
922 goto bail; 928 goto bail;
923 } 929 }