mutex_unlock(&lower_inode->i_mutex);
- if (IS_ERR(wh_lower_dentry)) {
+ if (unlikely(IS_ERR(wh_lower_dentry))) {
err = PTR_ERR(wh_lower_dentry);
goto out;
}
case INTERPOSE_PARTIAL:
break;
case INTERPOSE_LOOKUP:
- if ((err = new_dentry_private_data(dentry)))
+ if (unlikely((err = new_dentry_private_data(dentry))))
goto out;
break;
default:
/* default: can only be INTERPOSE_REVAL/REVAL_NEG */
- if ((err = realloc_dentry_private_data(dentry)))
+ if (unlikely((err = realloc_dentry_private_data(dentry))))
goto out;
break;
}
namelen = dentry->d_name.len;
/* No dentries should get created for possible whiteout names. */
- if (!is_validname(name)) {
+ if (unlikely(!is_validname(name))) {
err = -EPERM;
goto out_free;
}
unionfs_lower_dentry_idx(parent_dentry, bindex);
/* if the parent lower dentry does not exist skip this */
- if (!(lower_dir_dentry && lower_dir_dentry->d_inode))
+ if (unlikely(!(lower_dir_dentry && lower_dir_dentry->d_inode)))
continue;
/* also skip it if the parent isn't a directory. */
/* Reuse the whiteout name because its value doesn't change. */
if (!whname) {
whname = alloc_whname(name, namelen);
- if (IS_ERR(whname)) {
+ if (unlikely(IS_ERR(whname))) {
err = PTR_ERR(whname);
goto out_free;
}
/* check if whiteout exists in this branch: lookup .wh.foo */
wh_lower_dentry = lookup_one_len(whname, lower_dir_dentry,
namelen + UNIONFS_WHLEN);
- if (IS_ERR(wh_lower_dentry)) {
+ if (unlikely(IS_ERR(wh_lower_dentry))) {
dput(first_lower_dentry);
unionfs_mntput(first_dentry, first_dentry_offset);
err = PTR_ERR(wh_lower_dentry);
if (wh_lower_dentry->d_inode) {
/* We found a whiteout so lets give up. */
- if (S_ISREG(wh_lower_dentry->d_inode->i_mode)) {
+ if (likely(S_ISREG(wh_lower_dentry->d_inode->i_mode))) {
set_dbend(dentry, bindex);
set_dbopaque(dentry, bindex);
dput(wh_lower_dentry);
/* Now do regular lookup; lookup foo */
lower_dentry = lookup_one_len(name, lower_dir_dentry, namelen);
- if (IS_ERR(lower_dentry)) {
+ if (unlikely(IS_ERR(lower_dentry))) {
dput(first_lower_dentry);
unionfs_mntput(first_dentry, first_dentry_offset);
err = PTR_ERR(lower_dentry);
first_lower_dentry = lookup_one_len(name, lower_dir_dentry,
namelen);
first_dentry_offset = bindex;
- if (IS_ERR(first_lower_dentry)) {
+ if (unlikely(IS_ERR(first_lower_dentry))) {
err = PTR_ERR(first_lower_dentry);
goto out;
}
* dentry.
*/
d_interposed = unionfs_interpose(dentry, dentry->d_sb, lookupmode);
- if (IS_ERR(d_interposed))
+ if (unlikely(IS_ERR(d_interposed)))
err = PTR_ERR(d_interposed);
else if (d_interposed)
dentry = d_interposed;
- if (err)
+ if (unlikely(err))
goto out_drop;
goto out;
err = 0;
goto out;
}
- if (IS_ERR(tmp)) {
+ if (unlikely(IS_ERR(tmp))) {
err = PTR_ERR(tmp);
goto out;
}
void unionfs_destroy_dentry_cache(void)
{
- if (unionfs_dentry_cachep)
+ if (likely(unionfs_dentry_cachep))
kmem_cache_destroy(unionfs_dentry_cachep);
}
void free_dentry_private_data(struct dentry *dentry)
{
- if (!dentry || !dentry->d_fsdata)
+ if (unlikely(!dentry || !dentry->d_fsdata))
return;
kmem_cache_free(unionfs_dentry_cachep, dentry->d_fsdata);
dentry->d_fsdata = NULL;
size = sizeof(struct path) * sbmax(dentry->d_sb);
p = krealloc(info->lower_paths, size, GFP_ATOMIC);
- if (!p)
+ if (unlikely(!p))
return -ENOMEM;
info->lower_paths = p;
/* UNIONFS_D(dentry)->lock must be locked */
static int realloc_dentry_private_data(struct dentry *dentry)
{
- if (!__realloc_dentry_private_data(dentry))
+ if (likely(!__realloc_dentry_private_data(dentry)))
return 0;
kfree(UNIONFS_D(dentry)->lower_paths);
BUG_ON(info);
info = kmem_cache_alloc(unionfs_dentry_cachep, GFP_ATOMIC);
- if (!info)
+ if (unlikely(!info))
return -ENOMEM;
mutex_init(&info->lock);
dentry->d_fsdata = info;
- if (!__realloc_dentry_private_data(dentry))
+ if (likely(!__realloc_dentry_private_data(dentry)))
return 0;
mutex_unlock(&info->lock);
#endif /* ALLOC_LOWER_ND_FILE */
memset(nd, 0, sizeof(struct nameidata));
- if (!flags)
+ if (unlikely(!flags))
return err;
switch (flags) {
nd->intent.open.flags |= (FMODE_READ | FMODE_WRITE);
#ifdef ALLOC_LOWER_ND_FILE
file = kzalloc(sizeof(struct file), GFP_KERNEL);
- if (!file) {
+ if (unlikely(!file)) {
err = -ENOMEM;
break; /* exit switch statement and thus return */
}
{
if (!nd->intent.open.file)
return;
- else if (!err)
+ else if (likely(!err))
release_open_intent(nd);
#ifdef ALLOC_LOWER_ND_FILE
kfree(nd->intent.open.file);