diff mbox series

[-next] fs: use LIST_HEAD() to simplify code

Message ID 20240821065456.2294216-1-lihongbo22@huawei.com (mailing list archive)
State New
Headers show
Series [-next] fs: use LIST_HEAD() to simplify code | expand

Commit Message

Hongbo Li Aug. 21, 2024, 6:54 a.m. UTC
list_head can be initialized automatically with LIST_HEAD()
instead of calling INIT_LIST_HEAD().

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
 fs/buffer.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jan Kara Aug. 28, 2024, 9:28 a.m. UTC | #1
On Wed 21-08-24 14:54:56, Hongbo Li wrote:
> list_head can be initialized automatically with LIST_HEAD()
> instead of calling INIT_LIST_HEAD().
> 
> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/buffer.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/buffer.c b/fs/buffer.c
> index e55ad471c530..31a9062cad7e 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -774,12 +774,11 @@ EXPORT_SYMBOL(block_dirty_folio);
>  static int fsync_buffers_list(spinlock_t *lock, struct list_head *list)
>  {
>  	struct buffer_head *bh;
> -	struct list_head tmp;
>  	struct address_space *mapping;
>  	int err = 0, err2;
>  	struct blk_plug plug;
> +	LIST_HEAD(tmp);
>  
> -	INIT_LIST_HEAD(&tmp);
>  	blk_start_plug(&plug);
>  
>  	spin_lock(lock);
> -- 
> 2.34.1
>
Christian Brauner Aug. 28, 2024, 11:20 a.m. UTC | #2
On Wed, 21 Aug 2024 14:54:56 +0800, Hongbo Li wrote:
> list_head can be initialized automatically with LIST_HEAD()
> instead of calling INIT_LIST_HEAD().
> 
> 

Applied to the vfs.misc branch of the vfs/vfs.git tree.
Patches in the vfs.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc

[1/1] fs: use LIST_HEAD() to simplify code
      https://git.kernel.org/vfs/vfs/c/c594d308f43f
diff mbox series

Patch

diff --git a/fs/buffer.c b/fs/buffer.c
index e55ad471c530..31a9062cad7e 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -774,12 +774,11 @@  EXPORT_SYMBOL(block_dirty_folio);
 static int fsync_buffers_list(spinlock_t *lock, struct list_head *list)
 {
 	struct buffer_head *bh;
-	struct list_head tmp;
 	struct address_space *mapping;
 	int err = 0, err2;
 	struct blk_plug plug;
+	LIST_HEAD(tmp);
 
-	INIT_LIST_HEAD(&tmp);
 	blk_start_plug(&plug);
 
 	spin_lock(lock);