Re: [PATCH 7/8] bdi: simplify bdi_alloc
From: Jan Kara
Date: Thu Apr 16 2020 - 08:07:20 EST
On Thu 16-04-20 09:15:18, Christoph Hellwig wrote:
> Merge the _node vs normal version and drop the superflous gfp_t argument.
>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
Looks good to me. You can add:
Reviewed-by: Jan Kara <jack@xxxxxxx>
Honza
> ---
> block/blk-core.c | 2 +-
> drivers/mtd/mtdcore.c | 2 +-
> fs/super.c | 2 +-
> include/linux/backing-dev.h | 6 +-----
> mm/backing-dev.c | 7 +++----
> 5 files changed, 7 insertions(+), 12 deletions(-)
>
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 7e4a1da0715e..ab87f2833ab2 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -484,7 +484,7 @@ struct request_queue *__blk_alloc_queue(int node_id)
> if (ret)
> goto fail_id;
>
> - q->backing_dev_info = bdi_alloc_node(GFP_KERNEL, node_id);
> + q->backing_dev_info = bdi_alloc(node_id);
> if (!q->backing_dev_info)
> goto fail_split;
>
> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> index 2916674208b3..39ec563d9a14 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -2036,7 +2036,7 @@ static struct backing_dev_info * __init mtd_bdi_init(char *name)
> struct backing_dev_info *bdi;
> int ret;
>
> - bdi = bdi_alloc(GFP_KERNEL);
> + bdi = bdi_alloc(NUMA_NO_NODE);
> if (!bdi)
> return ERR_PTR(-ENOMEM);
>
> diff --git a/fs/super.c b/fs/super.c
> index cd352530eca9..dd28fcd706ff 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -1598,7 +1598,7 @@ int super_setup_bdi_name(struct super_block *sb, char *fmt, ...)
> int err;
> va_list args;
>
> - bdi = bdi_alloc(GFP_KERNEL);
> + bdi = bdi_alloc(NUMA_NO_NODE);
> if (!bdi)
> return -ENOMEM;
>
> diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
> index 4098ed6ba6b4..6b3504bf7a42 100644
> --- a/include/linux/backing-dev.h
> +++ b/include/linux/backing-dev.h
> @@ -36,11 +36,7 @@ int bdi_register_va(struct backing_dev_info *bdi, const char *fmt,
> void bdi_set_owner(struct backing_dev_info *bdi, struct device *owner);
> void bdi_unregister(struct backing_dev_info *bdi);
>
> -struct backing_dev_info *bdi_alloc_node(gfp_t gfp_mask, int node_id);
> -static inline struct backing_dev_info *bdi_alloc(gfp_t gfp_mask)
> -{
> - return bdi_alloc_node(gfp_mask, NUMA_NO_NODE);
> -}
> +struct backing_dev_info *bdi_alloc(int node_id);
>
> void wb_start_background_writeback(struct bdi_writeback *wb);
> void wb_workfn(struct work_struct *work);
> diff --git a/mm/backing-dev.c b/mm/backing-dev.c
> index 1ba9a7b30933..119a41650833 100644
> --- a/mm/backing-dev.c
> +++ b/mm/backing-dev.c
> @@ -865,12 +865,11 @@ static int bdi_init(struct backing_dev_info *bdi)
> return ret;
> }
>
> -struct backing_dev_info *bdi_alloc_node(gfp_t gfp_mask, int node_id)
> +struct backing_dev_info *bdi_alloc(int node_id)
> {
> struct backing_dev_info *bdi;
>
> - bdi = kmalloc_node(sizeof(struct backing_dev_info),
> - gfp_mask | __GFP_ZERO, node_id);
> + bdi = kzalloc_node(sizeof(*bdi), GFP_KERNEL, node_id);
> if (!bdi)
> return NULL;
>
> @@ -880,7 +879,7 @@ struct backing_dev_info *bdi_alloc_node(gfp_t gfp_mask, int node_id)
> }
> return bdi;
> }
> -EXPORT_SYMBOL(bdi_alloc_node);
> +EXPORT_SYMBOL(bdi_alloc);
>
> static struct rb_node **bdi_lookup_rb_node(u64 id, struct rb_node **parentp)
> {
> --
> 2.25.1
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR