xfs
[Top] [All Lists]

Re: [PATCH 13/25] xfs: introduce xfs_bmap_last_extent

To: Alex Elder <aelder@xxxxxxx>
Subject: Re: [PATCH 13/25] xfs: introduce xfs_bmap_last_extent
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Sat, 10 Sep 2011 14:45:42 -0400
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx
In-reply-to: <1315599826.1999.58.camel@doink>
References: <20110824060428.789245205@xxxxxxxxxxxxxxxxxxxxxx> <20110824060643.154462765@xxxxxxxxxxxxxxxxxxxxxx> <1315599826.1999.58.camel@doink>
User-agent: Mutt/1.5.21 (2010-09-15)
On Fri, Sep 09, 2011 at 03:23:46PM -0500, Alex Elder wrote:
> On Wed, 2011-08-24 at 02:04 -0400, Christoph Hellwig wrote:
> > plain text document attachment (xfs-simplify-xfs_bmap_isaeof)
> > Add a common helper for finding the last extent in a file.
> > 
> > Largely based on a patch from Dave Chinner.
> 
> 
> The new version of xfs_bmap_isaeof() no longer asserts
> that the data fork is the one being operated on.  Why?

Because it would work perfectly fine for the attr fork, too - even
if it's fairly useless for it.

> fork is empty, so mention that case in the comment header:
>  
>     Returns 0 in *aeof if the file (fork) is empty.
> 
> (Maybe you could explain why this is true at a more
> abstract level though.)

I've done both.

> This logic could be shortened:
> 
>               *aeof = off >= rec.br_startoff + rec.br_blockcount ||
>                       (off >= rec.br_startoff &&
>                                isnullstartblock(rec.br_startblock);

Done (including a comment update)

> > +   return 0;
> > +}
> > +
> > +/*
> > + * Check if the endoff is outside the last extent. If so the caller will 
> > grow
> > + * the allocation to a stripe unit boundary.
> 
>     All offsets are considered outside the end of file for an
>     empty file (fork), so 1 is returned in *eof in that case.

Ok.

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