On Tue, 12 Oct 1999, Stephen C. Tweedie wrote:

> Hi,
> 
> On Mon, 11 Oct 1999 11:12:01 -0400 (EDT), Alexander Viro
> <[EMAIL PROTECTED]> said:
> 
> >     I began screwing around the truncate() stuff and the following is
> > a status report/request for comments:
> >     a) call of ->truncate() method (and vmtruncate()) had been moved
> > into the notify_change(). It is triggered if ATTR_SIZE is set. Modified
> > places: do_truncate(), nfsd_truncate(), nfsd_setattr() and hpfs_unlink().
> > Semantics had been changed (fixed, AFAICS) for nfsd_* - truncation happens
> > with capabilities dropped. BTW, nfsd_setattr() didn't call vmtruncate().
> > Fixed.
> 
> The page cache has very strict ordering requirements on the
> inode->i_size update, the vmtruncate call and the actual file mapping
> truncate operation.  I'd be nervous about letting the fs do too much of
> that itself: what exactly is the rationale behind the change?

        Erm... Order remains the same (set i_size, call vmtruncate(), call
->truncate()). In this respect the only modification being that 
nfsd_setattr() does vmtruncate() now (it didn't and AFAICS it's a bug -
do_truncate() and nfsd_truncate() are doing it for good reason). That's
it. The only filesystems that are doing _something_ themselves are nfs,
coda, smbfs and ncpfs. Again, the order remains the same as it used to be
- call of vmtruncate() had been moved into the end of corresponding
*_notify_change() (if we got ATTR_SIZE, indeed). The rest of filesystems
doesn't care at all - they are calling inode_setattr() and it does the
right thing.
        Rationale was:
        a) get rid of code duplication and get all calls of ->truncate()
into the same place.
        b) make it in the same place that sets i_size.
        c) on many filesystems extending ->truncate() may fail. Right now
we have no way to report said fact (or any other errors, for that matter).
Change will be easier if we will have _one_ place to look after.
        d) whatever protection of i_size et.al. we are going to do, it
will be less hassle if we'll have the things localized.
        e) now notify_change() handles ATTR_SIZE completely. Less chances
to get broken code in the future (simpler calling sequence -> less chances
of b0rken prune and graft)

        IMHO it became cleaner - I can post the detailed proof that it
preserves the ordering. It was a requirement from the very beginning.

Reply via email to