stored++;
}
if (f_pos == 1) {
- if (filldir(dirent, "..", 2, f_pos, filp->f_dentry->d_parent->d_inode->i_ino, DT_DIR) < 0)
+ if (filldir(dirent, "..", 2, f_pos, parent_ino(filp->f_dentry), DT_DIR) < 0)
return stored;
filp->f_pos = f_pos = 2;
stored++;
case 0:
scan_dir_for_removable (parent);
err = (*filldir) (dirent, "..", 2, file->f_pos,
- file->f_dentry->d_parent->d_inode->i_ino, DT_DIR);
+ parent_ino(file->f_dentry), DT_DIR);
if (err == -EINVAL) break;
if (err < 0) return err;
file->f_pos++;
if (!memcmp(de->name,MSDOS_DOT,11))
inum = inode->i_ino;
else if (!memcmp(de->name,MSDOS_DOTDOT,11)) {
- inum = filp->f_dentry->d_parent->d_inode->i_ino;
+ inum = parent_ino(filp->f_dentry);
} else {
struct inode *tmp = fat_iget(sb, ino);
if (tmp) {
/* Handle the case of the '..' directory */
if (de->name_len[0] == 1 && de->name[0] == 1) {
- inode_number = filp->f_dentry->d_parent->d_inode->i_ino;
+ inode_number = parent_ino(filp->f_dentry);
if (filldir(dirent, "..", 2, filp->f_pos, inode_number, DT_DIR) < 0)
break;
filp->f_pos += de_len;
offset++;
}
if (offset == 1) {
- D1(printk(KERN_DEBUG "Dirent 1: \"..\", ino #%lu\n", filp->f_dentry->d_parent->d_inode->i_ino));
- if (filldir(dirent, "..", 2, 1, filp->f_dentry->d_parent->d_inode->i_ino, DT_DIR) < 0)
+ D1(printk(KERN_DEBUG "Dirent 1: \"..\", ino #%lu\n", parent_ino(filp->f_dentry)));
+ if (filldir(dirent, "..", 2, 1, parent_ino(filp->f_dentry), DT_DIR) < 0)
goto out;
offset++;
}
filp->f_pos = 1;
}
if (filp->f_pos == 1) {
- if (filldir(dirent, "..", 2, 1,
- dentry->d_parent->d_inode->i_ino, DT_DIR))
+ if (filldir(dirent, "..", 2, 1, parent_ino(dentry), DT_DIR))
goto out;
filp->f_pos = 2;
}
*maxsize = 2;
return 1;
}
- *datap++ = ino_t_to_u32(dentry->d_parent->d_inode->i_ino);
+ *datap++ = ino_t_to_u32(parent_ino(dentry));
*maxsize = 3;
return 2;
}
fhp->fh_handle.ofh_dev = htonl((major(exp->ex_dev)<<16)| minor(exp->ex_dev));
fhp->fh_handle.ofh_xdev = fhp->fh_handle.ofh_dev;
fhp->fh_handle.ofh_xino = ino_t_to_u32(exp->ex_ino);
- fhp->fh_handle.ofh_dirino = ino_t_to_u32(dentry->d_parent->d_inode->i_ino);
+ fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry));
if (inode)
_fh_update_old(dentry, exp, &fhp->fh_handle);
} else {
ntfs_debug(DEBUG_OTHER, __FUNCTION__ "(): Calling "
"filldir for .. with len 2, f_pos 0x%Lx, "
"inode %lu, DT_DIR.\n", filp->f_pos,
- filp->f_dentry->d_parent->d_inode->i_ino);
+ parent_ino(filp->f_dentry));
cb.ret_code = filldir(dirent, "..", 2, filp->f_pos,
- filp->f_dentry->d_parent->d_inode->i_ino,
- DT_DIR);
+ parent_ino(filp->f_dentry), DT_DIR);
if (cb.ret_code)
goto done;
cb.pl++;
/* fall through */
case 1:
if (filldir(dirent, "..", 2, i,
- filp->f_dentry->d_parent->d_inode->i_ino,
+ parent_ino(filp->f_dentry),
DT_DIR) < 0)
return 0;
i++;
filp->f_pos++;
/* fallthrough */
case 1:
- if (filldir(dirent, "..", 2, i, dentry->d_parent->d_inode->i_ino, DT_DIR) < 0)
+ if (filldir(dirent, "..", 2, i, parent_ino(dentry), DT_DIR) < 0)
break;
i++;
filp->f_pos++;
filp->f_pos = 1;
/* fallthrough */
case 1:
- if (filldir(dirent, "..", 2, 1,
- dentry->d_parent->d_inode->i_ino, DT_DIR) < 0)
+ if (filldir(dirent, "..", 2, 1, parent_ino(dentry), DT_DIR) < 0)
goto out;
filp->f_pos = 2;
}
extern int inode_change_ok(struct inode *, struct iattr *);
extern int inode_setattr(struct inode *, struct iattr *);
+static inline ino_t parent_ino(struct dentry *dentry)
+{
+ ino_t res;
+ spin_lock(&dcache_lock);
+ res = dentry->d_parent->d_inode->i_ino;
+ spin_unlock(&dcache_lock);
+ return res;
+}
+
#endif /* __KERNEL__ */
#endif /* _LINUX_FS_H */