decruft blk.h
Subsystems (2)
Hi Jens,
this series cleans up blk.h by moving various bits that are not needed out of it.
Diffstat:
blk-cgroup.c | 1 + blk-core.c | 2 ++ blk-flush.c | 7 +++++++ blk-ioc.c | 1 + blk-merge.c | 2 ++ blk-mq-debugfs.c | 1 + blk-mq.c | 1 + blk-sysfs.c | 3 ++- blk-throttle.c | 1 + blk.h | 22 +--------------------- elevator.c | 10 +++++++--- genhd.c | 2 ++ 12 files changed, 28 insertions(+), 25 deletions(-)
PATCH 1/8 block: move blk_get_flush_queue to blk-flush.c
blk_get_flush_queue is only used in blk-flush.c, so move it there.
--- block/blk-flush.c | 6 ++++++ block/blk.h | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-)
block/blk-flush.c +6 -0
@@ -95,6 +95,12 @@ enum {static void blk_kick_flush (struct request_queue *q,struct blk_flush_queue *fq,unsigned int flags); +static inline struct blk_flush_queue * +blk_get_flush_queue (struct request_queue *q,struct blk_mq_ctx *ctx) +{ +return blk_mq_map_queue (q,REQ_OP_FLUSH , ctx)->fq; +} +static unsigned int blk_flush_policy (unsigned long fflags,struct request *rq) {unsigned int policy =0 ;
block/blk.h +0 -6
@@ -35,12 +35,6 @@ extern struct kmem_cache *blk_requestq_cachep;extern struct kobj_type blk_queue_ktype;extern struct ida blk_queue_ida; -static inline struct blk_flush_queue * -blk_get_flush_queue (struct request_queue *q,struct blk_mq_ctx *ctx) -{ -return blk_mq_map_queue (q,REQ_OP_FLUSH , ctx)->fq; -} -static inline void __blk_get_queue (struct request_queue *q) {kobject_get (&q->kobj);
Signature · 1 line
2.30.2
PATCH 2/8 block: remove elevator_exit
In reply to Christoph HellwigOpen code elevator_exit in it's only caller, and rename __elevator_exit to elevator_exit.
--- block/blk-sysfs.c | 2 +- block/blk.h | 11 +---------- block/elevator.c | 4 +++- 3 files changed, 5 insertions(+), 12 deletions(-)
block/blk-sysfs.c +1 -1
@@ -747,7 +747,7 @@ static void blk_exit_queue(struct request_queue *q)*/ if (q->elevator) {ioc_clear_queue (q); -__elevator_exit (q, q->elevator); +elevator_exit (q, q->elevator); }/*
block/blk.h +1 -10
@@ -266,19 +266,10 @@ void blk_insert_flush(struct request *rq);int elevator_switch_mq (struct request_queue *q,struct elevator_type *new_e); -void __elevator_exit (struct request_queue *,struct elevator_queue *); +void elevator_exit (struct request_queue *,struct elevator_queue *);int elv_register_queue (struct request_queue *q,bool uevent);void elv_unregister_queue (struct request_queue *q); -static inline void elevator_exit (struct request_queue *q, -struct elevator_queue *e) -{ -lockdep_assert_held (&q->sysfs_lock); - -blk_mq_sched_free_rqs (q); -__elevator_exit (q, e); -} -ssize_t part_size_show (struct device *dev,struct device_attribute *attr,char *buf); ssize_t part_stat_show(struct device *dev, struct device_attribute *attr,
block/elevator.c +3 -1
@@ -188,7 +188,7 @@ static void elevator_release(struct kobject *kobj)kfree (e); } -void __elevator_exit (struct request_queue *q,struct elevator_queue *e) +void elevator_exit (struct request_queue *q,struct elevator_queue *e) {mutex_lock (&e->sysfs_lock);blk_mq_exit_sched (q, e);
@@ -595,6 +595,7 @@ int elevator_switch_mq(struct request_queue *q,elv_unregister_queue (q);ioc_clear_queue (q); +blk_mq_sched_free_rqs (q);elevator_exit (q, q->elevator); }
@@ -605,6 +606,7 @@ int elevator_switch_mq(struct request_queue *q,if (new_e) { ret =elv_register_queue (q, true);if (ret) { +blk_mq_sched_free_rqs (q);elevator_exit (q, q->elevator); goto out; }
Signature · 1 line
2.30.2
PATCH 3/8 block: remove the e argument to elevator_exit
In reply to Christoph HellwigAll callers pass q->elevator.
--- block/blk-sysfs.c | 2 +- block/blk.h | 2 +- block/elevator.c | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-)
block/blk-sysfs.c +1 -1
@@ -747,7 +747,7 @@ static void blk_exit_queue(struct request_queue *q)*/ if (q->elevator) {ioc_clear_queue (q); -elevator_exit (q, q->elevator); +elevator_exit (q); }/*
block/blk.h +1 -1
@@ -266,7 +266,7 @@ void blk_insert_flush(struct request *rq);int elevator_switch_mq (struct request_queue *q,struct elevator_type *new_e); -void elevator_exit (struct request_queue *,struct elevator_queue *); +void elevator_exit (struct request_queue *q);int elv_register_queue (struct request_queue *q,bool uevent);void elv_unregister_queue (struct request_queue *q);
block/elevator.c +5 -3
@@ -188,8 +188,10 @@ static void elevator_release(struct kobject *kobj)kfree (e); } -void elevator_exit (struct request_queue *q,struct elevator_queue *e) +void elevator_exit (struct request_queue *q) { +struct elevator_queue *e = q->elevator; +mutex_lock (&e->sysfs_lock);blk_mq_exit_sched (q, e);mutex_unlock (&e->sysfs_lock);
@@ -596,7 +598,7 @@ int elevator_switch_mq(struct request_queue *q,ioc_clear_queue (q);blk_mq_sched_free_rqs (q); -elevator_exit (q, q->elevator); +elevator_exit (q); } ret =blk_mq_init_sched (q, new_e);
@@ -607,7 +609,7 @@ int elevator_switch_mq(struct request_queue *q, ret =elv_register_queue (q, true);if (ret) {blk_mq_sched_free_rqs (q); -elevator_exit (q, q->elevator); +elevator_exit (q); goto out; } }
Signature · 1 line
2.30.2
PATCH 4/8 block: don't include blk-mq-sched.h in blk.h
In reply to Christoph HellwigNo needed, shift it into the source files that need it instead.
--- block/blk-core.c | 1 + block/blk-ioc.c | 1 + block/blk-merge.c | 1 + block/blk-mq-debugfs.c | 1 + block/blk-sysfs.c | 1 + block/blk.h | 1 - block/genhd.c | 1 + 7 files changed, 6 insertions(+), 1 deletion(-)
block/blk-core.c +1 -0
@@ -46,6 +46,7 @@#include <trace/events/block.h> #include "blk.h" +#include "blk-mq-sched.h" #include "blk-pm.h" #include "blk-throttle.h"
block/blk-ioc.c +1 -0
@@ -11,6 +11,7 @@#include <linux/sched/task.h> #include "blk.h" +#include "blk-mq-sched.h" /* * For io context allocations
block/blk-merge.c +1 -0
@@ -12,6 +12,7 @@#include <trace/events/block.h> #include "blk.h" +#include "blk-mq-sched.h" #include "blk-rq-qos.h" #include "blk-throttle.h"
block/blk-mq-debugfs.c +1 -0
@@ -11,6 +11,7 @@#include "blk.h" #include "blk-mq.h" #include "blk-mq-debugfs.h" +#include "blk-mq-sched.h" #include "blk-mq-tag.h" #include "blk-rq-qos.h"
block/blk-sysfs.c +1 -0
@@ -16,6 +16,7 @@#include "blk.h" #include "blk-mq.h" #include "blk-mq-debugfs.h" +#include "blk-mq-sched.h" #include "blk-wbt.h" #include "blk-throttle.h"
block/blk.h +0 -1
@@ -10,7 +10,6 @@#include <xen/xen.h> #include "blk-crypto-internal.h" #include "blk-mq.h" -#include "blk-mq-sched.h" struct elevator_type ;
block/genhd.c +1 -0
@@ -27,6 +27,7 @@#include <linux/badblocks.h> #include "blk.h" +#include "blk-mq-sched.h" #include "blk-rq-qos.h" static struct kobject *block_depr;
Signature · 1 line
2.30.2
PATCH 5/8 block: don't include blk-mq.h in blk.h
In reply to Christoph HellwigNo needed, shift a blk-stat.h include into the source file that needs it instead.
--- block/blk-throttle.c | 1 + block/blk.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
block/blk-throttle.c +1 -0
@@ -13,6 +13,7 @@#include <linux/blk-cgroup.h> #include "blk.h" #include "blk-cgroup-rwstat.h" +#include "blk-stat.h" #include "blk-throttle.h" /* Max dispatch from a group in 1 round */
block/blk.h +0 -1
@@ -9,7 +9,6 @@#include <linux/memblock.h> /* for max_pfn/max_low_pfn */ #include <xen/xen.h> #include "blk-crypto-internal.h" -#include "blk-mq.h" struct elevator_type ;
Signature · 1 line
2.30.2
PATCH 6/8 block: don't include <linux/blk-mq.h> in blk.h
In reply to Christoph HellwigNot needed.
--- block/blk.h | 1 - 1 file changed, 1 deletion(-)
block/blk.h +0 -1
@@ -3,7 +3,6 @@#define BLK_INTERNAL_H #include <linux/idr.h> -#include <linux/blk-mq.h> #include <linux/part_stat.h> #include <linux/blk-crypto.h> #include <linux/memblock.h> /* for max_pfn/max_low_pfn */
Signature · 1 line
2.30.2
PATCH 7/8 block: don't include <linux/idr.h> in blk.h
In reply to Christoph HellwigNot needed.
--- block/blk.h | 1 - 1 file changed, 1 deletion(-)
block/blk.h +0 -1
@@ -2,7 +2,6 @@#ifndef BLK_INTERNAL_H #define BLK_INTERNAL_H -#include <linux/idr.h> #include <linux/part_stat.h> #include <linux/blk-crypto.h> #include <linux/memblock.h> /* for max_pfn/max_low_pfn */
Signature · 1 line
2.30.2
PATCH 8/8 block: don't include <linux/part_stat.h> in blk.h
In reply to Christoph HellwigNot needed, shift it into the source files that need it instead.
--- block/blk-cgroup.c | 1 + block/blk-core.c | 1 + block/blk-flush.c | 1 + block/blk-merge.c | 1 + block/blk-mq.c | 1 + block/blk.h | 1 - block/genhd.c | 1 + 7 files changed, 6 insertions(+), 1 deletion(-)
block/blk-cgroup.c +1 -0
@@ -30,6 +30,7 @@#include <linux/blk-cgroup.h> #include <linux/tracehook.h> #include <linux/psi.h> +#include <linux/part_stat.h> #include "blk.h" #include "blk-ioprio.h" #include "blk-throttle.h"
block/blk-core.c +1 -0
@@ -39,6 +39,7 @@#include <linux/debugfs.h> #include <linux/bpf.h> #include <linux/psi.h> +#include <linux/part_stat.h> #include <linux/sched/sysctl.h> #include <linux/blk-crypto.h>
block/blk-flush.c +1 -0
@@ -69,6 +69,7 @@#include <linux/blkdev.h> #include <linux/gfp.h> #include <linux/blk-mq.h> +#include <linux/part_stat.h> #include "blk.h" #include "blk-mq.h"
block/blk-merge.c +1 -0
@@ -8,6 +8,7 @@#include <linux/blkdev.h> #include <linux/blk-integrity.h> #include <linux/scatterlist.h> +#include <linux/part_stat.h> #include <trace/events/block.h>
block/blk-mq.c +1 -0
@@ -29,6 +29,7 @@#include <linux/prefetch.h> #include <linux/blk-crypto.h> #include <linux/sched/sysctl.h> +#include <linux/part_stat.h> #include <trace/events/block.h>
block/blk.h +0 -1
@@ -2,7 +2,6 @@#ifndef BLK_INTERNAL_H #define BLK_INTERNAL_H -#include <linux/part_stat.h> #include <linux/blk-crypto.h> #include <linux/memblock.h> /* for max_pfn/max_low_pfn */ #include <xen/xen.h>
block/genhd.c +1 -0
@@ -25,6 +25,7 @@#include <linux/log2.h> #include <linux/pm_runtime.h> #include <linux/badblocks.h> +#include <linux/part_stat.h> #include "blk.h" #include "blk-mq-sched.h"
Signature · 1 line
2.30.2
Quoted 18 lines · Christoph Hellwig
this series cleans up
blk.hby moving various bits that are not needed out of it.Diffstat:
blk-cgroup.c | 1 + blk-core.c | 2 ++ blk-flush.c | 7 +++++++ blk-ioc.c | 1 + blk-merge.c | 2 ++ blk-mq-debugfs.c | 1 + blk-mq.c | 1 + blk-sysfs.c | 3 ++- blk-throttle.c | 1 + blk.h | 22 +--------------------- elevator.c | 10 +++++++--- genhd.c | 2 ++ 12 files changed, 28 insertions(+), 25 deletions(-)
Quoted 1 line
[...]
Applied, thanks!
[1/8] block: move blk_get_flush_queue to blk-flush.c
commit: b717f549c852e72ddf7c1140702da9e27ffaca7c
[2/8] block: remove elevator_exit
commit: b4ef8cf4ee9cdf8d3f77f265028ddfcda7da47c0
[3/8] block: remove the e argument to elevator_exit
commit: 9bd06db7f49c0c60b0368a21c8d25cd3f356c1b6
[4/8] block: don't include blk-mq-sched.h in blk.h
commit: 10e69ae57a1d4a026de15a9c9058c79ecd47e287
[5/8] block: don't include blk-mq.h in blk.h
commit: c6d21307452ddda76dd132d0a6aa99e8ebf0a9bb
[6/8] block: don't include <linux/blk-mq.h> in blk.h
commit: 8ac269b7ebd5329c287fcd644f89508abf605d1f
[7/8] block: don't include <linux/idr.h> in blk.h
commit: 65db5bdc941eab6e3d2adee483d1cb0ec70a39ad
[8/8] block: don't include <linux/part_stat.h> in blk.h
commit: b1d1d48b8b3a90b4eb28fe3222ca57c6266e211cBest regards,
Signature · 1 line
Jens Axboe