aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2011-04-04 15:33:39 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-04-04 15:33:39 -0400
commit21f976975cbecbdaf23ceeacc1cab2b1c05a028e (patch)
tree3040b533bf50d58e23c3c207001d89b29846df37
parent50f689af019b19f9b9a39be782c21b6f52b1615a (diff)
ext4: remove unnecessary [cm]time update of quota file
It is not necessary to update [cm]time of quota file on each quota file write and it wastes journal space and IO throughput with inode writes. So just remove the updating from ext4_quota_write() and only update times when quotas are being turned off. Userspace cannot get anything reliable from quota files while they are used by the kernel anyway. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--fs/ext4/ext4_jbd2.h4
-rw-r--r--fs/ext4/super.c16
2 files changed, 16 insertions, 4 deletions
diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
index e25e99bf7ee1..d0f53538a57f 100644
--- a/fs/ext4/ext4_jbd2.h
+++ b/fs/ext4/ext4_jbd2.h
@@ -86,8 +86,8 @@
86 86
87#ifdef CONFIG_QUOTA 87#ifdef CONFIG_QUOTA
88/* Amount of blocks needed for quota update - we know that the structure was 88/* Amount of blocks needed for quota update - we know that the structure was
89 * allocated so we need to update only inode+data */ 89 * allocated so we need to update only data block */
90#define EXT4_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 2 : 0) 90#define EXT4_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 1 : 0)
91/* Amount of blocks needed for quota insert/delete - we do some block writes 91/* Amount of blocks needed for quota insert/delete - we do some block writes
92 * but inode, sb and group updates are done only once */ 92 * but inode, sb and group updates are done only once */
93#define EXT4_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\ 93#define EXT4_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 22546ad7f0ae..35ff9fef68bd 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4614,11 +4614,24 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
4614 4614
4615static int ext4_quota_off(struct super_block *sb, int type) 4615static int ext4_quota_off(struct super_block *sb, int type)
4616{ 4616{
4617 struct inode *inode = sb_dqopt(sb)->files[type];
4618 handle_t *handle;
4619
4617 /* Force all delayed allocation blocks to be allocated. 4620 /* Force all delayed allocation blocks to be allocated.
4618 * Caller already holds s_umount sem */ 4621 * Caller already holds s_umount sem */
4619 if (test_opt(sb, DELALLOC)) 4622 if (test_opt(sb, DELALLOC))
4620 sync_filesystem(sb); 4623 sync_filesystem(sb);
4621 4624
4625 /* Update modification times of quota files when userspace can
4626 * start looking at them */
4627 handle = ext4_journal_start(inode, 1);
4628 if (IS_ERR(handle))
4629 goto out;
4630 inode->i_mtime = inode->i_ctime = CURRENT_TIME;
4631 ext4_mark_inode_dirty(handle, inode);
4632 ext4_journal_stop(handle);
4633
4634out:
4622 return dquot_quota_off(sb, type); 4635 return dquot_quota_off(sb, type);
4623} 4636}
4624 4637
@@ -4714,9 +4727,8 @@ out:
4714 if (inode->i_size < off + len) { 4727 if (inode->i_size < off + len) {
4715 i_size_write(inode, off + len); 4728 i_size_write(inode, off + len);
4716 EXT4_I(inode)->i_disksize = inode->i_size; 4729 EXT4_I(inode)->i_disksize = inode->i_size;
4730 ext4_mark_inode_dirty(handle, inode);
4717 } 4731 }
4718 inode->i_mtime = inode->i_ctime = CURRENT_TIME;
4719 ext4_mark_inode_dirty(handle, inode);
4720 mutex_unlock(&inode->i_mutex); 4732 mutex_unlock(&inode->i_mutex);
4721 return len; 4733 return len;
4722} 4734}