xfs
[Top] [All Lists]

Re: [PATCH 4/5] xfs: log file size updates as part of unwritten extent c

To: Ben Myers <bpm@xxxxxxx>
Subject: Re: [PATCH 4/5] xfs: log file size updates as part of unwritten extent conversion
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Thu, 10 Nov 2011 17:49:36 -0500
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx
In-reply-to: <20111110224302.GB29840@xxxxxxx>
References: <20111108085614.478431403@xxxxxxxxxxxxxxxxxxxxxx> <20111108085846.654476311@xxxxxxxxxxxxxxxxxxxxxx> <20111110224302.GB29840@xxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, Nov 10, 2011 at 04:43:02PM -0600, Ben Myers wrote:
> > +           /*
> > +            * Log the updated inode size as we go.  We have to be careful
> > +            * to only log it up to the actual write offset if it is
> > +            * halfway into a block.
> > +            */
> > +           i_size = XFS_FSB_TO_B(mp, offset_fsb + count_fsb);
> > +           if (i_size > offset + count)
> > +                   i_size = offset + count;
> > +
> 
> I'm missing something here.  Why wouldn't you just 
> 
> i_size = xfs_new_eof(ip, offset + count);
> 
> It's not clear to me why offset_fsb and count_fsb should be involved in
> this calculation.  Can you enlighten me?

Because at this point we don't have the full length allocated yet.
Every loop iteration has it's own transaction, and we might as well
crash before the final one.

The alternatively would be to only log a file size update during
the final loop iteration, but this variant seems a tad cleaner.

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