xfs: replace xfs_sb_version checks with feature flag checks
[linux-2.6-microblaze.git] / fs / xfs / libxfs / xfs_ialloc_btree.c
index 823a038..4b411ce 100644 (file)
@@ -40,9 +40,9 @@ xfs_inobt_dup_cursor(
 
 STATIC void
 xfs_inobt_set_root(
-       struct xfs_btree_cur    *cur,
-       union xfs_btree_ptr     *nptr,
-       int                     inc)    /* level change */
+       struct xfs_btree_cur            *cur,
+       const union xfs_btree_ptr       *nptr,
+       int                             inc)    /* level change */
 {
        struct xfs_buf          *agbp = cur->bc_ag.agbp;
        struct xfs_agi          *agi = agbp->b_addr;
@@ -54,9 +54,9 @@ xfs_inobt_set_root(
 
 STATIC void
 xfs_finobt_set_root(
-       struct xfs_btree_cur    *cur,
-       union xfs_btree_ptr     *nptr,
-       int                     inc)    /* level change */
+       struct xfs_btree_cur            *cur,
+       const union xfs_btree_ptr       *nptr,
+       int                             inc)    /* level change */
 {
        struct xfs_buf          *agbp = cur->bc_ag.agbp;
        struct xfs_agi          *agi = agbp->b_addr;
@@ -88,11 +88,11 @@ xfs_inobt_mod_blockcount(
 
 STATIC int
 __xfs_inobt_alloc_block(
-       struct xfs_btree_cur    *cur,
-       union xfs_btree_ptr     *start,
-       union xfs_btree_ptr     *new,
-       int                     *stat,
-       enum xfs_ag_resv_type   resv)
+       struct xfs_btree_cur            *cur,
+       const union xfs_btree_ptr       *start,
+       union xfs_btree_ptr             *new,
+       int                             *stat,
+       enum xfs_ag_resv_type           resv)
 {
        xfs_alloc_arg_t         args;           /* block allocation args */
        int                     error;          /* error return value */
@@ -127,20 +127,20 @@ __xfs_inobt_alloc_block(
 
 STATIC int
 xfs_inobt_alloc_block(
-       struct xfs_btree_cur    *cur,
-       union xfs_btree_ptr     *start,
-       union xfs_btree_ptr     *new,
-       int                     *stat)
+       struct xfs_btree_cur            *cur,
+       const union xfs_btree_ptr       *start,
+       union xfs_btree_ptr             *new,
+       int                             *stat)
 {
        return __xfs_inobt_alloc_block(cur, start, new, stat, XFS_AG_RESV_NONE);
 }
 
 STATIC int
 xfs_finobt_alloc_block(
-       struct xfs_btree_cur    *cur,
-       union xfs_btree_ptr     *start,
-       union xfs_btree_ptr     *new,
-       int                     *stat)
+       struct xfs_btree_cur            *cur,
+       const union xfs_btree_ptr       *start,
+       union xfs_btree_ptr             *new,
+       int                             *stat)
 {
        if (cur->bc_mp->m_finobt_nores)
                return xfs_inobt_alloc_block(cur, start, new, stat);
@@ -188,18 +188,18 @@ xfs_inobt_get_maxrecs(
 
 STATIC void
 xfs_inobt_init_key_from_rec(
-       union xfs_btree_key     *key,
-       union xfs_btree_rec     *rec)
+       union xfs_btree_key             *key,
+       const union xfs_btree_rec       *rec)
 {
        key->inobt.ir_startino = rec->inobt.ir_startino;
 }
 
 STATIC void
 xfs_inobt_init_high_key_from_rec(
-       union xfs_btree_key     *key,
-       union xfs_btree_rec     *rec)
+       union xfs_btree_key             *key,
+       const union xfs_btree_rec       *rec)
 {
-       __u32                   x;
+       __u32                           x;
 
        x = be32_to_cpu(rec->inobt.ir_startino);
        x += XFS_INODES_PER_CHUNK - 1;
@@ -212,7 +212,7 @@ xfs_inobt_init_rec_from_cur(
        union xfs_btree_rec     *rec)
 {
        rec->inobt.ir_startino = cpu_to_be32(cur->bc_rec.i.ir_startino);
-       if (xfs_sb_version_hassparseinodes(&cur->bc_mp->m_sb)) {
+       if (xfs_has_sparseinodes(cur->bc_mp)) {
                rec->inobt.ir_u.sp.ir_holemask =
                                        cpu_to_be16(cur->bc_rec.i.ir_holemask);
                rec->inobt.ir_u.sp.ir_count = cur->bc_rec.i.ir_count;
@@ -253,8 +253,8 @@ xfs_finobt_init_ptr_from_cur(
 
 STATIC int64_t
 xfs_inobt_key_diff(
-       struct xfs_btree_cur    *cur,
-       union xfs_btree_key     *key)
+       struct xfs_btree_cur            *cur,
+       const union xfs_btree_key       *key)
 {
        return (int64_t)be32_to_cpu(key->inobt.ir_startino) -
                          cur->bc_rec.i.ir_startino;
@@ -262,9 +262,9 @@ xfs_inobt_key_diff(
 
 STATIC int64_t
 xfs_inobt_diff_two_keys(
-       struct xfs_btree_cur    *cur,
-       union xfs_btree_key     *k1,
-       union xfs_btree_key     *k2)
+       struct xfs_btree_cur            *cur,
+       const union xfs_btree_key       *k1,
+       const union xfs_btree_key       *k2)
 {
        return (int64_t)be32_to_cpu(k1->inobt.ir_startino) -
                          be32_to_cpu(k2->inobt.ir_startino);
@@ -360,9 +360,9 @@ const struct xfs_buf_ops xfs_finobt_buf_ops = {
 
 STATIC int
 xfs_inobt_keys_inorder(
-       struct xfs_btree_cur    *cur,
-       union xfs_btree_key     *k1,
-       union xfs_btree_key     *k2)
+       struct xfs_btree_cur            *cur,
+       const union xfs_btree_key       *k1,
+       const union xfs_btree_key       *k2)
 {
        return be32_to_cpu(k1->inobt.ir_startino) <
                be32_to_cpu(k2->inobt.ir_startino);
@@ -370,9 +370,9 @@ xfs_inobt_keys_inorder(
 
 STATIC int
 xfs_inobt_recs_inorder(
-       struct xfs_btree_cur    *cur,
-       union xfs_btree_rec     *r1,
-       union xfs_btree_rec     *r2)
+       struct xfs_btree_cur            *cur,
+       const union xfs_btree_rec       *r1,
+       const union xfs_btree_rec       *r2)
 {
        return be32_to_cpu(r1->inobt.ir_startino) + XFS_INODES_PER_CHUNK <=
                be32_to_cpu(r2->inobt.ir_startino);
@@ -446,7 +446,7 @@ xfs_inobt_init_common(
 
        cur->bc_blocklog = mp->m_sb.sb_blocklog;
 
-       if (xfs_sb_version_hascrc(&mp->m_sb))
+       if (xfs_has_crc(mp))
                cur->bc_flags |= XFS_BTREE_CRC_BLOCKS;
 
        /* take a reference for the cursor */
@@ -737,7 +737,7 @@ xfs_finobt_calc_reserves(
        xfs_extlen_t            tree_len = 0;
        int                     error;
 
-       if (!xfs_sb_version_hasfinobt(&mp->m_sb))
+       if (!xfs_has_finobt(mp))
                return 0;
 
        if (xfs_sb_version_hasinobtcounts(&mp->m_sb))