Commit 56cea2d0 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Ben Myers

xfs: take inode version into account in XFS_LITINO

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: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarBen Myers <bpm@sgi.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent c163f9a1
...@@ -172,7 +172,8 @@ xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes) ...@@ -172,7 +172,8 @@ xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes)
int dsize; int dsize;
xfs_mount_t *mp = dp->i_mount; 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) { switch (dp->i_d.di_format) {
case XFS_DINODE_FMT_DEV: case XFS_DINODE_FMT_DEV:
...@@ -243,7 +244,8 @@ xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes) ...@@ -243,7 +244,8 @@ xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes)
minforkoff = roundup(minforkoff, 8) >> 3; minforkoff = roundup(minforkoff, 8) >> 3;
/* attr fork btree root can have at least this many key/ptr pairs */ /* 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 */ maxforkoff = maxforkoff >> 3; /* rounded down */
if (offset >= maxforkoff) if (offset >= maxforkoff)
......
...@@ -228,13 +228,13 @@ xfs_default_attroffset( ...@@ -228,13 +228,13 @@ xfs_default_attroffset(
uint offset; uint offset;
if (mp->m_sb.sb_inodesize == 256) { 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); XFS_BMDR_SPACE_CALC(MINABTPTRS);
} else { } else {
offset = XFS_BMDR_SPACE_CALC(6 * MINABTPTRS); offset = XFS_BMDR_SPACE_CALC(6 * MINABTPTRS);
} }
ASSERT(offset < XFS_LITINO(mp)); ASSERT(offset < XFS_LITINO(mp, ip->i_d.di_version));
return offset; return offset;
} }
......
...@@ -104,7 +104,7 @@ typedef enum xfs_dinode_fmt { ...@@ -104,7 +104,7 @@ typedef enum xfs_dinode_fmt {
/* /*
* Inode size for given fs. * Inode size for given fs.
*/ */
#define XFS_LITINO(mp) \ #define XFS_LITINO(mp, version) \
((int)(((mp)->m_sb.sb_inodesize) - sizeof(struct xfs_dinode))) ((int)(((mp)->m_sb.sb_inodesize) - sizeof(struct xfs_dinode)))
#define XFS_BROOT_SIZE_ADJ \ #define XFS_BROOT_SIZE_ADJ \
...@@ -119,10 +119,10 @@ typedef enum xfs_dinode_fmt { ...@@ -119,10 +119,10 @@ typedef enum xfs_dinode_fmt {
#define XFS_DFORK_DSIZE(dip,mp) \ #define XFS_DFORK_DSIZE(dip,mp) \
(XFS_DFORK_Q(dip) ? \ (XFS_DFORK_Q(dip) ? \
XFS_DFORK_BOFF(dip) : \ XFS_DFORK_BOFF(dip) : \
XFS_LITINO(mp)) XFS_LITINO(mp, (dip)->di_version))
#define XFS_DFORK_ASIZE(dip,mp) \ #define XFS_DFORK_ASIZE(dip,mp) \
(XFS_DFORK_Q(dip) ? \ (XFS_DFORK_Q(dip) ? \
XFS_LITINO(mp) - XFS_DFORK_BOFF(dip) : \ XFS_LITINO(mp, (dip)->di_version) - XFS_DFORK_BOFF(dip) : \
0) 0)
#define XFS_DFORK_SIZE(dip,mp,w) \ #define XFS_DFORK_SIZE(dip,mp,w) \
((w) == XFS_DATA_FORK ? \ ((w) == XFS_DATA_FORK ? \
......
...@@ -180,10 +180,11 @@ typedef struct xfs_icdinode { ...@@ -180,10 +180,11 @@ typedef struct xfs_icdinode {
#define XFS_IFORK_DSIZE(ip) \ #define XFS_IFORK_DSIZE(ip) \
(XFS_IFORK_Q(ip) ? \ (XFS_IFORK_Q(ip) ? \
XFS_IFORK_BOFF(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) \ #define XFS_IFORK_ASIZE(ip) \
(XFS_IFORK_Q(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) 0)
#define XFS_IFORK_SIZE(ip,w) \ #define XFS_IFORK_SIZE(ip,w) \
((w) == XFS_DATA_FORK ? \ ((w) == XFS_DATA_FORK ? \
......
...@@ -1420,7 +1420,7 @@ xfs_symlink( ...@@ -1420,7 +1420,7 @@ xfs_symlink(
* The symlink will fit into the inode data fork? * The symlink will fit into the inode data fork?
* There can't be any attributes so we get the whole variable part. * 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; fs_blocks = 0;
else else
fs_blocks = XFS_B_TO_FSB(mp, pathlen); fs_blocks = XFS_B_TO_FSB(mp, pathlen);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment