aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/namei.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2005-06-24 01:01:06 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 03:05:20 -0400
commit556a2a45bce1740f035befaa7201e4ad836c7257 (patch)
treed4a85b6f2bd02ab5c7c194e351508b80035f07c5 /fs/reiserfs/namei.c
parent1f54587bea84a35125c95e19b98c2f464c50871b (diff)
[PATCH] quota: reiserfs: improve quota credit estimates
Use improved credits estimates for quota operations. Also reserve space for a quota operation in a transaction only if filesystem was mounted with some quota option. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/reiserfs/namei.c')
-rw-r--r--fs/reiserfs/namei.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 7d4dc5f5aa8b..4a333255f27a 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -586,7 +586,7 @@ static int reiserfs_create (struct inode * dir, struct dentry *dentry, int mode,
586 int retval; 586 int retval;
587 struct inode * inode; 587 struct inode * inode;
588 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */ 588 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
589 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 * (REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_TRANS_BLOCKS); 589 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb)+REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
590 struct reiserfs_transaction_handle th ; 590 struct reiserfs_transaction_handle th ;
591 int locked; 591 int locked;
592 592
@@ -653,7 +653,7 @@ static int reiserfs_mknod (struct inode * dir, struct dentry *dentry, int mode,
653 struct inode * inode; 653 struct inode * inode;
654 struct reiserfs_transaction_handle th ; 654 struct reiserfs_transaction_handle th ;
655 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */ 655 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
656 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * (REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_TRANS_BLOCKS); 656 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb)+REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
657 int locked; 657 int locked;
658 658
659 if (!new_valid_dev(rdev)) 659 if (!new_valid_dev(rdev))
@@ -727,7 +727,7 @@ static int reiserfs_mkdir (struct inode * dir, struct dentry *dentry, int mode)
727 struct inode * inode; 727 struct inode * inode;
728 struct reiserfs_transaction_handle th ; 728 struct reiserfs_transaction_handle th ;
729 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */ 729 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
730 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * (REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_TRANS_BLOCKS); 730 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb)+REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
731 int locked; 731 int locked;
732 732
733#ifdef DISPLACE_NEW_PACKING_LOCALITIES 733#ifdef DISPLACE_NEW_PACKING_LOCALITIES
@@ -829,8 +829,10 @@ static int reiserfs_rmdir (struct inode * dir, struct dentry *dentry)
829 829
830 830
831 /* we will be doing 2 balancings and update 2 stat data, we change quotas 831 /* we will be doing 2 balancings and update 2 stat data, we change quotas
832 * of the owner of the directory and of the owner of the parent directory */ 832 * of the owner of the directory and of the owner of the parent directory.
833 jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 + 2 * (REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_TRANS_BLOCKS); 833 * The quota structure is possibly deleted only on last iput => outside
834 * of this transaction */
835 jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 + 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
834 836
835 reiserfs_write_lock(dir->i_sb); 837 reiserfs_write_lock(dir->i_sb);
836 retval = journal_begin(&th, dir->i_sb, jbegin_count) ; 838 retval = journal_begin(&th, dir->i_sb, jbegin_count) ;
@@ -913,9 +915,10 @@ static int reiserfs_unlink (struct inode * dir, struct dentry *dentry)
913 inode = dentry->d_inode; 915 inode = dentry->d_inode;
914 916
915 /* in this transaction we can be doing at max two balancings and update 917 /* in this transaction we can be doing at max two balancings and update
916 two stat datas, we change quotas of the owner of the directory and of 918 * two stat datas, we change quotas of the owner of the directory and of
917 the owner of the parent directory */ 919 * the owner of the parent directory. The quota structure is possibly
918 jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 + 2 * (REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_TRANS_BLOCKS); 920 * deleted only on iput => outside of this transaction */
921 jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 + 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
919 922
920 reiserfs_write_lock(dir->i_sb); 923 reiserfs_write_lock(dir->i_sb);
921 retval = journal_begin(&th, dir->i_sb, jbegin_count) ; 924 retval = journal_begin(&th, dir->i_sb, jbegin_count) ;
@@ -1000,7 +1003,7 @@ static int reiserfs_symlink (struct inode * parent_dir,
1000 struct reiserfs_transaction_handle th ; 1003 struct reiserfs_transaction_handle th ;
1001 int mode = S_IFLNK | S_IRWXUGO; 1004 int mode = S_IFLNK | S_IRWXUGO;
1002 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */ 1005 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
1003 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * (REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_TRANS_BLOCKS); 1006 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * (REISERFS_QUOTA_INIT_BLOCKS(parent_dir->i_sb)+REISERFS_QUOTA_TRANS_BLOCKS(parent_dir->i_sb));
1004 1007
1005 if (!(inode = new_inode(parent_dir->i_sb))) { 1008 if (!(inode = new_inode(parent_dir->i_sb))) {
1006 return -ENOMEM ; 1009 return -ENOMEM ;
@@ -1076,7 +1079,7 @@ static int reiserfs_link (struct dentry * old_dentry, struct inode * dir, struct
1076 struct inode *inode = old_dentry->d_inode; 1079 struct inode *inode = old_dentry->d_inode;
1077 struct reiserfs_transaction_handle th ; 1080 struct reiserfs_transaction_handle th ;
1078 /* We need blocks for transaction + update of quotas for the owners of the directory */ 1081 /* We need blocks for transaction + update of quotas for the owners of the directory */
1079 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * REISERFS_QUOTA_TRANS_BLOCKS; 1082 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
1080 1083
1081 reiserfs_write_lock(dir->i_sb); 1084 reiserfs_write_lock(dir->i_sb);
1082 if (inode->i_nlink >= REISERFS_LINK_MAX) { 1085 if (inode->i_nlink >= REISERFS_LINK_MAX) {
@@ -1196,7 +1199,7 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
1196 pointed initially and (5) maybe block containing ".." of 1199 pointed initially and (5) maybe block containing ".." of
1197 renamed directory 1200 renamed directory
1198 quota updates: two parent directories */ 1201 quota updates: two parent directories */
1199 jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 5 + 4 * REISERFS_QUOTA_TRANS_BLOCKS; 1202 jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 5 + 4 * REISERFS_QUOTA_TRANS_BLOCKS(old_dir->i_sb);
1200 1203
1201 old_inode = old_dentry->d_inode; 1204 old_inode = old_dentry->d_inode;
1202 new_dentry_inode = new_dentry->d_inode; 1205 new_dentry_inode = new_dentry->d_inode;