public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 02/16] xfs: take inode version into account in XFS_LITINO
Date: Mon, 25 Feb 2013 12:31:27 +1100	[thread overview]
Message-ID: <1361755901-12453-3-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1361755901-12453-1-git-send-email-david@fromorbit.com>

From: Christoph Hellwig <hch@lst.de>

Add a version argument to XFS_LITINO so that it can return different values
depending on the inode version.  This is required for the upcoming v3 inodes
with a larger fixed layout dinode.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
---
 fs/xfs/xfs_attr_leaf.c |    6 ++++--
 fs/xfs/xfs_bmap.c      |    4 ++--
 fs/xfs/xfs_dinode.h    |    6 +++---
 fs/xfs/xfs_inode.h     |    5 +++--
 fs/xfs/xfs_vnodeops.c  |    2 +-
 5 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c
index ee24993..f96a734 100644
--- a/fs/xfs/xfs_attr_leaf.c
+++ b/fs/xfs/xfs_attr_leaf.c
@@ -172,7 +172,8 @@ xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes)
 	int dsize;
 	xfs_mount_t *mp = dp->i_mount;
 
-	offset = (XFS_LITINO(mp) - bytes) >> 3; /* rounded down */
+	/* rounded down */
+	offset = (XFS_LITINO(mp, dp->i_d.di_version) - bytes) >> 3;
 
 	switch (dp->i_d.di_format) {
 	case XFS_DINODE_FMT_DEV:
@@ -243,7 +244,8 @@ xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes)
 	minforkoff = roundup(minforkoff, 8) >> 3;
 
 	/* attr fork btree root can have at least this many key/ptr pairs */
-	maxforkoff = XFS_LITINO(mp) - XFS_BMDR_SPACE_CALC(MINABTPTRS);
+	maxforkoff = XFS_LITINO(mp, dp->i_d.di_version) -
+			XFS_BMDR_SPACE_CALC(MINABTPTRS);
 	maxforkoff = maxforkoff >> 3;	/* rounded down */
 
 	if (offset >= maxforkoff)
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index d490fe8..20efb39 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -228,13 +228,13 @@ xfs_default_attroffset(
 	uint			offset;
 
 	if (mp->m_sb.sb_inodesize == 256) {
-		offset = XFS_LITINO(mp) -
+		offset = XFS_LITINO(mp, ip->i_d.di_version) -
 				XFS_BMDR_SPACE_CALC(MINABTPTRS);
 	} else {
 		offset = XFS_BMDR_SPACE_CALC(6 * MINABTPTRS);
 	}
 
-	ASSERT(offset < XFS_LITINO(mp));
+	ASSERT(offset < XFS_LITINO(mp, ip->i_d.di_version));
 	return offset;
 }
 
