Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / fs / xfs / xfs_log_recover.c
index 9824b5b..1f0016b 100644 (file)
@@ -1,66 +1,51 @@
 /*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
+ * All Rights Reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
  * published by the Free Software Foundation.
  *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
 #include "xfs.h"
-#include "xfs_macros.h"
+#include "xfs_fs.h"
 #include "xfs_types.h"
-#include "xfs_inum.h"
+#include "xfs_bit.h"
 #include "xfs_log.h"
-#include "xfs_ag.h"
-#include "xfs_sb.h"
+#include "xfs_inum.h"
 #include "xfs_trans.h"
+#include "xfs_sb.h"
+#include "xfs_ag.h"
 #include "xfs_dir.h"
 #include "xfs_dir2.h"
 #include "xfs_dmapi.h"
 #include "xfs_mount.h"
 #include "xfs_error.h"
 #include "xfs_bmap_btree.h"
-#include "xfs_alloc.h"
-#include "xfs_attr_sf.h"
+#include "xfs_alloc_btree.h"
+#include "xfs_ialloc_btree.h"
 #include "xfs_dir_sf.h"
 #include "xfs_dir2_sf.h"
+#include "xfs_attr_sf.h"
 #include "xfs_dinode.h"
-#include "xfs_imap.h"
-#include "xfs_inode_item.h"
 #include "xfs_inode.h"
-#include "xfs_ialloc_btree.h"
+#include "xfs_inode_item.h"
+#include "xfs_imap.h"
+#include "xfs_alloc.h"
 #include "xfs_ialloc.h"
 #include "xfs_log_priv.h"
 #include "xfs_buf_item.h"
-#include "xfs_alloc_btree.h"
 #include "xfs_log_recover.h"
 #include "xfs_extfree_item.h"
 #include "xfs_trans_priv.h"
-#include "xfs_bit.h"
 #include "xfs_quota.h"
 #include "xfs_rw.h"
 
@@ -148,7 +133,7 @@ xlog_bread(
  * The buffer is kept locked across the write and is returned locked.
  * This can only be used for synchronous log writes.
  */
