]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Fix for bug number 843792 - xfs_repair incorrectly nukes sb_dirblklog
authorNathan Scott <nathans@sgi.com>
Thu, 13 Dec 2001 02:30:39 +0000 (02:30 +0000)
committerNathan Scott <nathans@sgi.com>
Thu, 13 Dec 2001 02:30:39 +0000 (02:30 +0000)
superblock field for non-default block sizes.

repair/agheader.c

index 40ed713be28f55a56c6c122e6b6bed31540392fa..36b4b37edd80c81fad0e55ed31485afd6c3ea84f 100644 (file)
@@ -202,15 +202,15 @@ compare_sb(xfs_mount_t *mp, xfs_sb_t *sb)
 }
 
 /*
- * possible fields that may have been set at mkfs time,
- * sb_inoalignmt, sb_unit, sb_width.  We know that
- * the quota inode fields in the secondaries should be zero.
+ * Possible fields that may have been set at mkfs time,
+ * sb_inoalignmt, sb_unit, sb_width and sb_dirblklog.
+ * The quota inode fields in the secondaries should be zero.
  * Likewise, the sb_flags and sb_shared_vn should also be
  * zero and the shared version bit should be cleared for
  * current mkfs's.
  *
- * And everything else in the buffer beyond sb_width should
- * be zeroed.
+ * And everything else in the buffer beyond either sb_width
+ * or sb_dirblklog (v2 dirs) should be zeroed.
  */
 int
 secondary_sb_wack(xfs_mount_t *mp, xfs_buf_t *sbuf, xfs_sb_t *sb,
@@ -241,8 +241,12 @@ secondary_sb_wack(xfs_mount_t *mp, xfs_buf_t *sbuf, xfs_sb_t *sb,
                 * work against older filesystems when the superblock
                 * gets rev'ed again with new fields appended.
                 */
-               size = (__psint_t)&sb->sb_width + sizeof(sb->sb_width)
-                       - (__psint_t)sb;
+               if (XFS_SB_VERSION_HASDIRV2(sb))
+                       size = (__psint_t)&sb->sb_dirblklog
+                               + sizeof(sb->sb_dirblklog) - (__psint_t)sb;
+               else
+                       size = (__psint_t)&sb->sb_width
+                               + sizeof(sb->sb_width) - (__psint_t)sb;
                for (ip = (int *)((__psint_t)sb + size);
                     ip < (int *)((__psint_t)sb + mp->m_sb.sb_sectsize);
                     ip++)  {