Date: Fri, 12 Apr 2019 09:39:55 -0600 From: Warner Losh <imp@bsdimp.com> To: Alan Somers <asomers@freebsd.org> Cc: FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Re: When can a struct buf's b_lblkno field by < 0 ? Message-ID: <CANCZdfrkHFzue13291=sh68DoYvfoax1xndBXL=3cpx7UD-1fw@mail.gmail.com> In-Reply-To: <CAOtMX2iUqx3T-VNrj=KkpvWn0AFti-ZoGTL87EewiwNKWi7byw@mail.gmail.com> References: <CAOtMX2iUqx3T-VNrj=KkpvWn0AFti-ZoGTL87EewiwNKWi7byw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Apr 12, 2019 at 9:12 AM Alan Somers <asomers@freebsd.org> wrote: > In struct buf, b_lblkno is documented as "Logical block number". I > would expect that to always be nonnegative. However, vtruncbuf loops > through a list of buffers, skipping those where "bp->b_lblkno > 0". > Maybe that's just an awkward way of writing "do something for the > buffer where b_lblkno == 0", but SVN archaeology suggests otherwise. > Before r112182, the code looked like this, implying that the b_lblkno > could actually be negative: > > if ((bp->b_flags & B_DELWRI) && (bp->b_lblkno < 0)) { > > Does anybody know under what circumstances that field might be > negative? Also, was r112182 a correct change? It appears to have > negated "<" and gotten ">", neglecting the "==" case. > > https://svnweb.freebsd.org/base/head/sys/kern/vfs_subr.c?r1=112182&r2=112181&pathrev=112182 b_lblkno can be negative when it describes the meta-data for a file, non-negative when it describes data for the file. Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfrkHFzue13291=sh68DoYvfoax1xndBXL=3cpx7UD-1fw>