-int
+STATIC int
 xlog_bwrite(
        xlog_t          *log,
        xfs_daddr_t     blk_no,
@@ -179,7 +164,7 @@ xlog_bwrite(
        return error;
 }
 
-xfs_caddr_t
+STATIC xfs_caddr_t
 xlog_align(
        xlog_t          *log,
        xfs_daddr_t     blk_no,
@@ -528,7 +513,7 @@ out:
  *
  * Return: zero if normal, non-zero if error.
  */
-int
+STATIC int
 xlog_find_head(
        xlog_t          *log,
        xfs_daddr_t     *return_head_blk)
@@ -598,7 +583,7 @@ xlog_find_head(
                 *        x | x ... | x - 1 | x
                 * Another case that fits this picture would be
                 *        x | x + 1 | x ... | x
-                * In this case the head really is somwhere at the end of the
+                * In this case the head really is somewhere at the end of the
                 * log, as one of the latest writes at the beginning was
                 * incomplete.
                 * One more case is
@@ -798,8 +783,7 @@ int
 xlog_find_tail(
        xlog_t                  *log,
        xfs_daddr_t             *head_blk,
-       xfs_daddr_t             *tail_blk,
-       int                     readonly)
+       xfs_daddr_t             *tail_blk)
 {
        xlog_rec_header_t       *rhead;
        xlog_op_header_t        *op_head;
@@ -1387,7 +1371,7 @@ xlog_recover_add_to_cont_trans(
        old_ptr = item->ri_buf[item->ri_cnt-1].i_addr;
        old_len = item->ri_buf[item->ri_cnt-1].i_len;
 
-       ptr = kmem_realloc(old_ptr, len+old_len, old_len, 0);
+       ptr = kmem_realloc(old_ptr, len+old_len, old_len, 0u);
        memcpy(&ptr[old_len], dp, len); /* d, s, l */
        item->ri_buf[item->ri_cnt-1].i_len += len;
        item->ri_buf[item->ri_cnt-1].i_addr = ptr;
@@ -1964,7 +1948,8 @@ xlog_recover_do_reg_buffer(
                 * probably a good thing to do for other buf types also.
                 */
                error = 0;
-               if (buf_f->blf_flags & (XFS_BLI_UDQUOT_BUF|XFS_BLI_GDQUOT_BUF)) {
+               if (buf_f->blf_flags &
+                  (XFS_BLI_UDQUOT_BUF|XFS_BLI_PDQUOT_BUF|XFS_BLI_GDQUOT_BUF)) {
                        error = xfs_qm_dqcheck((xfs_disk_dquot_t *)
                                               item->ri_buf[i].i_addr,
                                               -1, 0, XFS_QMOPT_DOWARN,
@@ -2012,78 +1997,74 @@ xfs_qm_dqcheck(
         * This is all fine; things are still consistent, and we haven't lost
         * any quota information. Just don't complain about bad dquot blks.
         */
-       if (INT_GET(ddq->d_magic, ARCH_CONVERT) != XFS_DQUOT_MAGIC) {
+       if (be16_to_cpu(ddq->d_magic) != XFS_DQUOT_MAGIC) {
                if (flags & XFS_QMOPT_DOWARN)
                        cmn_err(CE_ALERT,
                        "%s : XFS dquot ID 0x%x, magic 0x%x != 0x%x",
-                       str, id,
-                       INT_GET(ddq->d_magic, ARCH_CONVERT), XFS_DQUOT_MAGIC);
+                       str, id, be16_to_cpu(ddq->d_magic), XFS_DQUOT_MAGIC);
                errs++;
        }
-       if (INT_GET(ddq->d_version, ARCH_CONVERT) != XFS_DQUOT_VERSION) {
+       if (ddq->d_version != XFS_DQUOT_VERSION) {
                if (flags & XFS_QMOPT_DOWARN)
                        cmn_err(CE_ALERT,
                        "%s : XFS dquot ID 0x%x, version 0x%x != 0x%x",
-                       str, id,
-                       INT_GET(ddq->d_magic, ARCH_CONVERT), XFS_DQUOT_VERSION);
+                       str, id, ddq->d_version, XFS_DQUOT_VERSION);
                errs++;
        }
 
-       if (INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_USER &&
-           INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_GROUP) {
+       if (ddq->d_flags != XFS_DQ_USER &&
+           ddq->d_flags != XFS_DQ_PROJ &&
+           ddq->d_flags != XFS_DQ_GROUP) {
                if (flags & XFS_QMOPT_DOWARN)
                        cmn_err(CE_ALERT,
                        "%s : XFS dquot ID 0x%x, unknown flags 0x%x",
-                       str, id, INT_GET(ddq->d_flags, ARCH_CONVERT));
+                       str, id, ddq->d_flags);
                errs++;
        }
 
-       if (id != -1 && id != INT_GET(ddq->d_id, ARCH_CONVERT)) {
+       if (id != -1 && id != be32_to_cpu(ddq->d_id)) {
                if (flags & XFS_QMOPT_DOWARN)
                        cmn_err(CE_ALERT,
                        "%s : ondisk-dquot 0x%p, ID mismatch: "
                        "0x%x expected, found id 0x%x",
-                       str, ddq, id, INT_GET(ddq->d_id, ARCH_CONVERT));
+                       str, ddq, id, be32_to_cpu(ddq->d_id));
                errs++;
        }
 
        if (!errs && ddq->d_id) {
-               if (INT_GET(ddq->d_blk_softlimit, ARCH_CONVERT) &&
-                   INT_GET(ddq->d_bcount, ARCH_CONVERT) >=
-                               INT_GET(ddq->d_blk_softlimit, ARCH_CONVERT)) {
+               if (ddq->d_blk_softlimit &&
+                   be64_to_cpu(ddq->d_bcount) >=
+                               be64_to_cpu(ddq->d_blk_softlimit)) {
                        if (!ddq->d_btimer) {
                                if (flags & XFS_QMOPT_DOWARN)
                                        cmn_err(CE_ALERT,
                                        "%s : Dquot ID 0x%x (0x%p) "
                                        "BLK TIMER NOT STARTED",
-                                       str, (int)
-                                       INT_GET(ddq->d_id, ARCH_CONVERT), ddq);
+                                       str, (int)be32_to_cpu(ddq->d_id), ddq);
                                errs++;
                        }
                }
-               if (INT_GET(ddq->d_ino_softlimit, ARCH_CONVERT) &&
-                   INT_GET(ddq->d_icount, ARCH_CONVERT) >=
-                               INT_GET(ddq->d_ino_softlimit, ARCH_CONVERT)) {
+               if (ddq->d_ino_softlimit &&
+                   be64_to_cpu(ddq->d_icount) >=
+                               be64_to_cpu(ddq->d_ino_softlimit)) {
                        if (!ddq->d_itimer) {
                                if (flags & XFS_QMOPT_DOWARN)
                                        cmn_err(CE_ALERT,
                                        "%s : Dquot ID 0x%x (0x%p) "
                                        "INODE TIMER NOT STARTED",
-                                       str, (int)
-                                       INT_GET(ddq->d_id, ARCH_CONVERT), ddq);
+                                       str, (int)be32_to_cpu(ddq->d_id), ddq);
                                errs++;
                        }
                }
-               if (INT_GET(ddq->d_rtb_softlimit, ARCH_CONVERT) &&
-                   INT_GET(ddq->d_rtbcount, ARCH_CONVERT) >=
-                               INT_GET(ddq->d_rtb_softlimit, ARCH_CONVERT)) {
+               if (ddq->d_rtb_softlimit &&
+                   be64_to_cpu(ddq->d_rtbcount) >=
+                               be64_to_cpu(ddq->d_rtb_softlimit)) {
                        if (!ddq->d_rtbtimer) {
                                if (flags & XFS_QMOPT_DOWARN)
                                        cmn_err(CE_ALERT,
                                        "%s : Dquot ID 0x%x (0x%p) "
                                        "RTBLK TIMER NOT STARTED",
-                                       str, (int)
-                                       INT_GET(ddq->d_id, ARCH_CONVERT), ddq);
+                                       str, (int)be32_to_cpu(ddq->d_id), ddq);
                                errs++;
                        }
                }
@@ -2101,10 +2082,11 @@ xfs_qm_dqcheck(
        ASSERT(id != -1);
        ASSERT(flags & XFS_QMOPT_DQREPAIR);
        memset(d, 0, sizeof(xfs_dqblk_t));
-       INT_SET(d->dd_diskdq.d_magic, ARCH_CONVERT, XFS_DQUOT_MAGIC);
-       INT_SET(d->dd_diskdq.d_version, ARCH_CONVERT, XFS_DQUOT_VERSION);
-       INT_SET(d->dd_diskdq.d_id, ARCH_CONVERT, id);
-       INT_SET(d->dd_diskdq.d_flags, ARCH_CONVERT, type);
+
+       d->dd_diskdq.d_magic = cpu_to_be16(XFS_DQUOT_MAGIC);
+       d->dd_diskdq.d_version = XFS_DQUOT_VERSION;
+       d->dd_diskdq.d_flags = type;
+       d->dd_diskdq.d_id = cpu_to_be32(id);
 
        return errs;
 }
@@ -2135,6 +2117,8 @@ xlog_recover_do_dquot_buffer(
        type = 0;
        if (buf_f->blf_flags & XFS_BLI_UDQUOT_BUF)
                type |= XFS_DQ_USER;
+       if (buf_f->blf_flags & XFS_BLI_PDQUOT_BUF)
+               type |= XFS_DQ_PROJ;
        if (buf_f->blf_flags & XFS_BLI_GDQUOT_BUF)
                type |= XFS_DQ_GROUP;
        /*
@@ -2222,8 +2206,9 @@ xlog_recover_do_buffer_trans(
                break;
        default:
                xfs_fs_cmn_err(CE_ALERT, log->l_mp,
-                       "xfs_log_recover: unknown buffer type 0x%x, dev %s",
-                       buf_f->blf_type, XFS_BUFTARG_NAME(log->l_targ));
+                       "xfs_log_recover: unknown buffer type 0x%x, logdev %s",
+                       buf_f->blf_type, log->l_mp->m_logname ?
+                       log->l_mp->m_logname : "internal");
                XFS_ERROR_REPORT("xlog_recover_do_buffer_trans",
                                 XFS_ERRLEVEL_LOW, log->l_mp);
                return XFS_ERROR(EFSCORRUPTED);
@@ -2247,7 +2232,8 @@ xlog_recover_do_buffer_trans(
        error = 0;
        if (flags & XFS_BLI_INODE_BUF) {
                error = xlog_recover_do_inode_buffer(mp, item, bp, buf_f);
-       } else if (flags & (XFS_BLI_UDQUOT_BUF | XFS_BLI_GDQUOT_BUF)) {
+       } else if (flags &
+                 (XFS_BLI_UDQUOT_BUF|XFS_BLI_PDQUOT_BUF|XFS_BLI_GDQUOT_BUF)) {
                xlog_recover_do_dquot_buffer(mp, log, item, bp, buf_f);
        } else {
                xlog_recover_do_reg_buffer(mp, item, bp, buf_f);
@@ -2576,10 +2562,12 @@ xlog_recover_do_quotaoff_trans(
 
        /*
         * The logitem format's flag tells us if this was user quotaoff,
-        * group quotaoff or both.
+        * group/project quotaoff or both.
         */
        if (qoff_f->qf_flags & XFS_UQUOTA_ACCT)
                log->l_quotaoffs_flag |= XFS_DQ_USER;
+       if (qoff_f->qf_flags & XFS_PQUOTA_ACCT)
+               log->l_quotaoffs_flag |= XFS_DQ_PROJ;
        if (qoff_f->qf_flags & XFS_GQUOTA_ACCT)
                log->l_quotaoffs_flag |= XFS_DQ_GROUP;
 
@@ -2619,7 +2607,7 @@ xlog_recover_do_dquot_trans(
         * This type of quotas was turned off, so ignore this record.
         */
        type = INT_GET(recddq->d_flags, ARCH_CONVERT) &
-                       (XFS_DQ_USER | XFS_DQ_GROUP);
+                       (XFS_DQ_USER | XFS_DQ_PROJ | XFS_DQ_GROUP);
        ASSERT(type);
        if (log->l_quotaoffs_flag & type)
                return (0);
@@ -2742,7 +2730,6 @@ xlog_recover_do_efd_trans(
        xfs_efi_log_item_t      *efip = NULL;
        xfs_log_item_t          *lip;
        int                     gen;
-       int                     nexts;
        __uint64_t              efi_id;
        SPLDECL(s);
 
@@ -2777,22 +2764,15 @@ xlog_recover_do_efd_trans(
                }
                lip = xfs_trans_next_ail(mp, lip, &gen, NULL);
        }
-       if (lip == NULL) {
-               AIL_UNLOCK(mp, s);
-       }
 
        /*
         * If we found it, then free it up.  If it wasn't there, it
         * must have been overwritten in the log.  Oh well.
         */
        if (lip != NULL) {
-               nexts = efip->efi_format.efi_nextents;
-               if (nexts > XFS_EFI_MAX_FAST_EXTENTS) {
-                       kmem_free(lip, sizeof(xfs_efi_log_item_t) +
-                                 ((nexts - 1) * sizeof(xfs_extent_t)));
-               } else {
-                       kmem_zone_free(xfs_efi_zone, efip);
-               }
+               xfs_efi_item_free(efip);
+       } else {
+               AIL_UNLOCK(mp, s);
        }
 }
 
@@ -2819,7 +2799,7 @@ xlog_recover_do_trans(
                 * we don't need to worry about the block number being
                 * truncated in > 1 TB buffers because in user-land,
                 * we're now n32 or 64-bit so xfs_daddr_t is 64-bits so
-                * the blkno's will get through the user-mode buffer
+                * the blknos will get through the user-mode buffer
                 * cache properly.  The only bad case is o32 kernels
                 * where xfs_daddr_t is 32-bits but mount will warn us
                 * off a > 1 TB filesystem before we get here.
@@ -3181,13 +3161,12 @@ xlog_recover_clear_agi_bucket(
        }
 
        agi = XFS_BUF_TO_AGI(agibp);
-       if (INT_GET(agi->agi_magicnum, ARCH_CONVERT) != XFS_AGI_MAGIC) {
+       if (be32_to_cpu(agi->agi_magicnum) != XFS_AGI_MAGIC) {
                xfs_trans_cancel(tp, XFS_TRANS_ABORT);
                return;
        }
-       ASSERT(INT_GET(agi->agi_magicnum, ARCH_CONVERT) == XFS_AGI_MAGIC);
 
-       INT_SET(agi->agi_unlinked[bucket], ARCH_CONVERT, NULLAGINO);
+       agi->agi_unlinked[bucket] = cpu_to_be32(NULLAGINO);
        offset = offsetof(xfs_agi_t, agi_unlinked) +
                 (sizeof(xfs_agino_t) * bucket);
        xfs_trans_log_buf(tp, agibp, offset,
@@ -3246,12 +3225,11 @@ xlog_recover_process_iunlinks(
                                XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)));
                }
                agi = XFS_BUF_TO_AGI(agibp);
-               ASSERT(XFS_AGI_MAGIC ==
-                       INT_GET(agi->agi_magicnum, ARCH_CONVERT));
+               ASSERT(XFS_AGI_MAGIC == be32_to_cpu(agi->agi_magicnum));
 
                for (bucket = 0; bucket < XFS_AGI_UNLINKED_BUCKETS; bucket++) {
 
-                       agino = INT_GET(agi->agi_unlinked[bucket], ARCH_CONVERT);
+                       agino = be32_to_cpu(agi->agi_unlinked[bucket]);
                        while (agino != NULLAGINO) {
 
                                /*
@@ -3271,7 +3249,7 @@ xlog_recover_process_iunlinks(
                                         * next inode in the bucket.
                                         */
                                        error = xfs_itobp(mp, NULL, ip, &dip,
-                                                       &ibp, 0);
+                                                       &ibp, 0, 0);
                                        ASSERT(error || (dip != NULL));
                                }
 
@@ -3339,8 +3317,8 @@ xlog_recover_process_iunlinks(
                                                        XFS_AGI_DADDR(mp)));
                                }
                                agi = XFS_BUF_TO_AGI(agibp);
-                               ASSERT(XFS_AGI_MAGIC == INT_GET(
-                                       agi->agi_magicnum, ARCH_CONVERT));
+                               ASSERT(XFS_AGI_MAGIC == be32_to_cpu(
+                                       agi->agi_magicnum));
                        }
                }
 
@@ -3913,14 +3891,13 @@ xlog_do_recover(
  */
 int
 xlog_recover(
-       xlog_t          *log,
-       int             readonly)
+       xlog_t          *log)
 {
        xfs_daddr_t     head_blk, tail_blk;
        int             error;
 
        /* find the tail of the log */
-       if ((error = xlog_find_tail(log, &head_blk, &tail_blk, readonly)))
+       if ((error = xlog_find_tail(log, &head_blk, &tail_blk)))
                return error;
 
        if (tail_blk != head_blk) {
@@ -3941,8 +3918,9 @@ xlog_recover(
                }
 
                cmn_err(CE_NOTE,
-                       "Starting XFS recovery on filesystem: %s (dev: %s)",
-                       log->l_mp->m_fsname, XFS_BUFTARG_NAME(log->l_targ));
+                       "Starting XFS recovery on filesystem: %s (logdev: %s)",
+                       log->l_mp->m_fsname, log->l_mp->m_logname ?
+                       log->l_mp->m_logname : "internal");
 
                error = xlog_do_recover(log, head_blk, tail_blk);
                log->l_flags |= XLOG_RECOVERY_NEEDED;
@@ -3990,8 +3968,9 @@ xlog_recover_finish(
                xlog_recover_check_summary(log);
 
                cmn_err(CE_NOTE,
-                       "Ending XFS recovery on filesystem: %s (dev: %s)",
-                       log->l_mp->m_fsname, XFS_BUFTARG_NAME(log->l_targ));
+                       "Ending XFS recovery on filesystem: %s (logdev: %s)",
+                       log->l_mp->m_fsname, log->l_mp->m_logname ?
+                       log->l_mp->m_logname : "internal");
                log->l_flags &= ~XLOG_RECOVERY_NEEDED;
        } else {
                cmn_err(CE_DEBUG,
@@ -4041,14 +4020,12 @@ xlog_recover_check_summary(
                                                mp, agfbp, agfdaddr);
                }
                agfp = XFS_BUF_TO_AGF(agfbp);
-               ASSERT(XFS_AGF_MAGIC ==
-                       INT_GET(agfp->agf_magicnum, ARCH_CONVERT));
-               ASSERT(XFS_AGF_GOOD_VERSION(
-                       INT_GET(agfp->agf_versionnum, ARCH_CONVERT)));
-               ASSERT(INT_GET(agfp->agf_seqno, ARCH_CONVERT) == agno);
-
-               freeblks += INT_GET(agfp->agf_freeblks, ARCH_CONVERT) +
-                           INT_GET(agfp->agf_flcount, ARCH_CONVERT);
+               ASSERT(XFS_AGF_MAGIC == be32_to_cpu(agfp->agf_magicnum));
+               ASSERT(XFS_AGF_GOOD_VERSION(be32_to_cpu(agfp->agf_versionnum)));
+               ASSERT(be32_to_cpu(agfp->agf_seqno) == agno);
+
+               freeblks += be32_to_cpu(agfp->agf_freeblks) +
+                           be32_to_cpu(agfp->agf_flcount);
                xfs_buf_relse(agfbp);
 
                agidaddr = XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp));
@@ -4059,14 +4036,12 @@ xlog_recover_check_summary(
                                          mp, agibp, agidaddr);
                }
                agip = XFS_BUF_TO_AGI(agibp);
-               ASSERT(XFS_AGI_MAGIC ==
-                       INT_GET(agip->agi_magicnum, ARCH_CONVERT));
-               ASSERT(XFS_AGI_GOOD_VERSION(
-                       INT_GET(agip->agi_versionnum, ARCH_CONVERT)));
-               ASSERT(INT_GET(agip->agi_seqno, ARCH_CONVERT) == agno);
-
-               itotal += INT_GET(agip->agi_count, ARCH_CONVERT);
-               ifree += INT_GET(agip->agi_freecount, ARCH_CONVERT);
+               ASSERT(XFS_AGI_MAGIC == be32_to_cpu(agip->agi_magicnum));
+               ASSERT(XFS_AGI_GOOD_VERSION(be32_to_cpu(agip->agi_versionnum)));
+               ASSERT(be32_to_cpu(agip->agi_seqno) == agno);
+
+               itotal += be32_to_cpu(agip->agi_count);
+               ifree += be32_to_cpu(agip->agi_freecount);
                xfs_buf_relse(agibp);
        }