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

Commit c19b3b05 authored by Dave Chinner's avatar Dave Chinner Committed by Dave Chinner
Browse files

xfs: mode di_mode to vfs inode



Move the di_mode value from the xfs_icdinode to the VFS inode, reducing
the xfs_icdinode byte another 2 bytes and collapsing another 2 byte hole
in the structure.

Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 83e06f21
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -912,7 +912,7 @@ xfs_bmap_local_to_extents(
	 * We don't want to deal with the case of keeping inode data inline yet.
	 * So sending the data fork of a regular inode is invalid.
	 */
	ASSERT(!(S_ISREG(ip->i_d.di_mode) && whichfork == XFS_DATA_FORK));
	ASSERT(!(S_ISREG(VFS_I(ip)->i_mode) && whichfork == XFS_DATA_FORK));
	ifp = XFS_IFORK_PTR(ip, whichfork);
	ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL);

@@ -1079,7 +1079,7 @@ xfs_bmap_add_attrfork_local(
	if (ip->i_df.if_bytes <= XFS_IFORK_DSIZE(ip))
		return 0;

	if (S_ISDIR(ip->i_d.di_mode)) {
	if (S_ISDIR(VFS_I(ip)->i_mode)) {
		memset(&dargs, 0, sizeof(dargs));
		dargs.geo = ip->i_mount->m_dir_geo;
		dargs.dp = ip;
@@ -1091,7 +1091,7 @@ xfs_bmap_add_attrfork_local(
		return xfs_dir2_sf_to_block(&dargs);
	}

	if (S_ISLNK(ip->i_d.di_mode))
	if (S_ISLNK(VFS_I(ip)->i_mode))
		return xfs_bmap_local_to_extents(tp, ip, firstblock, 1,
						 flags, XFS_DATA_FORK,
						 xfs_symlink_local_to_remote);
+6 −6
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@ xfs_dir_isempty(
{
	xfs_dir2_sf_hdr_t	*sfp;

	ASSERT(S_ISDIR(dp->i_d.di_mode));
	ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
	if (dp->i_d.di_size == 0)	/* might happen during shutdown. */
		return 1;
	if (dp->i_d.di_size > XFS_IFORK_DSIZE(dp))
@@ -231,7 +231,7 @@ xfs_dir_init(
	struct xfs_da_args *args;
	int		error;

	ASSERT(S_ISDIR(dp->i_d.di_mode));
	ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
	error = xfs_dir_ino_validate(tp->t_mountp, pdp->i_ino);
	if (error)
		return error;
@@ -266,7 +266,7 @@ xfs_dir_createname(
	int			rval;
	int			v;		/* type-checking value */

	ASSERT(S_ISDIR(dp->i_d.di_mode));
	ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
	if (inum) {
		rval = xfs_dir_ino_validate(tp->t_mountp, inum);
		if (rval)
@@ -364,7 +364,7 @@ xfs_dir_lookup(
	int		v;		/* type-checking value */
	int		lock_mode;

	ASSERT(S_ISDIR(dp->i_d.di_mode));
	ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
	XFS_STATS_INC(dp->i_mount, xs_dir_lookup);

	/*
@@ -443,7 +443,7 @@ xfs_dir_removename(
	int		rval;
	int		v;		/* type-checking value */

	ASSERT(S_ISDIR(dp->i_d.di_mode));
	ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
	XFS_STATS_INC(dp->i_mount, xs_dir_remove);

	args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS);
@@ -505,7 +505,7 @@ xfs_dir_replace(
	int		rval;
	int		v;		/* type-checking value */

	ASSERT(S_ISDIR(dp->i_d.di_mode));
	ASSERT(S_ISDIR(VFS_I(dp)->i_mode));

	rval = xfs_dir_ino_validate(tp->t_mountp, inum);
	if (rval)
+4 −4
Original line number Diff line number Diff line
@@ -202,13 +202,12 @@ xfs_inode_from_disk(
	struct xfs_icdinode	*to = &ip->i_d;
	struct inode		*inode = VFS_I(ip);

	to->di_mode = be16_to_cpu(from->di_mode);
	to->di_version = from ->di_version;

	/*
	 * Convert v1 inodes immediately to v2 inode format as this is the
	 * minimum inode version format we support in the rest of the code.
	 */
	to->di_version = from->di_version;
	if (to->di_version == 1) {
		set_nlink(inode, be16_to_cpu(from->di_onlink));
		to->di_projid_lo = 0;
@@ -238,6 +237,7 @@ xfs_inode_from_disk(
	inode->i_ctime.tv_sec = (int)be32_to_cpu(from->di_ctime.t_sec);
	inode->i_ctime.tv_nsec = (int)be32_to_cpu(from->di_ctime.t_nsec);
	inode->i_generation = be32_to_cpu(from->di_gen);
	inode->i_mode = be16_to_cpu(from->di_mode);

	to->di_size = be64_to_cpu(from->di_size);
	to->di_nblocks = be64_to_cpu(from->di_nblocks);
@@ -270,7 +270,6 @@ xfs_inode_to_disk(
	to->di_magic = cpu_to_be16(XFS_DINODE_MAGIC);
	to->di_onlink = 0;

	to->di_mode = cpu_to_be16(from->di_mode);
	to->di_version = from->di_version;
	to->di_format = from->di_format;
	to->di_uid = cpu_to_be32(from->di_uid);
@@ -287,6 +286,7 @@ xfs_inode_to_disk(
	to->di_ctime.t_nsec = cpu_to_be32(inode->i_ctime.tv_nsec);
	to->di_nlink = cpu_to_be32(inode->i_nlink);
	to->di_gen = cpu_to_be32(inode->i_generation);
	to->di_mode = cpu_to_be16(inode->i_mode);

	to->di_size = cpu_to_be64(from->di_size);
	to->di_nblocks = cpu_to_be64(from->di_nblocks);
@@ -501,7 +501,7 @@ xfs_iread(
		 * the inode is already free and not try to mess
		 * with the uninitialized part of it.
		 */
		ip->i_d.di_mode = 0;
		VFS_I(ip)->i_mode = 0;
	}

	ASSERT(ip->i_d.di_version >= 2);
+0 −1
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ struct xfs_dinode;
 * format specific structures at the appropriate time.
 */
struct xfs_icdinode {
	__uint16_t	di_mode;	/* mode and type of file */
	__int8_t	di_version;	/* inode version */
	__int8_t	di_format;	/* format of di_c data */
	__uint16_t	di_flushiter;	/* incremented on flush */
+1 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ xfs_iformat_fork(
		return -EFSCORRUPTED;
	}

	switch (ip->i_d.di_mode & S_IFMT) {
	switch (VFS_I(ip)->i_mode & S_IFMT) {
	case S_IFIFO:
	case S_IFCHR:
	case S_IFBLK:
Loading