All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: axboe@kernel.dk
Cc: linux-block@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH 03/17] mm: don't include <linux/blkdev.h> in <linux/backing-dev.h>
Date: Mon, 20 Sep 2021 14:33:14 +0200	[thread overview]
Message-ID: <20210920123328.1399408-4-hch@lst.de> (raw)
In-Reply-To: <20210920123328.1399408-1-hch@lst.de>

Move inode_to_bdi out of line to avoid having to include blkdev.h.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/mtd/mtdsuper.c      |  1 +
 fs/ntfs/file.c              |  1 +
 fs/ntfs3/file.c             |  1 +
 fs/orangefs/inode.c         |  2 +-
 include/linux/backing-dev.h | 16 +---------------
 mm/backing-dev.c            | 16 ++++++++++++++++
 6 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c
index 38b6aa849c638..5ff001140ef4a 100644
--- a/drivers/mtd/mtdsuper.c
+++ b/drivers/mtd/mtdsuper.c
@@ -15,6 +15,7 @@
 #include <linux/slab.h>
 #include <linux/major.h>
 #include <linux/backing-dev.h>
+#include <linux/blkdev.h>
 #include <linux/fs_context.h>
 #include "mtdcore.h"
 
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index ab4f3362466d0..373dbb6276570 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -5,6 +5,7 @@
  * Copyright (c) 2001-2015 Anton Altaparmakov and Tuxera Inc.
  */
 
+#include <linux/blkdev.h>
 #include <linux/backing-dev.h>
 #include <linux/buffer_head.h>
 #include <linux/gfp.h>
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index 424450e77ad52..7592ba8944572 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -8,6 +8,7 @@
  */
 
 #include <linux/backing-dev.h>
+#include <linux/blkdev.h>
 #include <linux/buffer_head.h>
 #include <linux/compat.h>
 #include <linux/falloc.h>
diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index c1bb4c4b5d672..e5e3e500ed462 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -10,7 +10,7 @@
  *  Linux VFS inode operations.
  */
 
-#include <linux/bvec.h>
+#include <linux/blkdev.h>
 #include <linux/fileattr.h>
 #include "protocol.h"
 #include "orangefs-kernel.h"
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 843bf4be675f3..4ac7ce0960139 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -12,7 +12,6 @@
 #include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/sched.h>
-#include <linux/blkdev.h>
 #include <linux/device.h>
 #include <linux/writeback.h>
 #include <linux/backing-dev-defs.h>
@@ -134,20 +133,7 @@ static inline bool writeback_in_progress(struct bdi_writeback *wb)
 	return test_bit(WB_writeback_running, &wb->state);
 }
 
-static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
-{
-	struct super_block *sb;
-
-	if (!inode)
-		return &noop_backing_dev_info;
-
-	sb = inode->i_sb;
-#ifdef CONFIG_BLOCK
-	if (sb_is_blkdev_sb(sb))
-		return I_BDEV(inode)->bd_disk->bdi;
-#endif
-	return sb->s_bdi;
-}
+struct backing_dev_info *inode_to_bdi(struct inode *inode);
 
 static inline int wb_congested(struct bdi_writeback *wb, int cong_bits)
 {
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 5245744437dc9..c878d995af06e 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -978,6 +978,22 @@ void bdi_put(struct backing_dev_info *bdi)
 }
 EXPORT_SYMBOL(bdi_put);
 
+struct backing_dev_info *inode_to_bdi(struct inode *inode)
+{
+	struct super_block *sb;
+
+	if (!inode)
+		return &noop_backing_dev_info;
+
+	sb = inode->i_sb;
+#ifdef CONFIG_BLOCK
+	if (sb_is_blkdev_sb(sb))
+		return I_BDEV(inode)->bd_disk->bdi;
+#endif
+	return sb->s_bdi;
+}
+EXPORT_SYMBOL(inode_to_bdi);
+
 const char *bdi_dev_name(struct backing_dev_info *bdi)
 {
 	if (!bdi || !bdi->dev)
-- 
2.30.2


  parent reply	other threads:[~2021-09-20 12:35 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20 12:33 untangle the block headers v2 Christoph Hellwig
2021-09-20 12:33 ` [PATCH 01/17] mm: don't include <linux/blk-cgroup.h> in <linux/writeback.h> Christoph Hellwig
2021-09-20 12:53   ` Johannes Thumshirn
2021-09-20 22:13   ` Bart Van Assche
2021-09-21  6:36     ` Christoph Hellwig
2021-09-20 12:33 ` [PATCH 02/17] mm: don't include <linux/blk-cgroup.h> in <linux/backing-dev.h> Christoph Hellwig
2021-09-20 12:33 ` Christoph Hellwig [this message]
2021-09-20 12:54   ` [PATCH 03/17] mm: don't include <linux/blkdev.h> " Johannes Thumshirn
2021-09-20 12:33 ` [PATCH 04/17] mm: remove spurious blkdev.h includes Christoph Hellwig
2021-09-20 12:33 ` [PATCH 05/17] arch: " Christoph Hellwig
2021-09-20 12:33 ` [PATCH 06/17] kernel: " Christoph Hellwig
2021-09-20 12:33 ` [PATCH 07/17] sched: move the <linux/blkdev.h> include out of kernel/sched/sched.h Christoph Hellwig
2021-09-20 12:33 ` [PATCH 08/17] block: remove the unused rq_end_sector macro Christoph Hellwig
2021-09-20 12:55   ` Johannes Thumshirn
2021-09-20 12:33 ` [PATCH 09/17] block: remove the unused blk_queue_state enum Christoph Hellwig
2021-09-20 12:56   ` Johannes Thumshirn
2021-09-20 12:33 ` [PATCH 10/17] block: remove the cmd_size field from struct request_queue Christoph Hellwig
2021-09-20 12:59   ` Johannes Thumshirn
2021-09-20 12:33 ` [PATCH 11/17] block: remove the struct blk_queue_ctx forward declaration Christoph Hellwig
2021-09-20 13:00   ` Johannes Thumshirn
2021-09-20 12:33 ` [PATCH 12/17] block: move elevator.h to block/ Christoph Hellwig
2021-09-20 13:02   ` Johannes Thumshirn
2021-09-20 12:33 ` [PATCH 13/17] block: drop unused includes in <linux/blkdev.h> Christoph Hellwig
2021-09-20 12:33 ` [PATCH 14/17] block: drop unused includes in <linux/genhd.h> Christoph Hellwig
2021-09-20 12:33 ` [PATCH 15/17] block: move a few merge helpers out of <linux/blkdev.h> Christoph Hellwig
2021-09-20 12:33 ` [PATCH 16/17] block: move integrity handling " Christoph Hellwig
2021-09-20 12:33 ` [PATCH 17/17] block: move struct request to blk-mq.h Christoph Hellwig
2021-09-27 23:14 ` untangle the block headers v2 Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2021-09-15  6:40 untangle the block headers Christoph Hellwig
2021-09-15  6:40 ` [PATCH 03/17] mm: don't include <linux/blkdev.h> in <linux/backing-dev.h> 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=20210920123328.1399408-4-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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.