The extra indentation confused the kernel-doc parser, so remove it.
Fix some other wording while I'm here, and advise the user they need to
call brelse() on this buffer.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/buffer_head.h | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index d78454a4dd1f..7558cd1d3eb3 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -437,14 +437,17 @@ static inline void bh_readahead_batch(int nr, struct buffer_head *bhs[],
}
/**
- * __bread() - reads a specified block and returns the bh
- * @bdev: the block_device to read from
- * @block: number of block
- * @size: size (in bytes) to read
+ * __bread() - Read a block.
+ * @bdev: The block device to read from.
+ * @block: Block number in units of block size.
+ * @size: Block size in bytes.
*
- * Reads a specified block, and returns buffer head that contains it.
- * The page cache is allocated from movable area so that it can be migrated.
- * It returns NULL if the block was unreadable.
+ * 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 buffer head has its refcount elevated and the caller
+ * should call brelse() when it has finished with the buffer.
+ *
+ * Return: NULL if the block was unreadable.
*/
static inline struct buffer_head *
__bread(struct block_device *bdev, sector_t block, unsigned size)
--
2.43.0
On Thu, Jan 04, 2024 at 04:36:51PM +0000, Matthew Wilcox (Oracle) wrote: > The extra indentation confused the kernel-doc parser, so remove it. > Fix some other wording while I'm here, and advise the user they need to > call brelse() on this buffer. > It looks like __bread_gfp has the same problem: diff --git a/fs/buffer.c b/fs/buffer.c index 967f34b70aa8..cfdf45cc290a 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -1446,16 +1446,18 @@ void __breadahead(struct block_device *bdev, sector_t block, unsigned size) EXPORT_SYMBOL(__breadahead); /** - * __bread_gfp() - reads a specified block and returns the bh - * @bdev: the block_device to read from - * @block: number of block - * @size: size (in bytes) to read - * @gfp: page allocation flag + * __bread_gfp() - Read a block. + * @bdev: The block device to read from. + * @block: Block number in units of block size. + * @size: Block size in bytes. * - * Reads a specified block, and returns buffer head that contains it. - * The page cache can be allocated from non-movable area - * not to prevent page migration if you set gfp to zero. - * It returns NULL if the block was unreadable. + * Read a specified block, and return the buffer head that refers to it. + * The memory can be allocated from a non-movable area to not to prevent + * page migration if you set gfp to zero. The buffer head has its + * refcount elevated and the caller should call brelse() when it has + * finished with the buffer. + * + * Return: NULL if the block was unreadable. */ struct buffer_head * __bread_gfp(struct block_device *bdev, sector_t block, (END) Another option is to just change this in __bread_gfp() and add a See __bread_gfp() in __bread()?
On Mon, Jan 08, 2024 at 03:58:08PM +0100, Pankaj Raghav (Samsung) wrote: > On Thu, Jan 04, 2024 at 04:36:51PM +0000, Matthew Wilcox (Oracle) wrote: > > The extra indentation confused the kernel-doc parser, so remove it. > > Fix some other wording while I'm here, and advise the user they need to > > call brelse() on this buffer. > > > It looks like __bread_gfp has the same problem: I'm happy to incorporate this patch, but I'll need your S-o-B on it. > diff --git a/fs/buffer.c b/fs/buffer.c > index 967f34b70aa8..cfdf45cc290a 100644 > --- a/fs/buffer.c > +++ b/fs/buffer.c > @@ -1446,16 +1446,18 @@ void __breadahead(struct block_device *bdev, sector_t block, unsigned size) > EXPORT_SYMBOL(__breadahead); > > /** > - * __bread_gfp() - reads a specified block and returns the bh > - * @bdev: the block_device to read from > - * @block: number of block > - * @size: size (in bytes) to read > - * @gfp: page allocation flag > + * __bread_gfp() - Read a block. > + * @bdev: The block device to read from. > + * @block: Block number in units of block size. > + * @size: Block size in bytes. > * > - * Reads a specified block, and returns buffer head that contains it. > - * The page cache can be allocated from non-movable area > - * not to prevent page migration if you set gfp to zero. > - * It returns NULL if the block was unreadable. > + * Read a specified block, and return the buffer head that refers to it. > + * The memory can be allocated from a non-movable area to not to prevent > + * page migration if you set gfp to zero. The buffer head has its > + * refcount elevated and the caller should call brelse() when it has > + * finished with the buffer. > + * > + * Return: NULL if the block was unreadable. > */ > struct buffer_head * > __bread_gfp(struct block_device *bdev, sector_t block, > (END) > > Another option is to just change this in __bread_gfp() and add a See > __bread_gfp() in __bread()?
On Mon, Jan 08, 2024 at 04:09:01PM +0000, Matthew Wilcox wrote: > On Mon, Jan 08, 2024 at 03:58:08PM +0100, Pankaj Raghav (Samsung) wrote: > > On Thu, Jan 04, 2024 at 04:36:51PM +0000, Matthew Wilcox (Oracle) wrote: > > > The extra indentation confused the kernel-doc parser, so remove it. > > > Fix some other wording while I'm here, and advise the user they need to > > > call brelse() on this buffer. > > > > > It looks like __bread_gfp has the same problem: > > I'm happy to incorporate this patch, but I'll need your S-o-B on it. Something like this: From: "Matthew Wilcox (Oracle)" <willy@infradead.org> Date: Mon, 8 Jan 2024 19:37:41 +0100 Subject: [PATCH] buffer: Update __bread() and __bread_gfp kernel-doc The extra indentation confused the kernel-doc parser, so remove it. Fix some other wording while I'm here, and advise the user they need to call brelse() on this buffer. Instead of duplicating the doc in __bread() and __bread_gfp(), update __bread_gfp() doc and point to it from __bread(). Signed-off-by: "Matthew Wilcox (Oracle)" <willy@infradead.org> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com> --- fs/buffer.c | 21 ++++++++++++--------- include/linux/buffer_head.h | 9 +-------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 967f34b70aa8..ea55fb3fcfae 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -1446,16 +1446,19 @@ void __breadahead(struct block_device *bdev, sector_t block, unsigned size) EXPORT_SYMBOL(__breadahead); /** - * __bread_gfp() - reads a specified block and returns the bh - * @bdev: the block_device to read from - * @block: number of block - * @size: size (in bytes) to read - * @gfp: page allocation flag + * __bread_gfp() - Read a block. + * @bdev: The block device to read from. + * @block: Block number in units of block size. + * @size: Block size in bytes. + * @gfp: gfp flags. * - * Reads a specified block, and returns buffer head that contains it. - * The page cache can be allocated from non-movable area - * not to prevent page migration if you set gfp to zero. - * It returns NULL if the block was unreadable. + * Read a specified block, and return the buffer head that refers to it. + * The memory can be allocated from a non-movable area to not to prevent + * page migration if you set gfp to zero. The buffer head has its + * refcount elevated and the caller should call brelse() when it has + * finished with the buffer. + * + * Return: NULL if the block was unreadable. */ struct buffer_head * __bread_gfp(struct block_device *bdev, sector_t block, diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 5f23ee599889..ac56014b29dd 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -440,14 +440,7 @@ static inline void bh_readahead_batch(int nr, struct buffer_head *bhs[], } /** - * __bread() - reads a specified block and returns the bh - * @bdev: the block_device to read from - * @block: number of block - * @size: size (in bytes) to read - * - * Reads a specified block, and returns buffer head that contains it. - * The page cache is allocated from movable area so that it can be migrated. - * It returns NULL if the block was unreadable. + * See __bread_gfp() */ static inline struct buffer_head * __bread(struct block_device *bdev, sector_t block, unsigned size) -- 2.40.1
© 2016 - 2025 Red Hat, Inc.