Date: Tue, 16 Mar 2021 09:53:39 +0100 From: Alexander Lochmann <alexander.lochmann@tu-dortmund.de> To: Konstantin Belousov <kostikbel@gmail.com> Cc: freebsd-fs@freebsd.org Subject: Re: [RFC] Understanding the locking of struct buf Message-ID: <9e591bfe-1790-251e-a90c-79c6ec66b3ac@tu-dortmund.de> In-Reply-To: <YE3KzAiZwcSZZLWS@kib.kiev.ua> References: <49130618-349a-bfc7-6d26-0c3763904dc5@tu-dortmund.de> <YEwx0WdSuJpzhONL@kib.kiev.ua> <c49dc72a-da0f-a089-7e93-e4e54d0c03eb@tu-dortmund.de> <YEy3JET6Lx7BkJP3@kib.kiev.ua> <48913698-d2e8-9721-ee1a-4828a9265e55@tu-dortmund.de> <YE3KzAiZwcSZZLWS@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On 14.03.21 09:35, Konstantin Belousov wrote: > You cannot write any working code that uses buffer cache, without studying > both buffer cache code itself, and examples using it from filesystems. > Short (even the whole-screen short) herald comment cannot explain all the > nuances that grown in the 40+ years codebase. I see. > >> Shouldn't that particular piece of documentation be updated? >> For example: b_bcount /* w: b_lock, r: no lock needed */ > Do you understand the purpose of the locking? What do you intent to do > with the read value of b_bcount, if you do not own the buffer? What is > you next action with that value? > I do know the purpose of locking. I have no particular usage in mind at the moment. I'm trying to understand how locking is handled in FreeBSD. In the Linux kernel, for example, there are such exceptions: Read a ptr without a lock to perform a NULL check. All I'm asking was whether the documentation should reflect those exceptions. I assume the answer is no. Thank you, Konstantin, for lifting the fog. - Alex -- Technische Universität Dortmund Alexander Lochmann PGP key: 0xBC3EF6FD Otto-Hahn-Str. 16 phone: +49.231.7556141 D-44227 Dortmund fax: +49.231.7556116 http://ess.cs.tu-dortmund.de/Staff/al
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9e591bfe-1790-251e-a90c-79c6ec66b3ac>