Skip to content
Snippets Groups Projects
Commit 43dd2be3 authored by Glauber Costa's avatar Glauber Costa Committed by Pekka Enberg
Browse files

blkfront: convert bio lists to C++ lists


They are going to work exactly the same. But with std::list instead

Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent 5403c4a1
No related branches found
No related tags found
No related merge requests found
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#ifndef __XEN_DRIVERS_BLOCK_H__ #ifndef __XEN_DRIVERS_BLOCK_H__
#define __XEN_DRIVERS_BLOCK_H__ #define __XEN_DRIVERS_BLOCK_H__
#include <xen/blkif.h> #include <xen/blkif.h>
#include <list>
/** /**
* Given a number of blkif segments, compute the maximum I/O size supported. * Given a number of blkif segments, compute the maximum I/O size supported.
...@@ -157,7 +158,6 @@ union xb_statrequest { ...@@ -157,7 +158,6 @@ union xb_statrequest {
struct xb_softc { struct xb_softc {
device_t xb_dev; device_t xb_dev;
struct disk *xb_disk; /* disk params */ struct disk *xb_disk; /* disk params */
struct bio_queue_head xb_bioq; /* sort queue */
int xb_unit; int xb_unit;
int xb_flags; int xb_flags;
#define XB_OPEN (1<<0) /* drive is open (can't shut down) */ #define XB_OPEN (1<<0) /* drive is open (can't shut down) */
...@@ -196,6 +196,7 @@ struct xb_softc { ...@@ -196,6 +196,7 @@ struct xb_softc {
class bf_softc { class bf_softc {
public: public:
struct xb_softc sc; struct xb_softc sc;
std::list<struct bio *> _bio_queue;
}; };
int xlvbd_add(struct xb_softc *, blkif_sector_t sectors, int device, int xlvbd_add(struct xb_softc *, blkif_sector_t sectors, int device,
...@@ -293,22 +294,20 @@ XBQ_COMMAND_QUEUE(complete, XBQ_COMPLETE); ...@@ -293,22 +294,20 @@ XBQ_COMMAND_QUEUE(complete, XBQ_COMPLETE);
static __inline void static __inline void
xb_initq_bio(struct xb_softc *sc) xb_initq_bio(struct xb_softc *sc)
{ {
bioq_init(&sc->xb_bioq);
XBQ_INIT(sc, XBQ_BIO);
} }
static __inline void static __inline void
xb_enqueue_bio(struct xb_softc *sc, struct bio *bp) xb_enqueue_bio(struct xb_softc *sc, struct bio *bp)
{ {
bioq_insert_tail(&sc->xb_bioq, bp); bf_softc *bf = reinterpret_cast<bf_softc *>(sc);
XBQ_ADD(sc, XBQ_BIO); bf->_bio_queue.push_back(bp);
} }
static __inline void static __inline void
xb_requeue_bio(struct xb_softc *sc, struct bio *bp) xb_requeue_bio(struct xb_softc *sc, struct bio *bp)
{ {
bioq_insert_head(&sc->xb_bioq, bp); bf_softc *bf = reinterpret_cast<bf_softc *>(sc);
XBQ_ADD(sc, XBQ_BIO); bf->_bio_queue.push_front(bp);
} }
static __inline struct bio * static __inline struct bio *
...@@ -316,11 +315,14 @@ xb_dequeue_bio(struct xb_softc *sc) ...@@ -316,11 +315,14 @@ xb_dequeue_bio(struct xb_softc *sc)
{ {
struct bio *bp; struct bio *bp;
if ((bp = bioq_first(&sc->xb_bioq)) != NULL) { bf_softc *bf = reinterpret_cast<bf_softc *>(sc);
bioq_remove(&sc->xb_bioq, bp); if (bf->_bio_queue.empty()) {
XBQ_REMOVE(sc, XBQ_BIO); return nullptr;
} }
return (bp);
bp = bf->_bio_queue.front();
bf->_bio_queue.pop_front();
return (bp);
} }
#endif /* __XEN_DRIVERS_BLOCK_H__ */ #endif /* __XEN_DRIVERS_BLOCK_H__ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment