diff mbox series

[01/17] mm: don't include <linux/blk-cgroup.h> in <linux/writeback.h>

Message ID 20210915064044.950534-2-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/17] mm: don't include <linux/blk-cgroup.h> in <linux/writeback.h> | expand

Commit Message

Christoph Hellwig Sept. 15, 2021, 6:40 a.m. UTC
blk-cgroup.h pulls in blkdev.h and thus pretty much all the block
headers.  Break this dependency chain by turning wbc_blkcg_css into a
macro and dropping the blk-cgroup.h include.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/gpu/drm/i915/i915_utils.h |  1 +
 fs/btrfs/inode.c                  |  1 +
 fs/quota/quota.c                  |  1 +
 include/linux/writeback.h         | 14 +++++---------
 lib/random32.c                    |  1 +
 5 files changed, 9 insertions(+), 9 deletions(-)

Comments

Johannes Thumshirn Sept. 15, 2021, 8:45 a.m. UTC | #1
On 15/09/2021 08:42, Christoph Hellwig wrote:
> diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
> index 5259edacde380..066a9118c3748 100644
> --- a/drivers/gpu/drm/i915/i915_utils.h
> +++ b/drivers/gpu/drm/i915/i915_utils.h
> @@ -30,6 +30,7 @@
>  #include <linux/sched.h>
>  #include <linux/types.h>
>  #include <linux/workqueue.h>
> +#include <linux/sched/clock.h>
>  
>  struct drm_i915_private;
>  struct timer_list;

This one

> diff --git a/lib/random32.c b/lib/random32.c
> index 4d0e05e471d72..a57a0e18819d0 100644
> --- a/lib/random32.c
> +++ b/lib/random32.c
> @@ -39,6 +39,7 @@
>  #include <linux/random.h>
>  #include <linux/sched.h>
>  #include <linux/bitops.h>
> +#include <linux/slab.h>
>  #include <asm/unaligned.h>
>  #include <trace/events/random.h>
>  
> 

and this one look unrelated.
Christoph Hellwig Sept. 15, 2021, 8:49 a.m. UTC | #2
On Wed, Sep 15, 2021 at 08:45:56AM +0000, Johannes Thumshirn wrote:
> > index 5259edacde380..066a9118c3748 100644
> > --- a/drivers/gpu/drm/i915/i915_utils.h
> > +++ b/drivers/gpu/drm/i915/i915_utils.h
> > @@ -30,6 +30,7 @@
> >  #include <linux/sched.h>
> >  #include <linux/types.h>
> >  #include <linux/workqueue.h>
> > +#include <linux/sched/clock.h>
> >  
> >  struct drm_i915_private;
> >  struct timer_list;
> 
> This one
> 
> > diff --git a/lib/random32.c b/lib/random32.c
> > index 4d0e05e471d72..a57a0e18819d0 100644
> > --- a/lib/random32.c
> > +++ b/lib/random32.c
> > @@ -39,6 +39,7 @@
> >  #include <linux/random.h>
> >  #include <linux/sched.h>
> >  #include <linux/bitops.h>
> > +#include <linux/slab.h>
> >  #include <asm/unaligned.h>
> >  #include <trace/events/random.h>
> >  
> > 
> 
> and this one look unrelated.

.. but they aren't.  All these headers indirectl pulled these headers
in before and now don't.

random32.c pulls in writeback.h through trace/events/random.h, which
pulls in blk-cgroup.h, which pull in blkdev.h, which pulls in slab.h
through some other weird twist of fate.

The drm code also somehow manages to pull in writeback.h
Johannes Thumshirn Sept. 15, 2021, 8:51 a.m. UTC | #3
On 15/09/2021 10:49, Christoph Hellwig wrote:
> 
> .. but they aren't.  All these headers indirectl pulled these headers
> in before and now don't.
> 
> random32.c pulls in writeback.h through trace/events/random.h, which
> pulls in blk-cgroup.h, which pull in blkdev.h, which pulls in slab.h
> through some other weird twist of fate.
> 
> The drm code also somehow manages to pull in writeback.h
> 

Sh*t didn't notice that. But this doesn't sound healthy.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index 5259edacde380..066a9118c3748 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -30,6 +30,7 @@ 
 #include <linux/sched.h>
 #include <linux/types.h>
 #include <linux/workqueue.h>
+#include <linux/sched/clock.h>
 
 struct drm_i915_private;
 struct timer_list;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 487533c35ddb6..4a9077c524448 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6,6 +6,7 @@ 
 #include <crypto/hash.h>
 #include <linux/kernel.h>
 #include <linux/bio.h>
+#include <linux/blk-cgroup.h>
 #include <linux/file.h>
 #include <linux/fs.h>
 #include <linux/pagemap.h>
diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index 2bcc9a6f1bfc0..052f143e2e0e1 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -10,6 +10,7 @@ 
 #include <linux/namei.h>
 #include <linux/slab.h>
 #include <asm/current.h>
+#include <linux/blkdev.h>
 #include <linux/uaccess.h>
 #include <linux/kernel.h>
 #include <linux/security.h>
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index d1f65adf6a266..8eb165760752b 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -11,7 +11,6 @@ 
 #include <linux/flex_proportions.h>
 #include <linux/backing-dev-defs.h>
 #include <linux/blk_types.h>
-#include <linux/blk-cgroup.h>
 
 struct bio;
 
@@ -109,15 +108,12 @@  static inline int wbc_to_write_flags(struct writeback_control *wbc)
 	return flags;
 }
 
-static inline struct cgroup_subsys_state *
-wbc_blkcg_css(struct writeback_control *wbc)
-{
 #ifdef CONFIG_CGROUP_WRITEBACK
-	if (wbc->wb)
-		return wbc->wb->blkcg_css;
-#endif
-	return blkcg_root_css;
-}
+#define wbc_blkcg_css(wbc) \
+	((wbc)->wb ? (wbc)->wb->blkcg_css : blkcg_root_css)
+#else
+#define wbc_blkcg_css(wbc)		(blkcg_root_css)
+#endif /* CONFIG_CGROUP_WRITEBACK */
 
 /*
  * A wb_domain represents a domain that wb's (bdi_writeback's) belong to
diff --git a/lib/random32.c b/lib/random32.c
index 4d0e05e471d72..a57a0e18819d0 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -39,6 +39,7 @@ 
 #include <linux/random.h>
 #include <linux/sched.h>
 #include <linux/bitops.h>
+#include <linux/slab.h>
 #include <asm/unaligned.h>
 #include <trace/events/random.h>