Re: [PATCH 4/4] disk-protect: Add a generic block layer queue freezing facility

From: Pavel Machek
Date: Sat Mar 15 2008 - 08:50:20 EST


On Fri 2008-03-07 19:26:41, Elias Oltmanns wrote:
> This patch provides a generic way to freeze the request queue of a block
> device temporarily. This functionality is exposed to user space via sysfs.
>
> Signed-off-by: Elias Oltmanns <eo@xxxxxxxxxxxxxx>

I guess this should have patch going to documentation. Otherwise it
looks ok.


> +/*
> + * When reading the 'protect' attribute, we return seconds remaining
> + * before the unfreeze timeout expires.
> + */
> +static ssize_t queue_protect_show(struct request_queue *q, char *page)
> +{
> + unsigned int seconds = 0;
> +
> + if (blk_queue_stopped(q) && timer_pending(&q->unfreeze_timer))
> + /*
> + * Adding 1 in order to guarantee nonzero value until timer
> + * has actually expired.
> + */
> + seconds = jiffies_to_msecs(q->unfreeze_timer.expires
> + - jiffies) / 1000 + 1;

Is it okay to read expires without locking?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
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/