diff options
author | Jan Kara <jack@suse.cz> | 2011-04-04 15:33:39 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-04-04 15:33:39 -0400 |
commit | 21f976975cbecbdaf23ceeacc1cab2b1c05a028e (patch) | |
tree | 3040b533bf50d58e23c3c207001d89b29846df37 /fs/ext4/super.c | |
parent | 50f689af019b19f9b9a39be782c21b6f52b1615a (diff) | |
download | lwn-21f976975cbecbdaf23ceeacc1cab2b1c05a028e.tar.gz lwn-21f976975cbecbdaf23ceeacc1cab2b1c05a028e.zip |
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>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 16 |
1 files changed, 14 insertions, 2 deletions
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, static int ext4_quota_off(struct super_block *sb, int type) { + struct inode *inode = sb_dqopt(sb)->files[type]; + handle_t *handle; + /* Force all delayed allocation blocks to be allocated. * Caller already holds s_umount sem */ if (test_opt(sb, DELALLOC)) sync_filesystem(sb); + /* Update modification times of quota files when userspace can + * start looking at them */ + handle = ext4_journal_start(inode, 1); + if (IS_ERR(handle)) + goto out; + inode->i_mtime = inode->i_ctime = CURRENT_TIME; + ext4_mark_inode_dirty(handle, inode); + ext4_journal_stop(handle); + +out: return dquot_quota_off(sb, type); } @@ -4714,9 +4727,8 @@ out: if (inode->i_size < off + len) { i_size_write(inode, off + len); EXT4_I(inode)->i_disksize = inode->i_size; + ext4_mark_inode_dirty(handle, inode); } - inode->i_mtime = inode->i_ctime = CURRENT_TIME; - ext4_mark_inode_dirty(handle, inode); mutex_unlock(&inode->i_mutex); return len; } |