All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: axboe@kernel.dk
Cc: yuyufen@huawei.com, tj@kernel.org, jack@suse.cz,
	bvanassche@acm.org, tytso@mit.edu, hdegoede@redhat.com,
	gregkh@linuxfoundation.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 8/9] bdi: simplify bdi_alloc
Date: Wed, 22 Apr 2020 09:38:50 +0200	[thread overview]
Message-ID: <20200422073851.303714-9-hch@lst.de> (raw)
In-Reply-To: <20200422073851.303714-1-hch@lst.de>

Merge the _node vs normal version and drop the superflous gfp_t argument.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 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 bb993f99d424..1f55d5b8269f 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.26.1


  parent reply	other threads:[~2020-04-22  7:39 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22  7:38 bdi: fix use-after-free for dev_name(bdi->dev) v3 Christoph Hellwig
2020-04-22  7:38 ` [PATCH 1/9] vboxsf: don't use the source name in the bdi name Christoph Hellwig
2020-04-22  8:15   ` Hans de Goede
2020-04-22  7:38 ` [PATCH 2/9] bdi: move bdi_dev_name out of line Christoph Hellwig
2020-04-23  0:07   ` Bart Van Assche
2020-04-22  7:38 ` [PATCH 3/9] bdi: use bdi_dev_name() to get device name Christoph Hellwig
2020-04-22  9:07   ` Jan Kara
2020-04-23  0:08   ` Bart Van Assche
2020-04-22  7:38 ` [PATCH 4/9] bdi: add a ->dev_name field to struct backing_dev_info Christoph Hellwig
2020-04-22  9:08   ` Jan Kara
2020-04-23  0:09   ` Bart Van Assche
2020-04-22  7:38 ` [PATCH 5/9] driver core: remove device_create_vargs Christoph Hellwig
2020-04-22  9:09   ` Jan Kara
2020-04-22  7:38 ` [PATCH 6/9] bdi: unexport bdi_register_va Christoph Hellwig
2020-04-23  0:11   ` Bart Van Assche
2020-04-22  7:38 ` [PATCH 7/9] bdi: remove bdi_register_owner Christoph Hellwig
2020-04-23  0:13   ` Bart Van Assche
2020-04-22  7:38 ` Christoph Hellwig [this message]
2020-04-23  0:13   ` [PATCH 8/9] bdi: simplify bdi_alloc Bart Van Assche
2020-04-22  7:38 ` [PATCH 9/9] bdi: remove the name field in struct backing_dev_info Christoph Hellwig
2020-04-23  0:16   ` Bart Van Assche
2020-04-25  7:59 ` bdi: fix use-after-free for dev_name(bdi->dev) v3 Christoph Hellwig
2020-04-25 10:43   ` Hans de Goede
2020-04-28  6:52 ` Christoph Hellwig
2020-05-04 12:47 bdi: fix use-after-free for dev_name(bdi->dev) v3 (resend) Christoph Hellwig
2020-05-04 12:48 ` [PATCH 8/9] bdi: simplify bdi_alloc Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200422073851.303714-9-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=jack@suse.cz \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=tytso@mit.edu \
    --cc=yuyufen@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.