Date: Sat, 13 Apr 2019 14:28:38 -0600 From: Alan Somers <asomers@freebsd.org> To: Kirk McKusick <mckusick@mckusick.com> Cc: Konstantin Belousov <kostikbel@gmail.com>, FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Re: When can a struct buf's b_lblkno field by < 0 ? Message-ID: <CAOtMX2h0p-f9kQSrPSw8=9Vp_bSW6AfStV2ee4NowdeHER3-UQ@mail.gmail.com> In-Reply-To: <201904131946.x3DJkPIk097337@chez.mckusick.com> References: <20190413154340.GJ1923@kib.kiev.ua> <201904131946.x3DJkPIk097337@chez.mckusick.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Apr 13, 2019 at 1:37 PM Kirk McKusick <mckusick@mckusick.com> 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. > > Kirk So I think you're saying that the last loop is indeed necessary, except when b_lblkno == 0 ?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2h0p-f9kQSrPSw8=9Vp_bSW6AfStV2ee4NowdeHER3-UQ>