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

Commit 75e17b3c authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Nathan Scott
Browse files

[XFS] add helper to get xfs_inode from vnode



SGI-PV: 947206
SGI-Modid: xfs-linux-melb:xfs-kern:203960a

Signed-off-by: default avatarChristoph Hellwig <hch@sgi.com>
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent 204ab25f
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@ xfs_page_trace(
	int		mask)
{
	xfs_inode_t	*ip;
	bhv_desc_t	*bdp;
	vnode_t		*vp = LINVFS_GET_VP(inode);
	loff_t		isize = i_size_read(inode);
	loff_t		offset = page_offset(page);
@@ -63,8 +62,7 @@ xfs_page_trace(
	if (page_has_buffers(page))
		xfs_count_page_state(page, &delalloc, &unmapped, &unwritten);

	bdp = vn_bhv_lookup(VN_BHV_HEAD(vp), &xfs_vnodeops);
	ip = XFS_BHVTOI(bdp);
	ip = xfs_vtoi(vp);
	if (!ip->i_rwtrace)
		return;

+2 −4
Original line number Diff line number Diff line
@@ -509,16 +509,14 @@ linvfs_open_exec(
	vnode_t		*vp = LINVFS_GET_VP(inode);
	xfs_mount_t	*mp = XFS_VFSTOM(vp->v_vfsp);
	int		error = 0;
	bhv_desc_t	*bdp;
	xfs_inode_t	*ip;

	if (vp->v_vfsp->vfs_flag & VFS_DMI) {
		bdp = vn_bhv_lookup(VN_BHV_HEAD(vp), &xfs_vnodeops);
		if (!bdp) {
		ip = xfs_vtoi(vp);
		if (!ip) {
			error = -EINVAL;
			goto open_exec_out;
		}
		ip = XFS_BHVTOI(bdp);
		if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ)) {
			error = -XFS_SEND_DATA(mp, DM_EVENT_READ, vp,
					       0, 0, 0, NULL);
+1 −4
Original line number Diff line number Diff line
@@ -145,13 +145,10 @@ xfs_find_handle(

	if (cmd != XFS_IOC_PATH_TO_FSHANDLE) {
		xfs_inode_t	*ip;
		bhv_desc_t	*bhv;
		int		lock_mode;

		/* need to get access to the xfs_inode to read the generation */
		bhv = vn_bhv_lookup_unlocked(VN_BHV_HEAD(vp), &xfs_vnodeops);
		ASSERT(bhv);
		ip = XFS_BHVTOI(bhv);
		ip = xfs_vtoi(vp);
		ASSERT(ip);
		lock_mode = xfs_ilock_map_shared(ip);

+16 −0
Original line number Diff line number Diff line
@@ -58,6 +58,22 @@
#define IS_NOATIME(inode) ((inode->i_sb->s_flags & MS_NOATIME) ||	\
	(S_ISDIR(inode->i_mode) && inode->i_sb->s_flags & MS_NODIRATIME))

/*
 * Get a XFS inode from a given vnode.
 */
xfs_inode_t *
xfs_vtoi(
	struct vnode	*vp)
{
	bhv_desc_t      *bdp;

	bdp = bhv_lookup_range(VN_BHV_HEAD(vp),
			VNODE_POSITION_XFS, VNODE_POSITION_XFS);
	if (unlikely(bdp == NULL))
		return NULL;
	return XFS_BHVTOI(bdp);
}

/*
 * Bring the atime in the XFS inode uptodate.
 * Used before logging the inode to disk or when the Linux inode goes away.
+4 −12
Original line number Diff line number Diff line
@@ -60,8 +60,6 @@ xfs_swapext(
	xfs_bstat_t	*sbp;
	struct file	*fp = NULL, *tfp = NULL;
	vnode_t		*vp, *tvp;
	bhv_desc_t      *bdp, *tbdp;
	vn_bhv_head_t   *bhp, *tbhp;
	static uint	lock_flags = XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL;
	int		ilf_fields, tilf_fields;
	int		error = 0;
@@ -90,13 +88,10 @@ xfs_swapext(
		goto error0;
	}

	bhp = VN_BHV_HEAD(vp);
	bdp = vn_bhv_lookup(bhp, &xfs_vnodeops);
	if (bdp == NULL) {
	ip = xfs_vtoi(vp);
	if (ip == NULL) {
		error = XFS_ERROR(EBADF);
		goto error0;
	} else {
		ip = XFS_BHVTOI(bdp);
	}

	if (((tfp = fget((int)sxp->sx_fdtmp)) == NULL) ||
@@ -105,13 +100,10 @@ xfs_swapext(
		goto error0;
	}

	tbhp = VN_BHV_HEAD(tvp);
	tbdp = vn_bhv_lookup(tbhp, &xfs_vnodeops);
	if (tbdp == NULL) {
	tip = xfs_vtoi(tvp);
	if (tip == NULL) {
		error = XFS_ERROR(EBADF);
		goto error0;
	} else {
		tip = XFS_BHVTOI(tbdp);
	}

	if (ip->i_mount != tip->i_mount) {
Loading