diff options
author | Theodore Ts'o <tytso@mit.edu> | 2008-02-15 15:00:38 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-02-15 15:00:38 -0500 |
commit | 825f1481ead4ce40671089bae7412ac3519e8caa (patch) | |
tree | 574243b782595a47fb34f348e6f6a5f3b396678e /fs | |
parent | 74d3487fc8aa58cec16dff7239dea1ca59bdab0e (diff) |
ext4: Don't use ext4_dec_count() if not needed
The ext4_dec_count() function is only needed when dropping the i_nlink
count on inodes which are (or which could be) directories. If we
*know* that the inode in question can't possibly be a directory, use
drop_nlink or clear_nlink() if we know i_nlink is 1.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/namei.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index fffd0807a01b..5a79c6b6dc69 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -2161,7 +2161,7 @@ static int ext4_unlink(struct inode * dir, struct dentry *dentry) | |||
2161 | dir->i_ctime = dir->i_mtime = ext4_current_time(dir); | 2161 | dir->i_ctime = dir->i_mtime = ext4_current_time(dir); |
2162 | ext4_update_dx_flag(dir); | 2162 | ext4_update_dx_flag(dir); |
2163 | ext4_mark_inode_dirty(handle, dir); | 2163 | ext4_mark_inode_dirty(handle, dir); |
2164 | ext4_dec_count(handle, inode); | 2164 | drop_nlink(inode); |
2165 | if (!inode->i_nlink) | 2165 | if (!inode->i_nlink) |
2166 | ext4_orphan_add(handle, inode); | 2166 | ext4_orphan_add(handle, inode); |
2167 | inode->i_ctime = ext4_current_time(inode); | 2167 | inode->i_ctime = ext4_current_time(inode); |
@@ -2211,7 +2211,7 @@ retry: | |||
2211 | err = __page_symlink(inode, symname, l, | 2211 | err = __page_symlink(inode, symname, l, |
2212 | mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS); | 2212 | mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS); |
2213 | if (err) { | 2213 | if (err) { |
2214 | ext4_dec_count(handle, inode); | 2214 | clear_nlink(inode); |
2215 | ext4_mark_inode_dirty(handle, inode); | 2215 | ext4_mark_inode_dirty(handle, inode); |
2216 | iput (inode); | 2216 | iput (inode); |
2217 | goto out_stop; | 2217 | goto out_stop; |
@@ -2404,7 +2404,7 @@ static int ext4_rename (struct inode * old_dir, struct dentry *old_dentry, | |||
2404 | ext4_dec_count(handle, old_dir); | 2404 | ext4_dec_count(handle, old_dir); |
2405 | if (new_inode) { | 2405 | if (new_inode) { |
2406 | /* checked empty_dir above, can't have another parent, | 2406 | /* checked empty_dir above, can't have another parent, |
2407 | * ext3_dec_count() won't work for many-linked dirs */ | 2407 | * ext4_dec_count() won't work for many-linked dirs */ |
2408 | new_inode->i_nlink = 0; | 2408 | new_inode->i_nlink = 0; |
2409 | } else { | 2409 | } else { |
2410 | ext4_inc_count(handle, new_dir); | 2410 | ext4_inc_count(handle, new_dir); |