xfs
[Top] [All Lists]

Re: [PATCH 01/11] xfs: remove xfs_itruncate_data

To: Ben Myers <bpm@xxxxxxx>
Subject: Re: [PATCH 01/11] xfs: remove xfs_itruncate_data
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Wed, 4 Jan 2012 04:27:28 -0500
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx
In-reply-to: <20120103215345.GA6390@xxxxxxx>
References: <20111218200003.557507716@xxxxxxxxxxxxxxxxxxxxxx> <20111218200130.784802192@xxxxxxxxxxxxxxxxxxxxxx> <20120103215345.GA6390@xxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
> You've tossed xfs_isize_check in the round filer, but you didn't mention
> that in your commit message.  Isn't this still useful code?

It falls under the removal of a few asserts in the debug build.  I don't
think it's a useful check.

> > -   if (ip->i_size != new_size) {
> > -           ip->i_d.di_size = new_size;
> > -           ip->i_size = new_size;
> > -   }
> > -
> > -   ASSERT(new_size != 0 || ip->i_delayed_blks == 0);
> 
> You didn't pull this assert along with 
> 
> > -   ASSERT(new_size != 0 || ip->i_d.di_nextents == 0);
> 
> this one into xfs_qm_scall_trunc_qfile.  Was that intentional?


We never have delayed blocks on the quota files, so there's not much
of a point to have this assert.

> > -   error = xfs_itruncate_data(&tp, ip, 0);
> > +   ip->i_d.di_size = 0;
> > +   ip->i_size = 0;
> > +   xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
> > +
> > +   error = xfs_itruncate_extents(&tp, ip, XFS_DATA_FORK, 0);
> 
> It it worth a comment that you log the size here because of the
> possibility of another file being allocated these extents in the face of
> a crash?

I don't think there's a point in duplicating that comment.  Eventually
I'll see if we can simply use the existing truncate code for the quota
files anyway.

> > -           error = xfs_itruncate_data(&tp, ip, 0);
> > +           ip->i_d.di_size = 0;
> > +           ip->i_size = 0;
> > +           xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
> 
> Maybe a comment here too?

We log inodes in tons of places without adding a comment ever time.

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