diff --git a/fs/xfs/xfs_dinode.h b/fs/xfs/xfs_dinode.h
index 1d9643b..88a3368 100644
--- a/fs/xfs/xfs_dinode.h
+++ b/fs/xfs/xfs_dinode.h
@@ -104,7 +104,7 @@ typedef enum xfs_dinode_fmt {
 /*
  * Inode size for given fs.
  */
-#define XFS_LITINO(mp) \
+#define XFS_LITINO(mp, version) \
 	((int)(((mp)->m_sb.sb_inodesize) - sizeof(struct xfs_dinode)))
 
 #define	XFS_BROOT_SIZE_ADJ	\
@@ -119,10 +119,10 @@ typedef enum xfs_dinode_fmt {
 #define XFS_DFORK_DSIZE(dip,mp) \
 	(XFS_DFORK_Q(dip) ? \
 		XFS_DFORK_BOFF(dip) : \
-		XFS_LITINO(mp))
+		XFS_LITINO(mp, (dip)->di_version))
 #define XFS_DFORK_ASIZE(dip,mp) \
 	(XFS_DFORK_Q(dip) ? \
-		XFS_LITINO(mp) - XFS_DFORK_BOFF(dip) : \
+		XFS_LITINO(mp, (dip)->di_version) - XFS_DFORK_BOFF(dip) : \
 		0)
 #define XFS_DFORK_SIZE(dip,mp,w) \
 	((w) == XFS_DATA_FORK ? \
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 237e7f6..b8520b5 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -180,10 +180,11 @@ typedef struct xfs_icdinode {
 #define XFS_IFORK_DSIZE(ip) \
 	(XFS_IFORK_Q(ip) ? \
 		XFS_IFORK_BOFF(ip) : \
-		XFS_LITINO((ip)->i_mount))
+		XFS_LITINO((ip)->i_mount, (ip)->i_d.di_version))
 #define XFS_IFORK_ASIZE(ip) \
 	(XFS_IFORK_Q(ip) ? \
-		XFS_LITINO((ip)->i_mount) - XFS_IFORK_BOFF(ip) : \
+		XFS_LITINO((ip)->i_mount, (ip)->i_d.di_version) - \
+			XFS_IFORK_BOFF(ip) : \
 		0)
 #define XFS_IFORK_SIZE(ip,w) \
 	((w) == XFS_DATA_FORK ? \
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 77ad748..aa0c066 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -1420,7 +1420,7 @@ xfs_symlink(
 	 * The symlink will fit into the inode data fork?
 	 * There can't be any attributes so we get the whole variable part.
 	 */
-	if (pathlen <= XFS_LITINO(mp))
+	if (pathlen <= XFS_LITINO(mp, dp->i_d.di_version))
 		fs_blocks = 0;
 	else
 		fs_blocks = XFS_B_TO_FSB(mp, pathlen);
-- 
1.7.10

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2013-02-25  1:32 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-25  1:31 [PATCH 00/16] xfs: metadata CRCs, second batch Dave Chinner
2013-02-25  1:31 ` [PATCH 01/16] xfs: rearrange some code in xfs_bmap for better locality Dave Chinner
2013-02-25 14:44   ` Mark Tinguely
2013-03-07 18:48   ` Ben Myers
2013-02-25  1:31 ` Dave Chinner [this message]
2013-02-25  1:31 ` [PATCH 03/16] xfs: add support for large btree blocks Dave Chinner
2013-02-25  1:31 ` [PATCH 04/16] xfs: add CRC checks to the AGF Dave Chinner
2013-02-25  1:31 ` [PATCH 05/16] xfs: add CRC checks to the AGFL Dave Chinner
2013-03-01 23:56   ` Ben Myers
2013-02-25  1:31 ` [PATCH 06/16] xfs: add CRC checks to the AGI Dave Chinner
2013-02-25  1:31 ` [PATCH 07/16] xfs: add CRC checks for quota blocks Dave Chinner
2013-03-05 20:36   ` Ben Myers
2013-03-05 22:49     ` Dave Chinner
2013-02-25  1:31 ` [PATCH 08/16] xfs: add version 3 inode format with CRCs Dave Chinner
2013-02-25  1:31 ` [PATCH 09/16] xfs: add CRC checks to remote symlinks Dave Chinner
2013-02-27 23:35   ` Dave Chinner
2013-02-25  1:31 ` [PATCH 10/16] xfs: add CRC checks to block format directory blocks Dave Chinner
2013-02-25  1:31 ` [PATCH 11/16] xfs: add CRC checking to dir2 free blocks Dave Chinner
2013-02-25  1:31 ` [PATCH 12/16] xfs: add CRC checking to dir2 data blocks Dave Chinner
2013-02-25  1:31 ` [PATCH 13/16] xfs: add CRC checking to dir2 leaf blocks Dave Chinner
2013-02-25  1:31 ` [PATCH 14/16] xfs: add CRCs to dir2/da node blocks Dave Chinner
2013-02-25  1:31 ` [PATCH 15/16] xfs: add CRCs to attr leaf blocks Dave Chinner
2013-02-25  1:31 ` [PATCH 16/16] xfs: add CRC checks to the superblock Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1361755901-12453-3-git-send-email-david@fromorbit.com \
    --to=david@fromorbit.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox