]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: pass inode count through ordered icreate log item
authorBrian Foster <bfoster@redhat.com>
Thu, 28 May 2015 23:05:49 +0000 (09:05 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 23 Jun 2015 05:07:35 +0000 (15:07 +1000)
v5 superblocks use an ordered log item for logging the initialization of
inode chunks. The icreate log item is currently hardcoded to an inode
count of 64 inodes.

The agbno and extent length are used to initialize the inode chunk from
log recovery. While an incorrect inode count does not lead to bad inode
chunk initialization, we should pass the correct inode count such that log
recovery has enough data to perform meaningful validity checks on the
chunk.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
libxfs/xfs_ialloc.c
libxfs/xfs_ialloc.h

index 00de739b1d344c2d308d821b8748ce63592fa1a7..34f029020368f320536447510dc6ac96ae086713 100644 (file)
@@ -245,6 +245,7 @@ xfs_ialloc_inode_init(
        struct xfs_mount        *mp,
        struct xfs_trans        *tp,
        struct list_head        *buffer_list,
+       int                     icount,
        xfs_agnumber_t          agno,
        xfs_agblock_t           agbno,
        xfs_agblock_t           length,
@@ -300,7 +301,7 @@ xfs_ialloc_inode_init(
                 * they track in the AIL as if they were physically logged.
                 */
                if (tp)
-                       xfs_icreate_log(tp, agno, agbno, mp->m_ialloc_inos,
+                       xfs_icreate_log(tp, agno, agbno, icount,
                                        mp->m_sb.sb_inodesize, length, gen);
        } else
                version = 2;
@@ -520,8 +521,8 @@ xfs_ialloc_ag_alloc(
         * rather than a linear progression to prevent the next generation
         * number from being easily guessable.
         */
-       error = xfs_ialloc_inode_init(args.mp, tp, NULL, agno, args.agbno,
-                       args.len, prandom_u32());
+       error = xfs_ialloc_inode_init(args.mp, tp, NULL, newlen, agno,
+                       args.agbno, args.len, prandom_u32());
 
        if (error)
                return error;
index 100007d56449d0a872d78500bef7c9e75c76a745..4d4b7022cc9b831f810473dd4130d428ef5a3c5e 100644 (file)
@@ -156,7 +156,7 @@ int xfs_inobt_get_rec(struct xfs_btree_cur *cur,
  * Inode chunk initialisation routine
  */
 int xfs_ialloc_inode_init(struct xfs_mount *mp, struct xfs_trans *tp,
-                         struct list_head *buffer_list,
+                         struct list_head *buffer_list, int icount,
                          xfs_agnumber_t agno, xfs_agblock_t agbno,
                          xfs_agblock_t length, unsigned int gen);