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++;
* 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;
}
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;
goto out;
} else if (file->f_pos > 0) {
uds = find_rdstate(inode, file->f_pos);
- if (!uds) {
+ if (unlikely(!uds)) {
err = -ESTALE;
goto out;
}
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;
/* 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;
}
/* 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;
}
/* 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) {
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;
} 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
err = -ENOMEM;
name = __getname();
- if (!name)
+ if (unlikely(!name))
goto out;
strcpy(name, UNIONFS_WHPFX);
p = name + UNIONFS_WHLEN;
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;
}
}
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);
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;
/*
* 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,
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);
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;
}
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);
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);
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);
}