Re: [PATCH] fix the poll method of bsg file operations in Block layerSCSI generic driver

From: Hillf Danton
Date: Thu Nov 11 2010 - 08:42:56 EST


On Wed, Nov 10, 2010 at 10:48 PM, Davidlohr Bueso <dave@xxxxxxx> wrote:
> On Wed, 2010-11-10 at 21:58 +0800, Hillf Danton wrote:
>> Though it looks like a typo, the check for POLLOUT is computed incorrectly.
>>
>> Signed-off-by: Hillf Danton <dhillf@xxxxxxxxx>
>> ---
>>
>> --- a/block/bsg.c   2010-09-13 07:07:38.000000000 +0800
>> +++ b/block/bsg.c   2010-11-10 21:40:30.000000000 +0800
>> @@ -874,6 +874,8 @@ static unsigned int bsg_poll(struct file
>> Â Â Â if (!list_empty(&bd->done_list))
>> Â Â Â Â Â Â Â mask |= POLLIN | POLLRDNORM;
>> Â Â Â if (bd->queued_cmds >= bd->max_queue)
>> + Â Â Â Â Â Â ;
>> + Â Â else
>> Â Â Â Â Â Â Â mask |= POLLOUT;
>> Â Â Â spin_unlock_irq(&bd->lock);
>
> How about something more like this:
>
> diff --git a/block/bsg.c b/block/bsg.c
> index f20d6a7..2663db3 100644
> --- a/block/bsg.c
> +++ b/block/bsg.c
> @@ -870,7 +870,7 @@ static unsigned int bsg_poll(struct file *file,
> poll_table *wait)
> Â Â Â Âspin_lock_irq(&bd->lock);
> Â Â Â Âif (!list_empty(&bd->done_list))
> Â Â Â Â Â Â Â Âmask |= POLLIN | POLLRDNORM;
> - Â Â Â if (bd->queued_cmds >= bd->max_queue)
> + Â Â Â if (bd->queued_cmds < bd->max_queue)
> Â Â Â Â Â Â Â Âmask |= POLLOUT;
> Â Â Â Âspin_unlock_irq(&bd->lock);
>
>
> Thanks,
> Davidlohr
>
cool, thanks//Hillf

>
>
>> --
>> 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/
>>
>
>
>
--
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/