From: Bob Liu <bob.liu@oracle.com>
To: linux-kernel@vger.kernel.org
Cc: xen-devel@lists.xenproject.org, Bob Liu <bob.liu@oracle.com>,
roger.pau@citrix.com
Subject: [PATCH 2/2] xen-blkfront: fix resume issues
Date: Tue, 31 May 2016 16:59:17 +0800 [thread overview]
Message-ID: <1464685157-30738-2-git-send-email-bob.liu__42116.5902902887$1464685290$gmane$org@oracle.com> (raw)
In-Reply-To: <1464685157-30738-1-git-send-email-bob.liu@oracle.com>
After migrate to another host, the number of rings(block hardware queues)
may be changed and the ring info structure will also be reallocated.
This patch fix two related place:
* call blk_mq_update_nr_hw_queues() to make blk-core knows the number
of hardware queues have been changed.
* Don't store rinfo pointer to hctx->driver_data, because rinfo may be
* reallocated so using hctx->queue_num to get the rinfo structure instead.
Signed-off-by: Bob Liu <bob.liu@oracle.com>
---
drivers/block/xen-blkfront.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 01aa460..83e36c5 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -874,8 +874,12 @@ static int blkif_queue_rq(struct blk_mq_hw_ctx *hctx,
const struct blk_mq_queue_data *qd)
{
unsigned long flags;
- struct blkfront_ring_info *rinfo = (struct blkfront_ring_info *)hctx->driver_data;
+ int qid = hctx->queue_num;
+ struct blkfront_info *info = hctx->queue->queuedata;
+ struct blkfront_ring_info *rinfo = NULL;
+ BUG_ON(info->nr_rings <= qid);
+ rinfo = &info->rinfo[qid];
blk_mq_start_request(qd->rq);
spin_lock_irqsave(&rinfo->ring_lock, flags);
if (RING_FULL(&rinfo->ring))
@@ -901,20 +905,9 @@ out_busy:
return BLK_MQ_RQ_QUEUE_BUSY;
}
-static int blk_mq_init_hctx(struct blk_mq_hw_ctx *hctx, void *data,
- unsigned int index)
-{
- struct blkfront_info *info = (struct blkfront_info *)data;
-
- BUG_ON(info->nr_rings <= index);
- hctx->driver_data = &info->rinfo[index];
- return 0;
-}
-
static struct blk_mq_ops blkfront_mq_ops = {
.queue_rq = blkif_queue_rq,
.map_queue = blk_mq_map_queue,
- .init_hctx = blk_mq_init_hctx,
};
static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size,
@@ -950,6 +943,7 @@ static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size,
return PTR_ERR(rq);
}
+ rq->queuedata = info;
queue_flag_set_unlocked(QUEUE_FLAG_VIRT, rq);
if (info->feature_discard) {
@@ -2149,6 +2143,8 @@ static int blkfront_resume(struct xenbus_device *dev)
return err;
err = talk_to_blkback(dev, info);
+ if (!err)
+ blk_mq_update_nr_hw_queues(&info->tag_set, info->nr_rings);
/*
* We have to wait for the backend to switch to
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next parent reply other threads:[~2016-05-31 8:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1464685157-30738-1-git-send-email-bob.liu@oracle.com>
2016-05-31 8:59 ` Bob Liu [this message]
2016-05-31 20:33 ` [PATCH 1/2] xen-blkfront: don't call talk_to_blkback when already connected to blkback Konrad Rzeszutek Wilk
[not found] ` <20160531203307.GC23808@char.us.oracle.com>
2016-06-01 5:49 ` Bob Liu
[not found] ` <574E7763.9060001@oracle.com>
2016-06-02 14:30 ` Konrad Rzeszutek Wilk
2016-06-07 15:25 ` Konrad Rzeszutek Wilk
[not found] ` <20160607152524.GA10281@localhost.localdomain>
2016-06-08 6:46 ` Bob Liu
[not found] ` <5757BF4E.9080307@oracle.com>
2016-06-08 14:47 ` Konrad Rzeszutek Wilk
[not found] ` <20160608144739.GD17027@char.us.oracle.com>
2016-06-15 8:39 ` Ross Lagerwall
[not found] ` <57611424.2020802@citrix.com>
2016-06-15 14:08 ` Konrad Rzeszutek Wilk
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='1464685157-30738-2-git-send-email-bob.liu__42116.5902902887$1464685290$gmane$org@oracle.com' \
--to=bob.liu@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=roger.pau@citrix.com \
--cc=xen-devel@lists.xenproject.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 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).