diff options
author | Jan Kara <jack@suse.cz> | 2005-06-24 01:01:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-24 03:05:20 -0400 |
commit | 556a2a45bce1740f035befaa7201e4ad836c7257 (patch) | |
tree | d4a85b6f2bd02ab5c7c194e351508b80035f07c5 /fs | |
parent | 1f54587bea84a35125c95e19b98c2f464c50871b (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')
-rw-r--r-- | fs/reiserfs/file.c | 4 | ||||
-rw-r--r-- | fs/reiserfs/inode.c | 11 | ||||
-rw-r--r-- | fs/reiserfs/namei.c | 25 | ||||
-rw-r--r-- | fs/reiserfs/super.c | 35 |
4 files changed, 45 insertions, 30 deletions
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index 2230afff1870..12e91209544e 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -201,7 +201,7 @@ static int reiserfs_allocate_blocks_for_region( | |||
201 | /* If we came here, it means we absolutely need to open a transaction, | 201 | /* If we came here, it means we absolutely need to open a transaction, |
202 | since we need to allocate some blocks */ | 202 | since we need to allocate some blocks */ |
203 | reiserfs_write_lock(inode->i_sb); // Journaling stuff and we need that. | 203 | reiserfs_write_lock(inode->i_sb); // Journaling stuff and we need that. |
204 | res = journal_begin(th, inode->i_sb, JOURNAL_PER_BALANCE_CNT * 3 + 1 + 2 * REISERFS_QUOTA_TRANS_BLOCKS); // Wish I know if this number enough | 204 | res = journal_begin(th, inode->i_sb, JOURNAL_PER_BALANCE_CNT * 3 + 1 + 2 * REISERFS_QUOTA_TRANS_BLOCKS(inode->i_sb)); // Wish I know if this number enough |
205 | if (res) | 205 | if (res) |
206 | goto error_exit; | 206 | goto error_exit; |
207 | reiserfs_update_inode_transaction(inode) ; | 207 | reiserfs_update_inode_transaction(inode) ; |
@@ -576,7 +576,7 @@ error_exit: | |||
576 | int err; | 576 | int err; |
577 | // update any changes we made to blk count | 577 | // update any changes we made to blk count |
578 | reiserfs_update_sd(th, inode); | 578 | reiserfs_update_sd(th, inode); |
579 | err = journal_end(th, inode->i_sb, JOURNAL_PER_BALANCE_CNT * 3 + 1 + 2 * REISERFS_QUOTA_TRANS_BLOCKS); | 579 | err = journal_end(th, inode->i_sb, JOURNAL_PER_BALANCE_CNT * 3 + 1 + 2 * REISERFS_QUOTA_TRANS_BLOCKS(inode->i_sb)); |
580 | if (err) | 580 | if (err) |
581 | res = err; | 581 | res = err; |
582 | } | 582 | } |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 073425e6e0a9..0d5817f81972 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -28,7 +28,7 @@ static int reiserfs_prepare_write(struct file *f, struct page *page, | |||
28 | void reiserfs_delete_inode (struct inode * inode) | 28 | void reiserfs_delete_inode (struct inode * inode) |
29 | { | 29 | { |
30 | /* We need blocks for transaction + (user+group) quota update (possibly delete) */ | 30 | /* We need blocks for transaction + (user+group) quota update (possibly delete) */ |
31 | int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 * REISERFS_QUOTA_INIT_BLOCKS; | 31 | int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb); |
32 | struct reiserfs_transaction_handle th ; | 32 | struct reiserfs_transaction_handle th ; |
33 | 33 | ||
34 | reiserfs_write_lock(inode->i_sb); | 34 | reiserfs_write_lock(inode->i_sb); |
@@ -591,7 +591,7 @@ int reiserfs_get_block (struct inode * inode, sector_t block, | |||
591 | XXX in practically impossible worst case direct2indirect() | 591 | XXX in practically impossible worst case direct2indirect() |
592 | can incur (much) more than 3 balancings. | 592 | can incur (much) more than 3 balancings. |
593 | quota update for user, group */ | 593 | quota update for user, group */ |
594 | int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 1 + 2 * REISERFS_QUOTA_TRANS_BLOCKS; | 594 | int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 1 + 2 * REISERFS_QUOTA_TRANS_BLOCKS(inode->i_sb); |
595 | int version; | 595 | int version; |
596 | int dangle = 1; | 596 | int dangle = 1; |
597 | loff_t new_offset = (((loff_t)block) << inode->i_sb->s_blocksize_bits) + 1 ; | 597 | loff_t new_offset = (((loff_t)block) << inode->i_sb->s_blocksize_bits) + 1 ; |
@@ -2796,14 +2796,15 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) { | |||
2796 | 2796 | ||
2797 | if (!error) { | 2797 | if (!error) { |
2798 | struct reiserfs_transaction_handle th; | 2798 | struct reiserfs_transaction_handle th; |
2799 | int jbegin_count = 2*(REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb)+REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb))+2; | ||
2799 | 2800 | ||
2800 | /* (user+group)*(old+new) structure - we count quota info and , inode write (sb, inode) */ | 2801 | /* (user+group)*(old+new) structure - we count quota info and , inode write (sb, inode) */ |
2801 | error = journal_begin(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2); | 2802 | error = journal_begin(&th, inode->i_sb, jbegin_count); |
2802 | if (error) | 2803 | if (error) |
2803 | goto out; | 2804 | goto out; |
2804 | error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0; | 2805 | error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0; |
2805 | if (error) { | 2806 | if (error) { |
2806 | journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2); | 2807 | journal_end(&th, inode->i_sb, jbegin_count); |
2807 | goto out; | 2808 | goto out; |
2808 | } | 2809 | } |
2809 | /* Update corresponding info in inode so that everything is in | 2810 | /* Update corresponding info in inode so that everything is in |
@@ -2813,7 +2814,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) { | |||
2813 | if (attr->ia_valid & ATTR_GID) | 2814 | if (attr->ia_valid & ATTR_GID) |
2814 | inode->i_gid = attr->ia_gid; | 2815 | inode->i_gid = attr->ia_gid; |
2815 | mark_inode_dirty(inode); | 2816 | mark_inode_dirty(inode); |
2816 | error = journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2); | 2817 | error = journal_end(&th, inode->i_sb, jbegin_count); |
2817 | } | 2818 | } |
2818 | } | 2819 | } |
2819 | if (!error) | 2820 | if (!error) |
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; |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 031577fb41a1..660aefca1fd2 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -866,8 +866,9 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st | |||
866 | {"jdev", .arg_required = 'j', .values = NULL}, | 866 | {"jdev", .arg_required = 'j', .values = NULL}, |
867 | {"nolargeio", .arg_required = 'w', .values = NULL}, | 867 | {"nolargeio", .arg_required = 'w', .values = NULL}, |
868 | {"commit", .arg_required = 'c', .values = NULL}, | 868 | {"commit", .arg_required = 'c', .values = NULL}, |
869 | {"usrquota",}, | 869 | {"usrquota", .setmask = 1<<REISERFS_QUOTA}, |
870 | {"grpquota",}, | 870 | {"grpquota", .setmask = 1<<REISERFS_QUOTA}, |
871 | {"noquota", .clrmask = 1<<REISERFS_QUOTA}, | ||
871 | {"errors", .arg_required = 'e', .values = error_actions}, | 872 | {"errors", .arg_required = 'e', .values = error_actions}, |
872 | {"usrjquota", .arg_required = 'u'|(1<<REISERFS_OPT_ALLOWEMPTY), .values = NULL}, | 873 | {"usrjquota", .arg_required = 'u'|(1<<REISERFS_OPT_ALLOWEMPTY), .values = NULL}, |
873 | {"grpjquota", .arg_required = 'g'|(1<<REISERFS_OPT_ALLOWEMPTY), .values = NULL}, | 874 | {"grpjquota", .arg_required = 'g'|(1<<REISERFS_OPT_ALLOWEMPTY), .values = NULL}, |
@@ -964,6 +965,7 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st | |||
964 | return 0; | 965 | return 0; |
965 | } | 966 | } |
966 | strcpy(REISERFS_SB(s)->s_qf_names[qtype], arg); | 967 | strcpy(REISERFS_SB(s)->s_qf_names[qtype], arg); |
968 | *mount_options |= 1<<REISERFS_QUOTA; | ||
967 | } | 969 | } |
968 | else { | 970 | else { |
969 | if (REISERFS_SB(s)->s_qf_names[qtype]) { | 971 | if (REISERFS_SB(s)->s_qf_names[qtype]) { |
@@ -995,7 +997,13 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st | |||
995 | reiserfs_warning(s, "reiserfs_parse_options: journalled quota format not specified."); | 997 | reiserfs_warning(s, "reiserfs_parse_options: journalled quota format not specified."); |
996 | return 0; | 998 | return 0; |
997 | } | 999 | } |
1000 | /* This checking is not precise wrt the quota type but for our purposes it is sufficient */ | ||
1001 | if (!(*mount_options & (1<<REISERFS_QUOTA)) && sb_any_quota_enabled(s)) { | ||
1002 | reiserfs_warning(s, "reiserfs_parse_options: quota options must be present when quota is turned on."); | ||
1003 | return 0; | ||
1004 | } | ||
998 | #endif | 1005 | #endif |
1006 | |||
999 | return 1; | 1007 | return 1; |
1000 | } | 1008 | } |
1001 | 1009 | ||
@@ -1105,6 +1113,7 @@ static int reiserfs_remount (struct super_block * s, int * mount_flags, char * a | |||
1105 | safe_mask |= 1 << REISERFS_ERROR_RO; | 1113 | safe_mask |= 1 << REISERFS_ERROR_RO; |
1106 | safe_mask |= 1 << REISERFS_ERROR_CONTINUE; | 1114 | safe_mask |= 1 << REISERFS_ERROR_CONTINUE; |
1107 | safe_mask |= 1 << REISERFS_ERROR_PANIC; | 1115 | safe_mask |= 1 << REISERFS_ERROR_PANIC; |
1116 | safe_mask |= 1 << REISERFS_QUOTA; | ||
1108 | 1117 | ||
1109 | /* Update the bitmask, taking care to keep | 1118 | /* Update the bitmask, taking care to keep |
1110 | * the bits we're not allowed to change here */ | 1119 | * the bits we're not allowed to change here */ |
@@ -1845,11 +1854,11 @@ static int reiserfs_dquot_initialize(struct inode *inode, int type) | |||
1845 | 1854 | ||
1846 | /* We may create quota structure so we need to reserve enough blocks */ | 1855 | /* We may create quota structure so we need to reserve enough blocks */ |
1847 | reiserfs_write_lock(inode->i_sb); | 1856 | reiserfs_write_lock(inode->i_sb); |
1848 | ret = journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS); | 1857 | ret = journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb)); |
1849 | if (ret) | 1858 | if (ret) |
1850 | goto out; | 1859 | goto out; |
1851 | ret = dquot_initialize(inode, type); | 1860 | ret = dquot_initialize(inode, type); |
1852 | err = journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS); | 1861 | err = journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb)); |
1853 | if (!ret && err) | 1862 | if (!ret && err) |
1854 | ret = err; | 1863 | ret = err; |
1855 | out: | 1864 | out: |
@@ -1864,11 +1873,11 @@ static int reiserfs_dquot_drop(struct inode *inode) | |||
1864 | 1873 | ||
1865 | /* We may delete quota structure so we need to reserve enough blocks */ | 1874 | /* We may delete quota structure so we need to reserve enough blocks */ |
1866 | reiserfs_write_lock(inode->i_sb); | 1875 | reiserfs_write_lock(inode->i_sb); |
1867 | ret = journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS); | 1876 | ret = journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb)); |
1868 | if (ret) | 1877 | if (ret) |
1869 | goto out; | 1878 | goto out; |
1870 | ret = dquot_drop(inode); | 1879 | ret = dquot_drop(inode); |
1871 | err = journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS); | 1880 | err = journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb)); |
1872 | if (!ret && err) | 1881 | if (!ret && err) |
1873 | ret = err; | 1882 | ret = err; |
1874 | out: | 1883 | out: |
@@ -1882,11 +1891,11 @@ static int reiserfs_write_dquot(struct dquot *dquot) | |||
1882 | int ret, err; | 1891 | int ret, err; |
1883 | 1892 | ||
1884 | reiserfs_write_lock(dquot->dq_sb); | 1893 | reiserfs_write_lock(dquot->dq_sb); |
1885 | ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS); | 1894 | ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS(dquot->dq_sb)); |
1886 | if (ret) | 1895 | if (ret) |
1887 | goto out; | 1896 | goto out; |
1888 | ret = dquot_commit(dquot); | 1897 | ret = dquot_commit(dquot); |
1889 | err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS); | 1898 | err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS(dquot->dq_sb)); |
1890 | if (!ret && err) | 1899 | if (!ret && err) |
1891 | ret = err; | 1900 | ret = err; |
1892 | out: | 1901 | out: |
@@ -1900,11 +1909,11 @@ static int reiserfs_acquire_dquot(struct dquot *dquot) | |||
1900 | int ret, err; | 1909 | int ret, err; |
1901 | 1910 | ||
1902 | reiserfs_write_lock(dquot->dq_sb); | 1911 | reiserfs_write_lock(dquot->dq_sb); |
1903 | ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS); | 1912 | ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS(dquot->dq_sb)); |
1904 | if (ret) | 1913 | if (ret) |
1905 | goto out; | 1914 | goto out; |
1906 | ret = dquot_acquire(dquot); | 1915 | ret = dquot_acquire(dquot); |
1907 | err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS); | 1916 | err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS(dquot->dq_sb)); |
1908 | if (!ret && err) | 1917 | if (!ret && err) |
1909 | ret = err; | 1918 | ret = err; |
1910 | out: | 1919 | out: |
@@ -1918,11 +1927,11 @@ static int reiserfs_release_dquot(struct dquot *dquot) | |||
1918 | int ret, err; | 1927 | int ret, err; |
1919 | 1928 | ||
1920 | reiserfs_write_lock(dquot->dq_sb); | 1929 | reiserfs_write_lock(dquot->dq_sb); |
1921 | ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS); | 1930 | ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_DEL_BLOCKS(dquot->dq_sb)); |
1922 | if (ret) | 1931 | if (ret) |
1923 | goto out; | 1932 | goto out; |
1924 | ret = dquot_release(dquot); | 1933 | ret = dquot_release(dquot); |
1925 | err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS); | 1934 | err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_DEL_BLOCKS(dquot->dq_sb)); |
1926 | if (!ret && err) | 1935 | if (!ret && err) |
1927 | ret = err; | 1936 | ret = err; |
1928 | out: | 1937 | out: |
@@ -1978,6 +1987,8 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, ch | |||
1978 | int err; | 1987 | int err; |
1979 | struct nameidata nd; | 1988 | struct nameidata nd; |
1980 | 1989 | ||
1990 | if (!(REISERFS_SB(sb)->s_mount_opt & (1<<REISERFS_QUOTA))) | ||
1991 | return -EINVAL; | ||
1981 | err = path_lookup(path, LOOKUP_FOLLOW, &nd); | 1992 | err = path_lookup(path, LOOKUP_FOLLOW, &nd); |
1982 | if (err) | 1993 | if (err) |
1983 | return err; | 1994 | return err; |