xfs
[Top] [All Lists]

Re: review: fix infinite loop in bulkstat

To: Lachlan McIlroy <lachlan@xxxxxxx>
Subject: Re: review: fix infinite loop in bulkstat
From: David Chinner <dgc@xxxxxxx>
Date: Thu, 4 Oct 2007 16:21:59 +1000
Cc: xfs-dev <xfs-dev@xxxxxxx>, xfs-oss <xfs@xxxxxxxxxxx>
In-reply-to: <4704780C.2020100@xxxxxxx>
References: <4704780C.2020100@xxxxxxx>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
On Thu, Oct 04, 2007 at 03:20:12PM +1000, Lachlan McIlroy wrote:
> This fix prevents bulkstat from spinning in an infinite loop.
> 
> Here 'agino' increments through the inodes in an allocation group.
> At the end of the innermost 'for' loop it will hold the value of the
> next inode to look at (ie the first inode in the next cluster/chunk).
> Assigning 'lastino' to 'agino' resets it to the last inode in the
> last inode cluster we just looked at.  This causes us to look up
> the very same cluster and examine all the inodes all over again,
> and again, and again...
> 
> We also want to set 'lastino' for the cases when we're not interested
> in the inode so that the next call to bulkstat wont re-examine the
> same uninteresting inodes.

Looks OK. I think you shoul dalso add a comment to the effect that
lastino needs to be set before continuing to process the next inode
in the loop so it doesn't get forgotten next time someone modifies
the code inside the loop..

Cheers,

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


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