Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01651646 authored by David Chinner's avatar David Chinner Committed by Lachlan McIlroy
Browse files

[XFS] Avoid directly referencing the VFS inode.



In several places we directly convert from the XFS inode
to the linux (VFS) inode by a simple deference of ip->i_vnode.
We should not do this - a helper function should be used to
extract the VFS inode from the XFS inode.

Introduce the function VFS_I() to extract the VFS inode
from the XFS inode. The name was chosen to match XFS_I() which
is used to extract the XFS inode from the VFS inode.

SGI-PV: 981498

SGI-Modid: xfs-linux-melb:xfs-kern:31720a

Signed-off-by: default avatarDavid Chinner <david@fromorbit.com>
Signed-off-by: default avatarNiv Sardi <xaiki@sgi.com>
Signed-off-by: default avatarChristoph Hellwig <hch@infradead.org>
Signed-off-by: default avatarLachlan McIlroy <lachlan@sgi.com>
parent 3790689f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ xfs_nfs_get_inode(
	}

	xfs_iunlock(ip, XFS_ILOCK_SHARED);
	return ip->i_vnode;
	return VFS_I(ip);
}

STATIC struct dentry *
@@ -219,9 +219,9 @@ xfs_fs_get_parent(
	if (unlikely(error))
		return ERR_PTR(-error);

	parent = d_alloc_anon(cip->i_vnode);
	parent = d_alloc_anon(VFS_I(cip));
	if (unlikely(!parent)) {
		iput(cip->i_vnode);
		iput(VFS_I(cip));
		return ERR_PTR(-ENOMEM);
	}
	return parent;
+3 −3
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ xfs_tosspages(
	xfs_off_t	last,
	int		fiopt)
{
	struct address_space *mapping = ip->i_vnode->i_mapping;
	struct address_space *mapping = VFS_I(ip)->i_mapping;

	if (mapping->nrpages)
		truncate_inode_pages(mapping, first);
@@ -44,7 +44,7 @@ xfs_flushinval_pages(
	xfs_off_t	last,
	int		fiopt)
{
	struct address_space *mapping = ip->i_vnode->i_mapping;
	struct address_space *mapping = VFS_I(ip)->i_mapping;
	int		ret = 0;

	if (mapping->nrpages) {
@@ -64,7 +64,7 @@ xfs_flush_pages(
	uint64_t	flags,
	int		fiopt)
{
	struct address_space *mapping = ip->i_vnode->i_mapping;
	struct address_space *mapping = VFS_I(ip)->i_mapping;
	int		ret = 0;
	int		ret2;

+7 −7
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ void
xfs_synchronize_atime(
	xfs_inode_t	*ip)
{
	struct inode	*inode = ip->i_vnode;
	struct inode	*inode = VFS_I(ip);

	if (inode) {
		ip->i_d.di_atime.t_sec = (__int32_t)inode->i_atime.tv_sec;
@@ -79,7 +79,7 @@ void
xfs_mark_inode_dirty_sync(
	xfs_inode_t	*ip)
{
	struct inode	*inode = ip->i_vnode;
	struct inode	*inode = VFS_I(ip);

	if (inode)
		mark_inode_dirty_sync(inode);
@@ -299,7 +299,7 @@ xfs_vn_mknod(
	if (unlikely(error))
		goto out_free_acl;

	inode = ip->i_vnode;
	inode = VFS_I(ip);

	error = xfs_init_security(inode, dir);
	if (unlikely(error))
@@ -366,7 +366,7 @@ xfs_vn_lookup(
		return NULL;
	}

	return d_splice_alias(cip->i_vnode, dentry);
	return d_splice_alias(VFS_I(cip), dentry);
}

STATIC struct dentry *
@@ -399,12 +399,12 @@ xfs_vn_ci_lookup(

	/* if exact match, just splice and exit */
	if (!ci_name.name)
		return d_splice_alias(ip->i_vnode, dentry);
		return d_splice_alias(VFS_I(ip), dentry);

	/* else case-insensitive match... */
	dname.name = ci_name.name;
	dname.len = ci_name.len;
	dentry = d_add_ci(ip->i_vnode, dentry, &dname);
	dentry = d_add_ci(VFS_I(ip), dentry, &dname);
	kmem_free(ci_name.name);
	return dentry;
}
@@ -478,7 +478,7 @@ xfs_vn_symlink(
	if (unlikely(error))
		goto out;

	inode = cip->i_vnode;
	inode = VFS_I(cip);

	error = xfs_init_security(inode, dir);
	if (unlikely(error))
+0 −6
Original line number Diff line number Diff line
@@ -33,10 +33,4 @@ struct xfs_inode;
extern void xfs_ichgtime(struct xfs_inode *, int);
extern void xfs_ichgtime_fast(struct xfs_inode *, struct inode *, int);

#define xfs_vtoi(vp) \
	((struct xfs_inode *)vn_to_inode(vp)->i_private)

#define XFS_I(inode) \
	((struct xfs_inode *)(inode)->i_private)

#endif /* __XFS_IOPS_H__ */
+1 −1
Original line number Diff line number Diff line
@@ -137,7 +137,7 @@ xfs_iozero(
	struct address_space	*mapping;
	int			status;

	mapping = ip->i_vnode->i_mapping;
	mapping = VFS_I(ip)->i_mapping;
	do {
		unsigned offset, bytes;
		void *fsdata;
Loading