Linux内核fs/buffer.c中brelse函数的缩写含义咨询
brelse Kernel Function Name Great question! Kernel function names are often packed with terse, historical abbreviations that can feel confusing at first glance—let’s break down brelse clearly:
The
babsolutely stands for buffer. This function lives infs/buffer.cand operates directly onstruct buffer_headstructures, which represent cached disk blocks in the kernel’s buffer cache.relseis a shortened form of release. It’s not a "redundant" abbreviation—instead, it’s a product of early Linux kernel conventions where developers favored extremely concise function names to save characters (a holdover from older Unix systems where shorter names were practical for both typing and tooling constraints).To put it all together:
brelseis shorthand for buffer release. Its core job is to decrement the reference count of astruct buffer_head; if the count drops to zero, the buffer is moved back to the kernel’s free buffer list or cleaned up as needed. It’s the direct counterpart to functions likegetblk(get block), which acquires a reference to a buffer head.
This style of abbreviation is pervasive in the kernel—you’ll see similar patterns with functions like kfree (kernel free) or kmalloc (kernel malloc), where brevity took priority over verbose spelling in the project’s early days.
内容的提问来源于stack exchange,提问作者andi8086

