aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2013-03-12 08:30:36 -0400
committerBen Myers <bpm@sgi.com>2013-03-14 17:19:14 -0400
commit56cea2d088811b8cf7d2893e29bcf369a912de69 (patch)
treeab131c69db53bb17879d9efada9534d17e54cc57
parentc163f9a1760229a95d04e37b332de7d5c1c225cd (diff)
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: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Ben Myers <bpm@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
-rw-r--r--fs/xfs/xfs_attr_leaf.c6
-rw-r--r--fs/xfs/xfs_bmap.c4
-rw-r--r--fs/xfs/xfs_dinode.h6
-rw-r--r--fs/xfs/xfs_inode.h5
-rw-r--r--fs/xfs/xfs_vnodeops.c2
5 files changed, 13 insertions, 10 deletions
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c
index ee24993c7d12..f96a734ed1e0 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)
172 int dsize; 172 int dsize;
173 xfs_mount_t *mp = dp->i_mount; 173 xfs_mount_t *mp = dp->i_mount;
174 174
175 offset = (XFS_LITINO(mp) - bytes) >> 3; /* rounded down */ 175 /* rounded down */
176 offset = (XFS_LITINO(mp, dp->i_d.di_version) - bytes) >> 3;
176 177
177 switch (dp->i_d.di_format) { 178 switch (dp->i_d.di_format) {
178 case XFS_DINODE_FMT_DEV: 179 case XFS_DINODE_FMT_DEV:
@@ -243,7 +244,8 @@ xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes)
243 minforkoff = roundup(minforkoff, 8) >> 3; 244 minforkoff = roundup(minforkoff, 8) >> 3;
244 245
245 /* attr fork btree root can have at least this many key/ptr pairs */ 246 /* attr fork btree root can have at least this many key/ptr pairs */
246 maxforkoff = XFS_LITINO(mp) - XFS_BMDR_SPACE_CALC(MINABTPTRS); 247 maxforkoff = XFS_LITINO(mp, dp->i_d.di_version) -
248 XFS_BMDR_SPACE_CALC(MINABTPTRS);
247 maxforkoff = maxforkoff >> 3; /* rounded down */ 249 maxforkoff = maxforkoff >> 3; /* rounded down */
248 250
249 if (offset >= maxforkoff) 251 if (offset >= maxforkoff)
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index d490fe8fd19f..20efb397a7f4 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -228,13 +228,13 @@ xfs_default_attroffset(
228 uint offset; 228 uint offset;
229 229
230 if (mp->m_sb.sb_inodesize == 256) { 230 if (mp->m_sb.sb_inodesize == 256) {
231 offset = XFS_LITINO(mp) - 231 offset = XFS_LITINO(mp, ip->i_d.di_version) -
232 XFS_BMDR_SPACE_CALC(MINABTPTRS); 232 XFS_BMDR_SPACE_CALC(MINABTPTRS);
233 } else { 233 } else {
234 offset = XFS_BMDR_SPACE_CALC(6 * MINABTPTRS); 234 offset = XFS_BMDR_SPACE_CALC(6 * MINABTPTRS);
235 } 235 }
236 236
237 ASSERT(offset < XFS_LITINO(mp)); 237 ASSERT(offset < XFS_LITINO(mp, ip->i_d.di_version));
238 return offset; 238 return offset;
239} 239}
240 240
diff --git a/fs/xfs/xfs_dinode.h b/fs/xfs/xfs_dinode.h
index 1d9643b3dce6..88a3368ef124 100644
--- a/fs/xfs/xfs_dinode.h
+++ b/fs/xfs/xfs_dinode.h
@@ -104,7 +104,7 @@ typedef enum xfs_dinode_fmt {
104/* 104/*
105 * Inode size for given fs. 105 * Inode size for given fs.
106 */ 106 */
107#define XFS_LITINO(mp) \ 107#define XFS_LITINO(mp, version) \
108 ((int)(((mp)->m_sb.sb_inodesize) - sizeof(struct xfs_dinode))) 108 ((int)(((mp)->m_sb.sb_inodesize) - sizeof(struct xfs_dinode)))
109 109
110#define XFS_BROOT_SIZE_ADJ \ 110#define XFS_BROOT_SIZE_ADJ \
@@ -119,10 +119,10 @@ typedef enum xfs_dinode_fmt {
119#define XFS_DFORK_DSIZE(dip,mp) \ 119#define XFS_DFORK_DSIZE(dip,mp) \
120 (XFS_DFORK_Q(dip) ? \ 120 (XFS_DFORK_Q(dip) ? \
121 XFS_DFORK_BOFF(dip) : \ 121 XFS_DFORK_BOFF(dip) : \
122 XFS_LITINO(mp)) 122 XFS_LITINO(mp, (dip)->di_version))
123#define XFS_DFORK_ASIZE(dip,mp) \ 123#define XFS_DFORK_ASIZE(dip,mp) \
124 (XFS_DFORK_Q(dip) ? \ 124 (XFS_DFORK_Q(dip) ? \
125 XFS_LITINO(mp) - XFS_DFORK_BOFF(dip) : \ 125 XFS_LITINO(mp, (dip)->di_version) - XFS_DFORK_BOFF(dip) : \
126 0) 126 0)
127#define XFS_DFORK_SIZE(dip,mp,w) \ 127#define XFS_DFORK_SIZE(dip,mp,w) \
128 ((w) == XFS_DATA_FORK ? \ 128 ((w) == XFS_DATA_FORK ? \
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 237e7f6f2ab3..b8520b5c3a18 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -180,10 +180,11 @@ typedef struct xfs_icdinode {
180#define XFS_IFORK_DSIZE(ip) \ 180#define XFS_IFORK_DSIZE(ip) \
181 (XFS_IFORK_Q(ip) ? \ 181 (XFS_IFORK_Q(ip) ? \
182 XFS_IFORK_BOFF(ip) : \ 182 XFS_IFORK_BOFF(ip) : \
183 XFS_LITINO((ip)->i_mount)) 183 XFS_LITINO((ip)->i_mount, (ip)->i_d.di_version))
184#define XFS_IFORK_ASIZE(ip) \ 184#define XFS_IFORK_ASIZE(ip) \
185 (XFS_IFORK_Q(ip) ? \ 185 (XFS_IFORK_Q(ip) ? \
186 XFS_LITINO((ip)->i_mount) - XFS_IFORK_BOFF(ip) : \ 186 XFS_LITINO((ip)->i_mount, (ip)->i_d.di_version) - \
187 XFS_IFORK_BOFF(ip) : \
187 0) 188 0)
188#define XFS_IFORK_SIZE(ip,w) \ 189#define XFS_IFORK_SIZE(ip,w) \
189 ((w) == XFS_DATA_FORK ? \ 190 ((w) == XFS_DATA_FORK ? \
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 77ad74834baa..aa0c06692e18 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -1420,7 +1420,7 @@ xfs_symlink(
1420 * The symlink will fit into the inode data fork? 1420 * The symlink will fit into the inode data fork?
1421 * There can't be any attributes so we get the whole variable part. 1421 * There can't be any attributes so we get the whole variable part.
1422 */ 1422 */
1423 if (pathlen <= XFS_LITINO(mp)) 1423 if (pathlen <= XFS_LITINO(mp, dp->i_d.di_version))
1424 fs_blocks = 0; 1424 fs_blocks = 0;
1425 else 1425 else
1426 fs_blocks = XFS_B_TO_FSB(mp, pathlen); 1426 fs_blocks = XFS_B_TO_FSB(mp, pathlen);