Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

buffer: add kernel-doc for brelse() and __brelse()

Move the documentation for __brelse() to brelse(), format it as kernel-doc
and update it from talking about pages to folios.

Link: https://lkml.kernel.org/r/20240416031754.4076917-6-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Pankaj Raghav <p.raghav@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
66924fda 324ecaee

+24 -9
+8 -9
fs/buffer.c
··· 1226 1226 } 1227 1227 EXPORT_SYMBOL(mark_buffer_write_io_error); 1228 1228 1229 - /* 1230 - * Decrement a buffer_head's reference count. If all buffers against a page 1231 - * have zero reference count, are clean and unlocked, and if the page is clean 1232 - * and unlocked then try_to_free_buffers() may strip the buffers from the page 1233 - * in preparation for freeing it (sometimes, rarely, buffers are removed from 1234 - * a page but it ends up not being freed, and buffers may later be reattached). 1229 + /** 1230 + * __brelse - Release a buffer. 1231 + * @bh: The buffer to release. 1232 + * 1233 + * This variant of brelse() can be called if @bh is guaranteed to not be NULL. 1235 1234 */ 1236 - void __brelse(struct buffer_head * buf) 1235 + void __brelse(struct buffer_head *bh) 1237 1236 { 1238 - if (atomic_read(&buf->b_count)) { 1239 - put_bh(buf); 1237 + if (atomic_read(&bh->b_count)) { 1238 + put_bh(bh); 1240 1239 return; 1241 1240 } 1242 1241 WARN(1, KERN_ERR "VFS: brelse: Trying to free free buffer\n");
+16
include/linux/buffer_head.h
··· 303 303 atomic_dec(&bh->b_count); 304 304 } 305 305 306 + /** 307 + * brelse - Release a buffer. 308 + * @bh: The buffer to release. 309 + * 310 + * Decrement a buffer_head's reference count. If @bh is NULL, this 311 + * function is a no-op. 312 + * 313 + * If all buffers on a folio have zero reference count, are clean 314 + * and unlocked, and if the folio is unlocked and not under writeback 315 + * then try_to_free_buffers() may strip the buffers from the folio in 316 + * preparation for freeing it (sometimes, rarely, buffers are removed 317 + * from a folio but it ends up not being freed, and buffers may later 318 + * be reattached). 319 + * 320 + * Context: Any context. 321 + */ 306 322 static inline void brelse(struct buffer_head *bh) 307 323 { 308 324 if (bh)