Re: [PATCH 04/15] ps3vram: Replace mutex by spinlock + list

From: Andrew Morton
Date: Fri May 08 2009 - 19:10:50 EST


On Fri, 8 May 2009 16:01:13 +0200
Geert Uytterhoeven <Geert.Uytterhoeven@xxxxxxxxxxx> wrote:

> +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->core.driver_data;
> +
> + 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;
> + spin_unlock_irq(&priv->lock);
> +
> + do {
> + bio = ps3vram_do_bio(dev, bio);
> + } while (bio);

Is there something which prevents two threads of control from walking
the same list at the same time?

> +
> return 0;
> }

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/