diff options
author | Jan Kara <jack@suse.cz> | 2005-06-24 01:01:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-24 03:05:20 -0400 |
commit | 1f54587bea84a35125c95e19b98c2f464c50871b (patch) | |
tree | 42f2467d6892be821271a2257e1259922bdafd45 /fs/ext3/namei.c | |
parent | 4e5117ba0af4582b6ec9164874f719d7f3f1eb2b (diff) |
[PATCH] quota: ext3: Improve quota credit estimates
Use improved credits estimates for quota operations. Also reserve a space
for a quota operation in a transaction only if filesystem was mounted with
some quota options.
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/ext3/namei.c')
-rw-r--r-- | fs/ext3/namei.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index 60e44e6dd7a6..50378d8ff84b 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -1645,9 +1645,9 @@ static int ext3_create (struct inode * dir, struct dentry * dentry, int mode, | |||
1645 | int err, retries = 0; | 1645 | int err, retries = 0; |
1646 | 1646 | ||
1647 | retry: | 1647 | retry: |
1648 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS + | 1648 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + |
1649 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 + | 1649 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 + |
1650 | 2*EXT3_QUOTA_INIT_BLOCKS); | 1650 | 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb)); |
1651 | if (IS_ERR(handle)) | 1651 | if (IS_ERR(handle)) |
1652 | return PTR_ERR(handle); | 1652 | return PTR_ERR(handle); |
1653 | 1653 | ||
@@ -1679,9 +1679,9 @@ static int ext3_mknod (struct inode * dir, struct dentry *dentry, | |||
1679 | return -EINVAL; | 1679 | return -EINVAL; |
1680 | 1680 | ||
1681 | retry: | 1681 | retry: |
1682 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS + | 1682 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + |
1683 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 + | 1683 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 + |
1684 | 2*EXT3_QUOTA_INIT_BLOCKS); | 1684 | 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb)); |
1685 | if (IS_ERR(handle)) | 1685 | if (IS_ERR(handle)) |
1686 | return PTR_ERR(handle); | 1686 | return PTR_ERR(handle); |
1687 | 1687 | ||
@@ -1715,9 +1715,9 @@ static int ext3_mkdir(struct inode * dir, struct dentry * dentry, int mode) | |||
1715 | return -EMLINK; | 1715 | return -EMLINK; |
1716 | 1716 | ||
1717 | retry: | 1717 | retry: |
1718 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS + | 1718 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + |
1719 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 + | 1719 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 + |
1720 | 2*EXT3_QUOTA_INIT_BLOCKS); | 1720 | 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb)); |
1721 | if (IS_ERR(handle)) | 1721 | if (IS_ERR(handle)) |
1722 | return PTR_ERR(handle); | 1722 | return PTR_ERR(handle); |
1723 | 1723 | ||
@@ -2006,7 +2006,7 @@ static int ext3_rmdir (struct inode * dir, struct dentry *dentry) | |||
2006 | /* Initialize quotas before so that eventual writes go in | 2006 | /* Initialize quotas before so that eventual writes go in |
2007 | * separate transaction */ | 2007 | * separate transaction */ |
2008 | DQUOT_INIT(dentry->d_inode); | 2008 | DQUOT_INIT(dentry->d_inode); |
2009 | handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS); | 2009 | handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb)); |
2010 | if (IS_ERR(handle)) | 2010 | if (IS_ERR(handle)) |
2011 | return PTR_ERR(handle); | 2011 | return PTR_ERR(handle); |
2012 | 2012 | ||
@@ -2065,7 +2065,7 @@ static int ext3_unlink(struct inode * dir, struct dentry *dentry) | |||
2065 | /* Initialize quotas before so that eventual writes go | 2065 | /* Initialize quotas before so that eventual writes go |
2066 | * in separate transaction */ | 2066 | * in separate transaction */ |
2067 | DQUOT_INIT(dentry->d_inode); | 2067 | DQUOT_INIT(dentry->d_inode); |
2068 | handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS); | 2068 | handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb)); |
2069 | if (IS_ERR(handle)) | 2069 | if (IS_ERR(handle)) |
2070 | return PTR_ERR(handle); | 2070 | return PTR_ERR(handle); |
2071 | 2071 | ||
@@ -2120,9 +2120,9 @@ static int ext3_symlink (struct inode * dir, | |||
2120 | return -ENAMETOOLONG; | 2120 | return -ENAMETOOLONG; |
2121 | 2121 | ||
2122 | retry: | 2122 | retry: |
2123 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS + | 2123 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + |
2124 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 5 + | 2124 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 5 + |
2125 | 2*EXT3_QUOTA_INIT_BLOCKS); | 2125 | 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb)); |
2126 | if (IS_ERR(handle)) | 2126 | if (IS_ERR(handle)) |
2127 | return PTR_ERR(handle); | 2127 | return PTR_ERR(handle); |
2128 | 2128 | ||
@@ -2174,7 +2174,7 @@ static int ext3_link (struct dentry * old_dentry, | |||
2174 | return -EMLINK; | 2174 | return -EMLINK; |
2175 | 2175 | ||
2176 | retry: | 2176 | retry: |
2177 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS + | 2177 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + |
2178 | EXT3_INDEX_EXTRA_TRANS_BLOCKS); | 2178 | EXT3_INDEX_EXTRA_TRANS_BLOCKS); |
2179 | if (IS_ERR(handle)) | 2179 | if (IS_ERR(handle)) |
2180 | return PTR_ERR(handle); | 2180 | return PTR_ERR(handle); |
@@ -2216,7 +2216,8 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, | |||
2216 | * in separate transaction */ | 2216 | * in separate transaction */ |
2217 | if (new_dentry->d_inode) | 2217 | if (new_dentry->d_inode) |
2218 | DQUOT_INIT(new_dentry->d_inode); | 2218 | DQUOT_INIT(new_dentry->d_inode); |
2219 | handle = ext3_journal_start(old_dir, 2 * EXT3_DATA_TRANS_BLOCKS + | 2219 | handle = ext3_journal_start(old_dir, 2 * |
2220 | EXT3_DATA_TRANS_BLOCKS(old_dir->i_sb) + | ||
2220 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 2); | 2221 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 2); |
2221 | if (IS_ERR(handle)) | 2222 | if (IS_ERR(handle)) |
2222 | return PTR_ERR(handle); | 2223 | return PTR_ERR(handle); |