@@ -81,7 +81,7 @@ struct ps3vram_priv {
struct ps3vram_cache cache;
spinlock_t lock; /* protecting list of bios */
- struct bio *tail;
+ struct bio_list list;
};
@@ -579,11 +579,8 @@ static struct bio *ps3vram_do_bio(struct ps3_system_bus_device *dev,
out:
spin_lock_irq(&priv->lock);
- next = bio->bi_next;
- if (!next)
- priv->tail = NULL;
- else
- bio->bi_next = NULL;
+ bio_list_pop(&priv->list);
+ next = bio_list_peek(&priv->list);
spin_unlock_irq(&priv->lock);
bio_endio(bio, error);
@@ -594,20 +591,18 @@ static int ps3vram_make_request(struct request_queue *q, struct bio *bio)
{
struct ps3_system_bus_device *dev = q->queuedata;
struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
+ int busy;
dev_dbg(&dev->core, "%s\n", __func__);
spin_lock_irq(&priv->lock);
- if (priv->tail) {
- priv->tail->bi_next = bio;
- priv->tail = bio;
- spin_unlock_irq(&priv->lock);
- return 0;
- }
-
- priv->tail = bio;
+ busy = !bio_list_empty(&priv->list);
+ bio_list_add(&priv->list, bio);
spin_unlock_irq(&priv->lock);
+ if (busy)
+ return 0;
+
do {
bio = ps3vram_do_bio(dev, bio);
} while (bio);
@@ -632,6 +627,7 @@ static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev)
}
spin_lock_init(&priv->lock);
+ bio_list_init(&priv->list);
dev_set_drvdata(&dev->core, priv);
/* Allocate XDR buffer (1MiB aligned) */
@@ -590,6 +590,11 @@ static inline void bio_list_merge_head(struct bio_list *bl,
bl->head = bl2->head;
}
+static inline struct bio *bio_list_peek(struct bio_list *bl)
+{
+ return bl->head;
+}
+
static inline struct bio *bio_list_pop(struct bio_list *bl)
{
struct bio *bio = bl->head;