Commit d4cc540b authored by Brian Foster's avatar Brian Foster Committed by Dave Chinner

xfs: create individual inode alloc. helper

Inode allocation from sparse inode records must filter the ir_free mask
against ir_holemask.  In preparation for this requirement, create a
helper to allocate an individual inode from an inode record.
Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 5ebe6afa
...@@ -731,6 +731,16 @@ xfs_ialloc_get_rec( ...@@ -731,6 +731,16 @@ xfs_ialloc_get_rec(
return 0; return 0;
} }
/*
* Return the offset of the first free inode in the record.
*/
STATIC int
xfs_inobt_first_free_inode(
struct xfs_inobt_rec_incore *rec)
{
return xfs_lowbit64(rec->ir_free);
}
/* /*
* Allocate an inode using the inobt-only algorithm. * Allocate an inode using the inobt-only algorithm.
*/ */
...@@ -961,7 +971,7 @@ xfs_dialloc_ag_inobt( ...@@ -961,7 +971,7 @@ xfs_dialloc_ag_inobt(
} }
alloc_inode: alloc_inode:
offset = xfs_lowbit64(rec.ir_free); offset = xfs_inobt_first_free_inode(&rec);
ASSERT(offset >= 0); ASSERT(offset >= 0);
ASSERT(offset < XFS_INODES_PER_CHUNK); ASSERT(offset < XFS_INODES_PER_CHUNK);
ASSERT((XFS_AGINO_TO_OFFSET(mp, rec.ir_startino) % ASSERT((XFS_AGINO_TO_OFFSET(mp, rec.ir_startino) %
...@@ -1210,7 +1220,7 @@ xfs_dialloc_ag( ...@@ -1210,7 +1220,7 @@ xfs_dialloc_ag(
if (error) if (error)
goto error_cur; goto error_cur;
offset = xfs_lowbit64(rec.ir_free); offset = xfs_inobt_first_free_inode(&rec);
ASSERT(offset >= 0); ASSERT(offset >= 0);
ASSERT(offset < XFS_INODES_PER_CHUNK); ASSERT(offset < XFS_INODES_PER_CHUNK);
ASSERT((XFS_AGINO_TO_OFFSET(mp, rec.ir_startino) % ASSERT((XFS_AGINO_TO_OFFSET(mp, rec.ir_startino) %
......
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