diff options
author | Bob Liu <bob.liu@oracle.com> | 2015-11-14 04:12:15 +0100 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2016-01-04 18:21:05 +0100 |
commit | 597957000ab5b1b38085c20868f3f7b9c305bae5 (patch) | |
tree | 31812106a000a8525483fa14a00531e419acaa4c /drivers/block/xen-blkback/common.h | |
parent | xen/blkfront: correct setting for xen_blkif_max_ring_order (diff) | |
download | linux-597957000ab5b1b38085c20868f3f7b9c305bae5.tar.xz linux-597957000ab5b1b38085c20868f3f7b9c305bae5.zip |
xen/blkback: separate ring information out of struct xen_blkif
Split per ring information to an new structure "xen_blkif_ring", so that one vbd
device can be associated with one or more rings/hardware queues.
Introduce 'pers_gnts_lock' to protect the pool of persistent grants since we
may have multi backend threads.
This patch is a preparation for supporting multi hardware queues/rings.
Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
Signed-off-by: Bob Liu <bob.liu@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
v2: Align the variables in the structure.
Diffstat (limited to 'drivers/block/xen-blkback/common.h')
-rw-r--r-- | drivers/block/xen-blkback/common.h | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index 68e87a037b99..dbdf4164c83f 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h @@ -269,34 +269,50 @@ struct persistent_gnt { struct list_head remove_node; }; +/* Per-ring information. */ +struct xen_blkif_ring { + /* Physical parameters of the comms window. */ + unsigned int irq; + union blkif_back_rings blk_rings; + void *blk_ring; + /* Private fields. */ + spinlock_t blk_ring_lock; + + wait_queue_head_t wq; + atomic_t inflight; + /* One thread per blkif ring. */ + struct task_struct *xenblkd; + unsigned int waiting_reqs; + + /* List of all 'pending_req' available */ + struct list_head pending_free; + /* And its spinlock. */ + spinlock_t pending_free_lock; + wait_queue_head_t pending_free_wq; + + struct work_struct free_work; + /* Thread shutdown wait queue. */ + wait_queue_head_t shutdown_wq; + struct xen_blkif *blkif; +}; + struct xen_blkif { /* Unique identifier for this interface. */ domid_t domid; unsigned int handle; - /* Physical parameters of the comms window. */ - unsigned int irq; /* Comms information. */ enum blkif_protocol blk_protocol; - union blkif_back_rings blk_rings; - void *blk_ring; /* The VBD attached to this interface. */ struct xen_vbd vbd; /* Back pointer to the backend_info. */ struct backend_info *be; - /* Private fields. */ - spinlock_t blk_ring_lock; atomic_t refcnt; - - wait_queue_head_t wq; /* for barrier (drain) requests */ struct completion drain_complete; atomic_t drain; - atomic_t inflight; - /* One thread per one blkif. */ - struct task_struct *xenblkd; - unsigned int waiting_reqs; /* tree to store persistent grants */ + spinlock_t pers_gnts_lock; struct rb_root persistent_gnts; unsigned int persistent_gnt_c; atomic_t persistent_gnt_in_use; @@ -311,12 +327,6 @@ struct xen_blkif { int free_pages_num; struct list_head free_pages; - /* List of all 'pending_req' available */ - struct list_head pending_free; - /* And its spinlock. */ - spinlock_t pending_free_lock; - wait_queue_head_t pending_free_wq; - /* statistics */ unsigned long st_print; unsigned long long st_rd_req; @@ -328,9 +338,9 @@ struct xen_blkif { unsigned long long st_wr_sect; struct work_struct free_work; - /* Thread shutdown wait queue. */ - wait_queue_head_t shutdown_wq; - unsigned int nr_ring_pages; + unsigned int nr_ring_pages; + /* All rings for this device. */ + struct xen_blkif_ring ring; }; struct seg_buf { @@ -352,7 +362,7 @@ struct grant_page { * response queued for it, with the saved 'id' passed back. */ struct pending_req { - struct xen_blkif *blkif; + struct xen_blkif_ring *ring; u64 id; int nr_segs; atomic_t pendcnt; @@ -394,7 +404,7 @@ int xen_blkif_xenbus_init(void); irqreturn_t xen_blkif_be_int(int irq, void *dev_id); int xen_blkif_schedule(void *arg); int xen_blkif_purge_persistent(void *arg); -void xen_blkbk_free_caches(struct xen_blkif *blkif); +void xen_blkbk_free_caches(struct xen_blkif_ring *ring); int xen_blkbk_flush_diskcache(struct xenbus_transaction xbt, struct backend_info *be, int state); |