diff options
author | Mark Fasheh <mfasheh@suse.com> | 2009-02-18 11:41:38 -0800 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2009-03-04 13:38:18 -0800 |
commit | 5c003046e3b073c059a557c0ba44ba34d58641df (patch) | |
tree | 8cf9c4cdcf0bd699b24f9d22750db0fb4cf95e6c /fs | |
parent | 3d1306fa7a15f1900b71945f5381296ba6880b0e (diff) |
ocfs2: re-order ocfs2_empty_dir checks
ocfs2_empty_dir() is far more expensive than checking link count. Since both
need to be checked at the same time, we can improve performance by checking
link count first.
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ocfs2/namei.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 3bed89162e4d..7cb55ce7d3a9 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c @@ -833,10 +833,7 @@ static int ocfs2_unlink(struct inode *dir, child_locked = 1; if (S_ISDIR(inode->i_mode)) { - if (!ocfs2_empty_dir(inode)) { - status = -ENOTEMPTY; - goto leave; - } else if (inode->i_nlink != 2) { + if (inode->i_nlink != 2 || !ocfs2_empty_dir(inode)) { status = -ENOTEMPTY; goto leave; } @@ -1279,8 +1276,8 @@ static int ocfs2_rename(struct inode *old_dir, if (target_exists) { if (S_ISDIR(new_inode->i_mode)) { - if (!ocfs2_empty_dir(new_inode) || - new_inode->i_nlink != 2) { + if (new_inode->i_nlink != 2 || + !ocfs2_empty_dir(new_inode)) { status = -ENOTEMPTY; goto bail; } |