]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[XFS] xfs_bmap_compute_maxlevels should be based on di_forkoff
authorTim Shimmin <tes@sgi.com>
Thu, 17 Apr 2008 06:50:16 +0000 (16:50 +1000)
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>
Fri, 18 Apr 2008 02:04:08 +0000 (12:04 +1000)
Fix up xfs_bmap_compute_maxlevels() to account for the case when we go
from using attr2 to using attr1. In that case attr1 will no longer
necessarily be at m_attr_offset>>3, but could be at a different value for
di_forkoff. Therefore, we return the worst case scenario using MINDBTPTRS
and MINABTPTRS, as this function is used for determining the maximum log
space.

SGI-PV: 979606
SGI-Modid: xfs-linux-melb:xfs-kern:30862a

Signed-off-by: Tim Shimmin <tes@sgi.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
fs/xfs/xfs_bmap.c

index 6d9b5448deb25151d3ab946317d03281eb8f9c60..eb198c01c35dd08d306c0a53da2109bedc015afa 100644 (file)
@@ -4153,16 +4153,21 @@ xfs_bmap_compute_maxlevels(
         * number of leaf entries, is controlled by the type of di_nextents
         * (a signed 32-bit number, xfs_extnum_t), or by di_anextents
         * (a signed 16-bit number, xfs_aextnum_t).
+        *
+        * Note that we can no longer assume that if we are in ATTR1 that
+        * the fork offset of all the inodes will be (m_attroffset >> 3)
+        * because we could have mounted with ATTR2 and then mounted back
+        * with ATTR1, keeping the di_forkoff's fixed but probably at
+        * various positions. Therefore, for both ATTR1 and ATTR2
+        * we have to assume the worst case scenario of a minimum size
+        * available.
         */
        if (whichfork == XFS_DATA_FORK) {
                maxleafents = MAXEXTNUM;
-               sz = (mp->m_flags & XFS_MOUNT_ATTR2) ?
-                       XFS_BMDR_SPACE_CALC(MINDBTPTRS) : mp->m_attroffset;
+               sz = XFS_BMDR_SPACE_CALC(MINDBTPTRS);
        } else {
                maxleafents = MAXAEXTNUM;
-               sz = (mp->m_flags & XFS_MOUNT_ATTR2) ?
-                       XFS_BMDR_SPACE_CALC(MINABTPTRS) :
-                       mp->m_sb.sb_inodesize - mp->m_attroffset;
+               sz = XFS_BMDR_SPACE_CALC(MINABTPTRS);
        }
        maxrootrecs = (int)XFS_BTREE_BLOCK_MAXRECS(sz, xfs_bmdr, 0);
        minleafrecs = mp->m_bmap_dmnr[0];