From: Erez Zadok <ezk@cs.sunysb.edu>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
viro@ftp.linux.org.uk, hch@infradead.org,
Erez Zadok <ezk@cs.sunysb.edu>
Subject: [PATCH 13/25] Unionfs: add un/likely conditionals on dir ops
Date: Tue, 25 Sep 2007 23:09:52 -0400 [thread overview]
Message-ID: <11907762104036-git-send-email-ezk@cs.sunysb.edu> (raw)
In-Reply-To: <11907762042481-git-send-email-ezk@cs.sunysb.edu>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
fs/unionfs/dirfops.c | 22 +++++++++++-----------
fs/unionfs/dirhelper.c | 30 +++++++++++++++---------------
2 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/fs/unionfs/dirfops.c b/fs/unionfs/dirfops.c
index c923e58..fa2df88 100644
--- a/fs/unionfs/dirfops.c
+++ b/fs/unionfs/dirfops.c
@@ -63,7 +63,7 @@ static int unionfs_filldir(void *dirent, const char *name, int namelen,
off_t pos = rdstate2offset(buf->rdstate);
u64 unionfs_ino = ino;
- if (!err) {
+ if (likely(!err)) {
err = buf->filldir(buf->dirent, name, namelen, pos,
unionfs_ino, d_type);
buf->rdstate->offset++;
@@ -74,7 +74,7 @@ static int unionfs_filldir(void *dirent, const char *name, int namelen,
* If we did fill it, stuff it in our hash, otherwise return an
* error.
*/
- if (err) {
+ if (unlikely(err)) {
buf->filldir_error = err;
goto out;
}
@@ -99,7 +99,7 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)
unionfs_read_lock(file->f_path.dentry->d_sb);
- if ((err = unionfs_file_revalidate(file, false)))
+ if (unlikely((err = unionfs_file_revalidate(file, false))))
goto out;
inode = file->f_path.dentry->d_inode;
@@ -110,7 +110,7 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)
goto out;
} else if (file->f_pos > 0) {
uds = find_rdstate(inode, file->f_pos);
- if (!uds) {
+ if (unlikely(!uds)) {
err = -ESTALE;
goto out;
}
@@ -124,7 +124,7 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)
while (uds->bindex <= bend) {
lower_file = unionfs_lower_file_idx(file, uds->bindex);
- if (!lower_file) {
+ if (unlikely(!lower_file)) {
uds->bindex++;
uds->dirpos = 0;
continue;
@@ -141,7 +141,7 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)
/* Read starting from where we last left off. */
offset = vfs_llseek(lower_file, uds->dirpos, SEEK_SET);
- if (offset < 0) {
+ if (unlikely(offset < 0)) {
err = offset;
goto out;
}
@@ -149,7 +149,7 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)
/* Save the position for when we continue. */
offset = vfs_llseek(lower_file, 0, SEEK_CUR);
- if (offset < 0) {
+ if (unlikely(offset < 0)) {
err = offset;
goto out;
}
@@ -158,10 +158,10 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)
/* Copy the atime. */
fsstack_copy_attr_atime(inode, lower_file->f_path.dentry->d_inode);
- if (err < 0)
+ if (unlikely(err < 0))
goto out;
- if (buf.filldir_error)
+ if (unlikely(buf.filldir_error))
break;
if (!buf.entries_written) {
@@ -201,7 +201,7 @@ static loff_t unionfs_dir_llseek(struct file *file, loff_t offset, int origin)
unionfs_read_lock(file->f_path.dentry->d_sb);
- if ((err = unionfs_file_revalidate(file, false)))
+ if (unlikely((err = unionfs_file_revalidate(file, false))))
goto out;
rdstate = UNIONFS_F(file)->rdstate;
@@ -241,7 +241,7 @@ static loff_t unionfs_dir_llseek(struct file *file, loff_t offset, int origin)
} else {
rdstate = find_rdstate(file->f_path.dentry->d_inode,
offset);
- if (rdstate) {
+ if (likely(rdstate)) {
UNIONFS_F(file)->rdstate = rdstate;
err = rdstate->offset;
} else
diff --git a/fs/unionfs/dirhelper.c b/fs/unionfs/dirhelper.c
index a72f711..d481ba4 100644
--- a/fs/unionfs/dirhelper.c
+++ b/fs/unionfs/dirhelper.c
@@ -43,7 +43,7 @@ int do_delete_whiteouts(struct dentry *dentry, int bindex,
err = -ENOMEM;
name = __getname();
- if (!name)
+ if (unlikely(!name))
goto out;
strcpy(name, UNIONFS_WHPFX);
p = name + UNIONFS_WHLEN;
@@ -65,14 +65,14 @@ int do_delete_whiteouts(struct dentry *dentry, int bindex,
lookup_one_len(name, lower_dir_dentry,
cursor->namelen +
UNIONFS_WHLEN);
- if (IS_ERR(lower_dentry)) {
+ if (unlikely(IS_ERR(lower_dentry))) {
err = PTR_ERR(lower_dentry);
break;
}
- if (lower_dentry->d_inode)
+ if (likely(lower_dentry->d_inode))
err = vfs_unlink(lower_dir, lower_dentry);
dput(lower_dentry);
- if (err)
+ if (unlikely(err))
break;
}
}
@@ -102,7 +102,7 @@ int delete_whiteouts(struct dentry *dentry, int bindex,
BUG_ON(bindex < dbstart(dentry));
BUG_ON(bindex > dbend(dentry));
err = is_robranch_super(sb, bindex);
- if (err)
+ if (unlikely(err))
goto out;
lower_dir_dentry = unionfs_lower_dentry_idx(dentry, bindex);
@@ -160,7 +160,7 @@ static int readdir_util_callback(void *dirent, const char *name, int namelen,
found = find_filldir_node(buf->rdstate, name, namelen);
/* If it was found in the table there was a previous whiteout. */
- if (found)
+ if (likely(found))
goto out;
/*
@@ -168,7 +168,7 @@ static int readdir_util_callback(void *dirent, const char *name, int namelen,
* empty.
*/
err = -ENOTEMPTY;
- if ((buf->mode == RD_CHECK_EMPTY) && !whiteout)
+ if (unlikely((buf->mode == RD_CHECK_EMPTY) && !whiteout))
goto out;
err = add_filldir_node(buf->rdstate, name, namelen,
@@ -194,7 +194,7 @@ int check_empty(struct dentry *dentry, struct unionfs_dir_state **namelist)
BUG_ON(!S_ISDIR(dentry->d_inode->i_mode));
- if ((err = unionfs_partial_lookup(dentry)))
+ if (unlikely((err = unionfs_partial_lookup(dentry))))
goto out;
bstart = dbstart(dentry);
@@ -204,14 +204,14 @@ int check_empty(struct dentry *dentry, struct unionfs_dir_state **namelist)
bend = bopaque;
buf = kmalloc(sizeof(struct unionfs_rdutil_callback), GFP_KERNEL);
- if (!buf) {
+ if (unlikely(!buf)) {
err = -ENOMEM;
goto out;
}
buf->err = 0;
buf->mode = RD_CHECK_EMPTY;
buf->rdstate = alloc_rdstate(dentry->d_inode, bstart);
- if (!buf->rdstate) {
+ if (unlikely(!buf->rdstate)) {
err = -ENOMEM;
goto out;
}
@@ -233,7 +233,7 @@ int check_empty(struct dentry *dentry, struct unionfs_dir_state **namelist)
dentry_open(lower_dentry,
unionfs_lower_mnt_idx(dentry, bindex),
O_RDONLY);
- if (IS_ERR(lower_file)) {
+ if (unlikely(IS_ERR(lower_file))) {
err = PTR_ERR(lower_file);
dput(lower_dentry);
branchput(sb, bindex);
@@ -245,7 +245,7 @@ int check_empty(struct dentry *dentry, struct unionfs_dir_state **namelist)
buf->rdstate->bindex = bindex;
err = vfs_readdir(lower_file,
readdir_util_callback, buf);
- if (buf->err)
+ if (unlikely(buf->err))
err = buf->err;
} while ((err >= 0) && buf->filldir_called);
@@ -253,15 +253,15 @@ int check_empty(struct dentry *dentry, struct unionfs_dir_state **namelist)
fput(lower_file);
branchput(sb, bindex);
- if (err < 0)
+ if (unlikely(err < 0))
goto out;
}
out:
- if (buf) {
+ if (likely(buf)) {
if (namelist && !err)
*namelist = buf->rdstate;
- else if (buf->rdstate)
+ else if (likely(buf->rdstate))
free_rdstate(buf->rdstate);
kfree(buf);
}
--
1.5.2.2
next prev parent reply other threads:[~2007-09-26 3:31 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-26 3:09 [GIT PULL -mm] 00/25 Unionfs updates/cleanups/fixes Erez Zadok
2007-09-26 3:09 ` [PATCH 01/25] Unionfs: Simplify unionfs_get_nlinks Erez Zadok
2007-09-26 3:09 ` [PATCH 02/25] Unionfs: Remove unused #defines Erez Zadok
2007-09-26 3:09 ` [PATCH 03/25] Unionfs: display informational messages only if debug is on Erez Zadok
2007-09-26 8:36 ` Jan Engelhardt
2007-09-26 14:01 ` Erez Zadok
2007-09-26 15:24 ` Jan Engelhardt
2007-09-26 15:28 ` Erez Zadok
2007-09-26 3:09 ` [PATCH 04/25] Unionfs: cache-coherency fixes Erez Zadok
2007-09-26 3:09 ` [PATCH 05/25] Unionfs: cast page->index loff_t before shifting Erez Zadok
2007-09-26 8:31 ` Christoph Hellwig
2007-09-26 13:44 ` Erez Zadok
2007-09-26 3:09 ` [PATCH 06/25] Unionfs: minor coding style updates Erez Zadok
2007-09-26 3:09 ` [PATCH 07/25] Unionfs: add lower nameidata debugging support Erez Zadok
2007-09-26 3:09 ` [PATCH 08/25] Unionfs: lower nameidata support for nfsv4 Erez Zadok
2007-09-26 3:09 ` [PATCH 09/25] Unionfs: add un/likely conditionals on common fileops Erez Zadok
2007-09-26 3:09 ` [PATCH 10/25] Unionfs: add un/likely conditionals on copyup ops Erez Zadok
2007-09-26 4:32 ` Kok, Auke
2007-09-26 13:40 ` Erez Zadok
2007-09-26 15:23 ` Kyle Moffett
2007-09-26 15:43 ` Erez Zadok
2007-09-26 16:47 ` Jan Engelhardt
2007-09-26 16:51 ` Erez Zadok
2007-09-26 18:34 ` Adrian Bunk
2007-09-26 3:09 ` [PATCH 11/25] Unionfs: add un/likely conditionals on debug ops Erez Zadok
2007-09-26 21:34 ` roel
2007-09-26 3:09 ` [PATCH 12/25] Unionfs: add un/likely conditionals on dentry ops Erez Zadok
2007-09-26 3:09 ` Erez Zadok [this message]
2007-09-26 21:40 ` [PATCH 13/25] Unionfs: add un/likely conditionals on dir ops roel
2007-09-27 14:28 ` Erez Zadok
2007-09-26 3:09 ` [PATCH 14/25] Unionfs: add un/likely conditionals on headers Erez Zadok
2007-09-26 3:09 ` [PATCH 15/25] Unionfs: add un/likely conditionals on fileops Erez Zadok
2007-09-26 3:09 ` [PATCH 16/25] Unionfs: add un/likely conditionals on inode ops Erez Zadok
2007-09-26 3:09 ` [PATCH 17/25] Unionfs: add un/likely conditionals on lookup ops Erez Zadok
2007-09-26 3:09 ` [PATCH 18/25] Unionfs: add un/likely conditionals on super ops Erez Zadok
2007-09-26 3:09 ` [PATCH 19/25] Unionfs: add un/likely conditionals on mmap ops Erez Zadok
2007-09-26 3:09 ` [PATCH 20/25] Unionfs: add un/likely conditionals on rename ops Erez Zadok
2007-09-26 3:10 ` [PATCH 21/25] Unionfs: add un/likely conditionals on readdir ops Erez Zadok
2007-09-26 3:10 ` [PATCH 22/25] Unionfs: add un/likely conditionals on common subr Erez Zadok
2007-09-26 3:10 ` [PATCH 23/25] Unionfs: add un/likely conditionals on unlink ops Erez Zadok
2007-09-26 3:10 ` [PATCH 24/25] Unionfs: add un/likely conditionals on xattr ops Erez Zadok
2007-09-26 3:10 ` [PATCH 25/25] Unionfs: use poison.h for safe poison pointers Erez Zadok
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11907762104036-git-send-email-ezk@cs.sunysb.edu \
--to=ezk@cs.sunysb.edu \
--cc=akpm@linux-foundation.org \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@ftp.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).