* [PATCH V2] blk-mq: code clean-up by adding an API to clear set->mq_map
@ 2018-07-02 13:45 Minwoo Im
2018-07-02 13:56 ` Johannes Thumshirn
2018-07-02 14:31 ` Jens Axboe
0 siblings, 2 replies; 4+ messages in thread
From: Minwoo Im @ 2018-07-02 13:45 UTC (permalink / raw)
To: linux-block; +Cc: Jens Axboe, Johannes Thumshirn, Minwoo Im
set->mq_map is now currently cleared if something goes wrong when
establishing a queue map in blk-mq-pci.c. It's also cleared before
updating a queue map in blk_mq_update_queue_map().
This patch provides an API to clear set->mq_map to make it clear.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
---
block/blk-mq-pci.c | 3 +--
block/blk-mq.c | 4 +---
include/linux/blk-mq.h | 8 ++++++++
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/block/blk-mq-pci.c b/block/blk-mq-pci.c
index e233996..ccb9d7e 100644
--- a/block/blk-mq-pci.c
+++ b/block/blk-mq-pci.c
@@ -48,8 +48,7 @@ int blk_mq_pci_map_queues(struct blk_mq_tag_set *set, struct pci_dev *pdev,
fallback:
WARN_ON_ONCE(set->nr_hw_queues > 1);
- for_each_possible_cpu(cpu)
- set->mq_map[cpu] = 0;
+ blk_mq_clear_mq_map(set);
return 0;
}
EXPORT_SYMBOL_GPL(blk_mq_pci_map_queues);
diff --git a/block/blk-mq.c b/block/blk-mq.c
index b429d51..c6bab3f 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2675,7 +2675,6 @@ static int blk_mq_alloc_rq_maps(struct blk_mq_tag_set *set)
static int blk_mq_update_queue_map(struct blk_mq_tag_set *set)
{
if (set->ops->map_queues) {
- int cpu;
/*
* transport .map_queues is usually done in the following
* way:
@@ -2690,8 +2689,7 @@ static int blk_mq_update_queue_map(struct blk_mq_tag_set *set)
* killing stale mapping since one CPU may not be mapped
* to any hw queue.
*/
- for_each_possible_cpu(cpu)
- set->mq_map[cpu] = 0;
+ blk_mq_clear_mq_map(set);
return set->ops->map_queues(set);
} else
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index e3147eb..a8ac78f 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -237,6 +237,14 @@ enum {
u32 blk_mq_unique_tag(struct request *rq);
+static inline void blk_mq_clear_mq_map(struct blk_mq_tag_set *set)
+{
+ int cpu;
+
+ for_each_possible_cpu(cpu)
+ set->mq_map[cpu] = 0;
+}
+
static inline u16 blk_mq_unique_tag_to_hwq(u32 unique_tag)
{
return unique_tag >> BLK_MQ_UNIQUE_TAG_BITS;
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH V2] blk-mq: code clean-up by adding an API to clear set->mq_map
2018-07-02 13:45 [PATCH V2] blk-mq: code clean-up by adding an API to clear set->mq_map Minwoo Im
@ 2018-07-02 13:56 ` Johannes Thumshirn
2018-07-02 14:31 ` Jens Axboe
1 sibling, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2018-07-02 13:56 UTC (permalink / raw)
To: Minwoo Im; +Cc: linux-block, Jens Axboe
Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
--
Johannes Thumshirn Storage
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg
GF: Felix Imend�rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N�rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V2] blk-mq: code clean-up by adding an API to clear set->mq_map
2018-07-02 13:45 [PATCH V2] blk-mq: code clean-up by adding an API to clear set->mq_map Minwoo Im
2018-07-02 13:56 ` Johannes Thumshirn
@ 2018-07-02 14:31 ` Jens Axboe
2018-07-02 14:44 ` Minwoo Im
1 sibling, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2018-07-02 14:31 UTC (permalink / raw)
To: Minwoo Im, linux-block; +Cc: Johannes Thumshirn
On 7/2/18 7:45 AM, Minwoo Im wrote:
> set->mq_map is now currently cleared if something goes wrong when
> establishing a queue map in blk-mq-pci.c. It's also cleared before
> updating a queue map in blk_mq_update_queue_map().
>
> This patch provides an API to clear set->mq_map to make it clear.
I'm fine with this change, but the declaration should go into
block/blk-mq.h, it's not a driver API.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V2] blk-mq: code clean-up by adding an API to clear set->mq_map
2018-07-02 14:31 ` Jens Axboe
@ 2018-07-02 14:44 ` Minwoo Im
0 siblings, 0 replies; 4+ messages in thread
From: Minwoo Im @ 2018-07-02 14:44 UTC (permalink / raw)
To: Jens Axboe, linux-block; +Cc: Johannes Thumshirn
On Mon, 2018-07-02 at 08:31 -0600, Jens Axboe wrote:
> On 7/2/18 7:45 AM, Minwoo Im wrote:
> >
> > set->mq_map is now currently cleared if something goes wrong when
> > establishing a queue map in blk-mq-pci.c. It's also cleared before
> > updating a queue map in blk_mq_update_queue_map().
> >
> > This patch provides an API to clear set->mq_map to make it clear.
> I'm fine with this change, but the declaration should go into
> block/blk-mq.h, it's not a driver API.
Hi Jens,
Thanks for your kindly directives.
I got your point. I'll make it up for V3 patch with place it into
block/blk-mq.h instead include/linux/blk-mq.h.
Thanks, really.
Minwoo Im
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-07-02 14:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-02 13:45 [PATCH V2] blk-mq: code clean-up by adding an API to clear set->mq_map Minwoo Im
2018-07-02 13:56 ` Johannes Thumshirn
2018-07-02 14:31 ` Jens Axboe
2018-07-02 14:44 ` Minwoo Im
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).