From e55d768a375f95ac70c8e87ee1eb141200d01d4b Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Wed, 5 Jun 2002 01:22:08 +0000 Subject: [PATCH] update for repair & man page changes. --- doc/CHANGES | 4 ++++ man/man8/mkfs.xfs.8 | 2 +- repair/dir2.c | 7 ++++++- repair/phase6.c | 34 +++++++++++++++++++++++----------- 4 files changed, 34 insertions(+), 13 deletions(-) diff --git a/doc/CHANGES b/doc/CHANGES index f2780afeb..eaad5d880 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,3 +1,7 @@ +[cvs] + - Fix for xfs_repair mangling i8count for dir2_sf directories + - Minor mkfs.xfs man page update for blocksize limits on Linux + xfsprogs-2.0.6 (30 May 2002) - Fix error returns from log recovery (affects xfs_repair). - Fix the way mkfs.xfs round downs the device when the last diff --git a/man/man8/mkfs.xfs.8 b/man/man8/mkfs.xfs.8 index c2f27e0f3..0d1e59a92 100644 --- a/man/man8/mkfs.xfs.8 +++ b/man/man8/mkfs.xfs.8 @@ -73,7 +73,7 @@ or in bytes with .BR size= . The default value is 4096 bytes (4 KB) on systems with a 4KB pagesize. The minimum value for block size is 512; the maximum is 65536 (64 KB). -XFS on Linux currently only supports pagesize blocks. +XFS on Linux currently only supports pagesize or smaller blocks. .TP .B \-d Data section options. diff --git a/repair/dir2.c b/repair/dir2.c index dad3c777a..e07b4ed68 100644 --- a/repair/dir2.c +++ b/repair/dir2.c @@ -845,10 +845,15 @@ process_sf_dir2( num_entries = INT_GET(sfp->hdr.count, ARCH_CONVERT); ino_dir_size = INT_GET(dip->di_core.di_size, ARCH_CONVERT); offset = XFS_DIR2_DATA_FIRST_OFFSET; - i8 = bad_offset = *repair = 0; + bad_offset = *repair = 0; ASSERT(ino_dir_size <= max_size); + /* + * Initialize i8 based on size of parent inode number. + */ + i8 = (XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT) > XFS_DIR2_MAX_SHORT_INUM); + /* * check for bad entry count */ diff --git a/repair/phase6.c b/repair/phase6.c index 4a7f221ca..bddd9b134 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -3066,7 +3066,7 @@ shortform_dir2_entry_check(xfs_mount_t *mp, ifp = &ip->i_df; sfp = (xfs_dir2_sf_t *) ifp->if_u1.if_data; *ino_dirty = 0; - bytes_deleted = i8 = 0; + bytes_deleted = 0; max_size = ifp->if_bytes; ASSERT(ip->i_d.di_size <= ifp->if_bytes); @@ -3079,6 +3079,11 @@ shortform_dir2_entry_check(xfs_mount_t *mp, */ add_inode_ref(current_irec, current_ino_offset); + /* + * Initialise i8 counter -- the parent inode number counts as well. + */ + i8 = (XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT) > XFS_DIR2_MAX_SHORT_INUM); + /* * now run through entries, stop at first bad entry, don't need * to skip over '..' since that's encoded in its own field and @@ -3150,12 +3155,24 @@ shortform_dir2_entry_check(xfs_mount_t *mp, * to where we think lost+found should be. if that's * the case, that's the one we created in phase 6. * just skip it. no need to process it and its .. - * link is already accounted for. Also skip entries - * with bogus inode numbers if we're in no modify mode. + * link is already accounted for. */ - if ((lino == orphanage_ino && strcmp(fname, ORPHANAGE) == 0) - || (no_modify && verify_inum(mp, lino))) { + if (lino == orphanage_ino && strcmp(fname, ORPHANAGE) == 0) { + if (lino > XFS_DIR2_MAX_SHORT_INUM) + i8++; + next_sfep = (xfs_dir2_sf_entry_t *) + ((__psint_t) sfep + + XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp, sfep)); + continue; + } + + /* + * Also skip entries with bogus inode numbers if we're + * in no modify mode. + */ + + if (no_modify && verify_inum(mp, lino)) { next_sfep = (xfs_dir2_sf_entry_t *) ((__psint_t) sfep + XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp, sfep)); @@ -3202,14 +3219,9 @@ shortform_dir2_entry_check(xfs_mount_t *mp, } else if (!inode_isadir(irec, ino_offset)) { /* * check easy case first, regular inode, just bump - * the link count and continue + * the link count */ add_inode_reached(irec, ino_offset); - - next_sfep = (xfs_dir2_sf_entry_t *) - ((__psint_t) sfep + - XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp, sfep)); - continue; } else { parent = get_inode_parent(irec, ino_offset); -- 2.39.5