xfs
[Top] [All Lists]

Re: REVIEW: improve/fix/update zeroing garbage in superblock sectors in

To: Barry Naujok <bnaujok@xxxxxxx>
Subject: Re: REVIEW: improve/fix/update zeroing garbage in superblock sectors in xfs_repair
From: David Chinner <dgc@xxxxxxx>
Date: Fri, 28 Mar 2008 10:57:39 +1100
Cc: "xfs@xxxxxxxxxxx" <xfs@xxxxxxxxxxx>
In-reply-to: <op.t8ntcvc23jf8g2@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <op.t8ntcvc23jf8g2@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
On Thu, Mar 27, 2008 at 04:25:33PM +1100, Barry Naujok wrote:
> Running XFS QA with a standard HDD with the bad_features2 problem
> happening and doing "mkfs.xfs -l version=1", a problem was encounter
> where it went to zero the "bad" features2 bit.
> 
> Why didn't this happen all the time?
> 
> Upon investigation, I updated the behaviour of the "secondary_sb_wack"
> function. Now it always zeroes any garbage found beyond the expected
> end of the xfs_sb_t structure in the first sector.
.....

> -             if (XFS_SB_VERSION_HASMOREBITS(sb))
> -                     size = (__psint_t)&sb->sb_features2
> -                             + sizeof(sb->sb_features2) - (__psint_t)sb;
> -             else if (XFS_SB_VERSION_HASLOGV2(sb))
> -                     size = (__psint_t)&sb->sb_logsunit
> +     if (xfs_sb_version_hasmorebits(sb))
> +             size = (__psint_t)&sb->sb_bad_features2
> +                             + sizeof(sb->sb_bad_features2) - (__psint_t)sb;
> +     else if (xfs_sb_version_haslogv2(sb))
.....

This is still fragile and requires us to update this function every time
we add a new field to the superblock. Is there some way we can do this
that doesn't require an update for every modification to the superblock
we make?

Also - 
                size = offsetof(sb->sb_bad_features2) +
                                sizeof(sb->sb_bad_features2);

or in the case of the last entry in the superblock:

        size = sizeof(xfs_dsb_t);

                
Cheers,

Dave.
-- 
Dave Chinner
Principal Engineer
SGI Australian Software Group


<Prev in Thread] Current Thread [Next in Thread>