mutex_lock(&parent->d_inode->i_mutex);
bh = osd_ldiskfs_find_entry(parent->d_inode, &dentry->d_name, &de,
NULL, NULL);
- if (bh == NULL) {
+ if (IS_ERR(bh)) {
mutex_unlock(&parent->d_inode->i_mutex);
- RETURN(-ENOENT);
+ RETURN(PTR_ERR(bh));
}
CDEBUG(D_INODE, "%s: el %s:%lu to remote parent %lu.\n", osd_name(osd),
name, obj->oo_inode->i_ino, parent->d_inode->i_ino);
mutex_lock(&parent->d_inode->i_mutex);
bh = osd_ldiskfs_find_entry(parent->d_inode, &dentry->d_name, &de,
NULL, NULL);
- if (bh == NULL) {
- rc = -ENOENT;
+ if (IS_ERR(bh)) {
+ rc = PTR_ERR(bh);
} else {
rc = 0;
osd_id_gen(id, le32_to_cpu(de->inode), OSD_OII_NOGEN);
ll_vfs_dq_init(parent);
mutex_lock(&parent->i_mutex);
bh = osd_ldiskfs_find_entry(parent, &child->d_name, &de, NULL, NULL);
- if (bh == NULL)
- GOTO(out, rc = -ENOENT);
+ if (IS_ERR(bh))
+ GOTO(out, rc = PTR_ERR(bh));
if (le32_to_cpu(de->inode) == id->oii_ino)
GOTO(out, rc = 1);
GOTO(out, rc);
out:
- brelse(bh);
+ if (!IS_ERR(bh))
+ brelse(bh);
mutex_unlock(&parent->i_mutex);
return rc;
}
ll_vfs_dq_init(dir);
mutex_lock(&dir->i_mutex);
- rc = -ENOENT;
bh = osd_ldiskfs_find_entry(dir, &child->d_name, &de, NULL, NULL);
- if (bh) {
+ if (IS_ERR(bh)) {
+ rc = PTR_ERR(bh);
+ } else {
rc = ldiskfs_delete_entry(th, dir, de, bh);
brelse(bh);
}
bh = osd_ldiskfs_find_entry(dir, &child->d_name, &de, NULL, NULL);
mutex_unlock(&dir->i_mutex);
- if (bh == NULL)
- RETURN(-ENOENT);
+ if (IS_ERR(bh))
+ RETURN(PTR_ERR(bh));
osd_id_gen(id, le32_to_cpu(de->inode), OSD_OII_NOGEN);
brelse(bh);
mutex_lock(&src_parent->i_mutex);
mutex_lock(&dir->i_mutex);
bh = osd_ldiskfs_find_entry(dir, &tgt_child->d_name, &de, NULL, NULL);
- if (bh != NULL) {
+ if (!IS_ERR(bh)) {
/* XXX: If some other object occupied the same slot. And If such
* inode is zero-sized and with SUID+SGID, then means it is
* a new created one. Maybe we can remove it and insert the
bh = osd_ldiskfs_find_entry(src_parent, &src_child->d_name, &de,
NULL, NULL);
- if (unlikely(bh == NULL))
- GOTO(unlock, rc = -ENOENT);
+ if (unlikely(IS_ERR(bh)))
+ GOTO(unlock, rc = PTR_ERR(bh));
rc = ldiskfs_delete_entry(jh, src_parent, de, bh);
brelse(bh);