public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@gnu.org>
To: Hillf Danton <dhillf@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, "Zou,
	Yi" <yi.zou@intel.com>, Joe Eykholt <jeykholt@cisco.com>
Subject: Re: [PATCH] fix the poll method of bsg file operations in Block layer SCSI generic driver
Date: Wed, 10 Nov 2010 11:48:53 -0300	[thread overview]
Message-ID: <1289400533.2208.6.camel@cowboy> (raw)
In-Reply-To: <AANLkTi=butKgG8VktAu0V12aBKTetOJwiGkcTLG_RZWB@mail.gmail.com>

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@gmail.com>
> ---
> 
> --- 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



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

  reply	other threads:[~2010-11-10 14:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-10 13:58 [PATCH] fix the poll method of bsg file operations in Block layer SCSI generic driver Hillf Danton
2010-11-10 14:48 ` Davidlohr Bueso [this message]
2010-11-11 13:42   ` Hillf Danton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1289400533.2208.6.camel@cowboy \
    --to=dave@gnu.org \
    --cc=dhillf@gmail.com \
    --cc=jeykholt@cisco.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=yi.zou@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox