[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: When can a struct buf's b_lblkno field by < 0 ?
From:       Konstantin Belousov <kostikbel () gmail ! com>
Date:       2019-04-13 20:33:16
Message-ID: 20190413203316.GM1923 () kib ! kiev ! ua
[Download RAW message or body]

On Sat, Apr 13, 2019 at 12:46:25PM -0700, Kirk McKusick wrote:
> > Date: Sat, 13 Apr 2019 18:43:40 +0300
> > From: Konstantin Belousov <kostikbel@gmail.com>
> > To: Kirk McKusick <mckusick@mckusick.com>
> > Cc: Alan Somers <asomers@freebsd.org>,
> >         FreeBSD Hackers <freebsd-hackers@freebsd.org>
> > Subject: Re: When can a struct buf's b_lblkno field by < 0 ?
> > 
> > On Sat, Apr 13, 2019 at 08:23:54AM -0700, Kirk McKusick wrote:
> > 
> >> I don't have much to add to kib's commentary. The change in -r112182
> >> was not meant to have functional change, just reduce indentation and
> >> get rid of unnecessary code. The change should have been to 
> >> (bp->b_lblkno >= 0), but the effect is that if logical data block 0
> >> is in the cache and dirty it will be unnecessarily written. At that
> >> time all partial truncations were done synchronously, hence the
> >> flushing of all the meta-data. With the additional of journaled soft
> >> updates, it became possible to do partial truncations asynchronously.
> > 
> > Do you agree with the statement that the last loop in vtruncbuf() is
> > useless ? Its removal could only make a difference for ffs_truncate(),
> > and there, I do not think that b(a)write() is enough to ensure that the
> > indirect buffers are clean, due to dependencies.
> 
> When running with soft updates, they will ensure that everything happens
> in the right order. When running without them, the last loop is needed
> to ensure that the file is consistent before the length is set. This
> consistency is ensured because we do a bufobj_wwait() after falling out
> of the loop which will wait until all the bawrite()s have completed.

Then, should this last loop writing out dirty indirect blocks, be done in
the filesystem code (or in some vfs_bio.c helper called from filesystem code)
only when needed, instead of being placed in vtruncbuf() ?
_______________________________________________
freebsd-hackers@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic