diff options
| author | Christian Brauner <brauner@kernel.org> | 2026-09-04 12:54:52 +0200 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-09-10 09:27:29 +0200 |
| commit | 7c5bb35718a6ecc2001e2f8f6abc068ab926b583 (patch) | |
| tree | 73b38691bf46dcd45f3746630ba71535124811ea /include/linux | |
| parent | 00db7c70bf7c6a79a548f484c76af60563a7736e (diff) | |
| parent | a21153de5aa936900aa98fd81643895c7fd2a267 (diff) | |
Merge patch series "Buffer head documentation updates"
Matthew Wilcox (Oracle) <willy@infradead.org> says:
Mostly just tidying up some out of date documentation, but I found the
time to document some functions I thought were worth documenting.
* patches from https://patch.msgid.link/20260828205429.3678204-1-willy@infradead.org:
buffer: Rename label
buffer: Refer to folios in comments
buffer: Document mmb_mark_buffer_dirty()
buffer: Document sb_bread(), sb_bread_unmovable() and sb_breadahead()
fs: Remove references to mark_buffer_dirty_inode()
buffer: Remove reference to unmap_buffer()
Link: https://patch.msgid.link/20260828205429.3678204-1-willy@infradead.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/buffer_head.h | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 20b8fca1abfa..e7a701ce029d 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -364,20 +364,58 @@ static inline void bforget(struct buffer_head *bh) __bforget(bh); } -static inline struct buffer_head * -sb_bread(struct super_block *sb, sector_t block) +/** + * sb_bread - Read a block. + * @sb: The superblock to read from. + * @block: Block number in units of block size. + * + * Read a specified block, and return the buffer head that refers + * to it. The memory is allocated from the movable area so that it can + * be migrated. The returned buffer head has its refcount increased. + * The caller should call brelse() when it has finished with the buffer. + * + * Context: May sleep waiting for I/O. + * Return: NULL if the block was unreadable. + */ +static inline +struct buffer_head *sb_bread(struct super_block *sb, sector_t block) { return __bread_gfp(sb->s_bdev, block, sb->s_blocksize, __GFP_MOVABLE); } -static inline struct buffer_head * -sb_bread_unmovable(struct super_block *sb, sector_t block) +/** + * sb_bread_unmovable - Read a block. + * @sb: The superblock to read from. + * @block: Block number in units of block size. + * + * Read a specified block, and return the buffer head that refers to it. + * The memory is allocated from the unmovable area so that pointers into + * it remain valid after compaction runs. The returned buffer head has + * its refcount increased. The caller should call brelse() when it has + * finished with the buffer. + * + * Context: May sleep waiting for I/O. + * Return: NULL if the block was unreadable. + */ +static inline +struct buffer_head *sb_bread_unmovable(struct super_block *sb, sector_t block) { return __bread_gfp(sb->s_bdev, block, sb->s_blocksize, 0); } -static inline void -sb_breadahead(struct super_block *sb, sector_t block) +/** + * sb_breadahead - Start readahead. + * @sb: Superblock identifying the block device. + * @block: The block to read. + * + * Read this block. The I/O will be flagged as being readahead rather + * than immediate read, but (unlike the page cache), surrounding blocks + * will not be read. + * + * Context: May sleep in order to allocate memory. + */ +static inline +void sb_breadahead(struct super_block *sb, sector_t block) { __breadahead(sb->s_bdev, block, sb->s_blocksize); } |
