summaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/namei.c
diff options
context:
space:
mode:
authorMark Fasheh <mfasheh@suse.com>2009-02-18 20:41:38 +0100
committerMark Fasheh <mfasheh@suse.com>2009-04-03 20:39:17 +0200
commitb80b549c3520b31d3bbc4b36e37e0a5102da0b94 (patch)
tree403d548a9be6a1e1ae8063a732d520a06defd83c /fs/ocfs2/namei.c
parentocfs2: Enable indexed directories (diff)
downloadlinux-b80b549c3520b31d3bbc4b36e37e0a5102da0b94.tar.xz
linux-b80b549c3520b31d3bbc4b36e37e0a5102da0b94.zip
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 '')
-rw-r--r--fs/ocfs2/namei.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 67113cfddc9b..58c318d2f061 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -834,10 +834,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;
}
@@ -1280,8 +1277,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;
}