Diff for /xfs-cmds/xfsprogs/repair/dinode.c between versions 1.26 and 1.27

version 1.26, 2006/11/30 14:47:23 version 1.27, 2007/03/16 03:00:32
Line 307  clear_dinode(xfs_mount_t *mp, xfs_dinode Line 307  clear_dinode(xfs_mount_t *mp, xfs_dinode
  * misc. inode-related utility routines   * misc. inode-related utility routines
  */   */
   
 /*   /*
  * verify_ag_bno is heavily used. In the common case, it    * verify_ag_bno is heavily used. In the common case, it
  * performs just two number of compares   * performs just two number of compares
  */   */
 static __inline int  static __inline int
Line 802  process_bmbt_reclist_int( Line 802  process_bmbt_reclist_int(
                                 PROCESS_BMBT_UNLOCK_RETURN(1);                                  PROCESS_BMBT_UNLOCK_RETURN(1);
                         }                          }
   
                         /* Process in chunks of 16 (XR_BB_UNIT/XR_BB)                           /* Process in chunks of 16 (XR_BB_UNIT/XR_BB)
                          * for common XR_E_UNKNOWN to XR_E_INUSE transition                           * for common XR_E_UNKNOWN to XR_E_INUSE transition
                          */                           */
                         if (((agbno & XR_BB_MASK) == 0) && ((s + c - b) >= (XR_BB_UNIT/XR_BB))) {                          if (((agbno & XR_BB_MASK) == 0) && ((s + c - b) >= (XR_BB_UNIT/XR_BB))) {
Line 1223  process_btinode( Line 1223  process_btinode(
         xfs_bmbt_key_t          *pkey;          xfs_bmbt_key_t          *pkey;
         char                    *forkname;          char                    *forkname;
         int                     i;          int                     i;
           int                     level;
           int                     numrecs;
         bmap_cursor_t           cursor;          bmap_cursor_t           cursor;
   
         dib = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork);          dib = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork);
Line 1235  process_btinode( Line 1237  process_btinode(
         else          else
                 forkname = _("attr");                  forkname = _("attr");
   
         if (INT_GET(dib->bb_level, ARCH_CONVERT) == 0) {          level = INT_GET(dib->bb_level, ARCH_CONVERT);
           numrecs = INT_GET(dib->bb_numrecs, ARCH_CONVERT);
   
           if ((level == 0) || (level > XFS_BM_MAXLEVELS(mp, whichfork))) {
                 /*                  /*
                  * This should never happen since a btree inode  
                  * has to have at least one other block in the  
                  * bmap in addition to the root block in the  
                  * inode's data fork.  
                  *  
                  * XXX - if we were going to fix up the inode,                   * XXX - if we were going to fix up the inode,
                  * we'd try to treat the fork as an interior                   * we'd try to treat the fork as an interior
                  * node and see if we could get an accurate                   * node and see if we could get an accurate
Line 1249  process_btinode( Line 1249  process_btinode(
                  * to by the pointers in the fork.  For now                   * to by the pointers in the fork.  For now
                  * though, we just bail (and blow out the inode).                   * though, we just bail (and blow out the inode).
                  */                   */
                 do_warn(_("bad level 0 in inode %llu bmap btree root block\n"),                  do_warn(_("bad level %d in inode %llu bmap btree root block\n"),
                           level, XFS_AGINO_TO_INO(mp, agno, ino));
                   return(1);
           }
           if (numrecs == 0) {
                   do_warn(_("bad numrecs 0 in inode %llu bmap btree root block\n"),
                         XFS_AGINO_TO_INO(mp, agno, ino));                          XFS_AGINO_TO_INO(mp, agno, ino));
                 return(1);                  return(1);
         }          }
         /*          /*
          * use bmdr/dfork_dsize since the root block is in the data fork           * use bmdr/dfork_dsize since the root block is in the data fork
          */           */
         init_bm_cursor(&cursor, INT_GET(dib->bb_level, ARCH_CONVERT) + 1);          if (XFS_BMDR_SPACE_CALC(numrecs) > ((whichfork == XFS_DATA_FORK) ?
   
         if (XFS_BMDR_SPACE_CALC(INT_GET(dib->bb_numrecs, ARCH_CONVERT)) >  
                         ((whichfork == XFS_DATA_FORK) ?  
                         XFS_DFORK_DSIZE(dip, mp) :                          XFS_DFORK_DSIZE(dip, mp) :
                         XFS_DFORK_ASIZE(dip, mp)))  {                          XFS_DFORK_ASIZE(dip, mp)))  {
                 do_warn(                  do_warn(
         _("indicated size of %s btree root (%d bytes) greater than space in "          _("indicated size of %s btree root (%d bytes) greater than space in "
           "inode %llu %s fork\n"),            "inode %llu %s fork\n"),
                         forkname, XFS_BMDR_SPACE_CALC(INT_GET(dib->bb_numrecs,                          forkname, XFS_BMDR_SPACE_CALC(numrecs), lino, forkname);
                                 ARCH_CONVERT)),  
                         lino, forkname);  
                 return(1);                  return(1);
         }          }
   
           init_bm_cursor(&cursor, level + 1);
   
         pp = XFS_BTREE_PTR_ADDR(          pp = XFS_BTREE_PTR_ADDR(
                         XFS_DFORK_SIZE(dip, mp, whichfork),                          XFS_DFORK_SIZE(dip, mp, whichfork),
                 xfs_bmdr, dib, 1,                  xfs_bmdr, dib, 1,
Line 1286  process_btinode( Line 1288  process_btinode(
   
         last_key = NULLDFILOFF;          last_key = NULLDFILOFF;
   
         for (i = 0; i < INT_GET(dib->bb_numrecs, ARCH_CONVERT); i++)  {          for (i = 0; i < numrecs; i++)  {
                 /*                  /*
                  * XXX - if we were going to do more to fix up the inode                   * XXX - if we were going to do more to fix up the inode
                  * btree, we'd do it right here.  For now, if there's a                   * btree, we'd do it right here.  For now, if there's a
Line 1298  process_btinode( Line 1300  process_btinode(
                         return(1);                          return(1);
                 }                  }
   
                 if (scan_lbtree((xfs_dfsbno_t)INT_GET(pp[i], ARCH_CONVERT), INT_GET(dib->bb_level, ARCH_CONVERT),                  if (scan_lbtree((xfs_dfsbno_t)INT_GET(pp[i], ARCH_CONVERT),
                                     scanfunc_bmap, type, whichfork,                                      level, scanfunc_bmap, type, whichfork,
                                     lino, tot, nex, blkmapp, &cursor,                                      lino, tot, nex, blkmapp, &cursor,
                                     1, check_dups))                                      1, check_dups))
                         return(1);                          return(1);
Line 1310  process_btinode( Line 1312  process_btinode(
                  * blocks but the parent hasn't been updated                   * blocks but the parent hasn't been updated
                  */                   */
                 if (check_dups == 0 &&                  if (check_dups == 0 &&
                     cursor.level[INT_GET(dib->bb_level,                      cursor.level[level-1].first_key !=
                                 ARCH_CONVERT)-1].first_key !=  
                     INT_GET(pkey[i].br_startoff, ARCH_CONVERT))  {                      INT_GET(pkey[i].br_startoff, ARCH_CONVERT))  {
                         if (!no_modify)  {                          if (!no_modify)  {
                                 do_warn(                                  do_warn(
Line 1319  process_btinode( Line 1320  process_btinode(
           "%llu %s fork\n"),            "%llu %s fork\n"),
                                         INT_GET(pkey[i].br_startoff,                                          INT_GET(pkey[i].br_startoff,
                                                 ARCH_CONVERT),                                                  ARCH_CONVERT),
                                         cursor.level[INT_GET(dib->bb_level,                                          cursor.level[level-1].first_key,
                                                 ARCH_CONVERT)-1].first_key,  
                                         XFS_AGINO_TO_INO(mp, agno, ino),                                          XFS_AGINO_TO_INO(mp, agno, ino),
                                         forkname);                                          forkname);
                                 *dirty = 1;                                  *dirty = 1;
                                 INT_SET(pkey[i].br_startoff, ARCH_CONVERT,                                  INT_SET(pkey[i].br_startoff, ARCH_CONVERT,
                                         cursor.level[INT_GET(dib->bb_level,                                          cursor.level[level-1].first_key);
                                                 ARCH_CONVERT)-1].first_key);  
                         } else  {                          } else  {
                                 do_warn(                                  do_warn(
         _("bad key in bmbt root (is %llu, would reset to %llu) in inode "          _("bad key in bmbt root (is %llu, would reset to %llu) in inode "
           "%llu %s fork\n"),            "%llu %s fork\n"),
                                         INT_GET(pkey[i].br_startoff,                                          INT_GET(pkey[i].br_startoff,
                                                 ARCH_CONVERT),                                                  ARCH_CONVERT),
                                         cursor.level[INT_GET(dib->bb_level,                                          cursor.level[level-1].first_key,
                                                 ARCH_CONVERT)-1].first_key,  
                                         XFS_AGINO_TO_INO(mp, agno, ino),                                          XFS_AGINO_TO_INO(mp, agno, ino),
                                         forkname);                                          forkname);
                         }                          }
Line 1345  process_btinode( Line 1343  process_btinode(
                  */                   */
                 if (check_dups == 0)  {                  if (check_dups == 0)  {
                         if (last_key != NULLDFILOFF && last_key >=                          if (last_key != NULLDFILOFF && last_key >=
                             cursor.level[INT_GET(dib->bb_level,                              cursor.level[level-1].first_key)  {
                                         ARCH_CONVERT)-1].first_key)  {  
                                 do_warn(                                  do_warn(
                 _("out of order bmbt root key %llu in inode %llu %s fork\n"),                  _("out of order bmbt root key %llu in inode %llu %s fork\n"),
                                         first_key,                                          first_key,
Line 1354  process_btinode( Line 1351  process_btinode(
                                         forkname);                                          forkname);
                                 return(1);                                  return(1);
                         }                          }
                         last_key = cursor.level[INT_GET(dib->bb_level,                          last_key = cursor.level[level-1].first_key;
                                                 ARCH_CONVERT)-1].first_key;  
                 }                  }
         }          }
         /*          /*
Line 2064  process_dinode_int(xfs_mount_t *mp, Line 2060  process_dinode_int(xfs_mount_t *mp,
                 if (!verify_mode)  {                  if (!verify_mode)  {
                         do_warn(_("bad inode type %#o inode %llu\n"),                          do_warn(_("bad inode type %#o inode %llu\n"),
                                 (int) (INT_GET(dinoc->di_mode, ARCH_CONVERT) & S_IFMT), lino);                                  (int) (INT_GET(dinoc->di_mode, ARCH_CONVERT) & S_IFMT), lino);
                         if (!no_modify)                            if (!no_modify)
                                 *dirty += clear_dinode(mp, dino, lino);                                  *dirty += clear_dinode(mp, dino, lino);
                         else                           else
                                 *dirty = 1;                                  *dirty = 1;
                         *cleared = 1;                          *cleared = 1;
                         *used = is_free;                          *used = is_free;

Removed from v.1.26  
changed lines
  Added in v.1.27


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>