public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Ben Collins <bcollins@ubuntu.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH rc6] block: Fix CDROMEJECT to work in more cases
Date: Tue, 20 Dec 2005 19:38:58 +0100	[thread overview]
Message-ID: <20051220183857.GQ3734@suse.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0512201005370.4827@g5.osdl.org>

On Tue, Dec 20 2005, Linus Torvalds wrote:
> 
> 
> On Tue, 20 Dec 2005, Jens Axboe wrote:
> > 
> > WRITEs cannot have length 0, and READs cannot as well. Since it's just
> > one bit for direction, those are the rules.
> 
> Jens, your logic doesn't make sense.

It does

> There clearly _are_ commands with a 0 data-length.

Of course, that's not what I'm saying. What I am saying is interpreted
from the driver or further down in the io stack.

> And commands _have_ to be either READ or WRITE. We don't have a choice. 
> ll_rw_block: blk_get_request() even has a BIG_ON() that enforces that.

Yes, it has to choose one of the two pools.

> So claiming that reads and writes cannot have zere data-length is INSANE.

There are two sides to this - looking at the request allocations pools,
yes if you want a request you have to tell from which pool you want it
from. But a request that originates from that particular pool (in this
case the write pool), does _not_ have to imply any transfer of data from
a device!

> So reads and writes HAVE to accept a zero data length. End of story. If 

That's not up for debate, of course that is the case. Otherwise we could
not issue any request unless it needed to transfer data from a device.
Just because an empty request happens to have the data direction bit
set, does not mean it wants to transfer data to the device. By
definition, that is an impossibility since there's nothing to transfer.

> there is some path in the SCSI layer that refuses it, that part must be 
> fixed, or you have to add a new "NONE" (and perhaps "BOTH") direction.

There _was_ a bug in the SCSI layer, because it had logic like this:

        if (rq_data_dir(req) == WRITE)
                DMA_TO_DEVICE
        else if (req->data_len)
                DMA_FROM_DEVICE
        else
                DMA_NONE

which was buggy, because for it to transfer data to the device, both the
direction bit _and_ a data length must be set.

-- 
Jens Axboe


  reply	other threads:[~2005-12-20 18:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-19 19:50 [PATCH rc6] block: Fix CDROMEJECT to work in more cases Ben Collins
2005-12-20 17:34 ` Linus Torvalds
2005-12-20 17:49   ` Jens Axboe
2005-12-20 18:08     ` Linus Torvalds
2005-12-20 18:38       ` Jens Axboe [this message]
2005-12-20 18:53         ` Linus Torvalds
2005-12-20 19:08           ` Jens Axboe
2005-12-20 20:38       ` Ben Collins
2005-12-20 20:53         ` Jens Axboe
2005-12-20 21:46           ` Ben Collins
2005-12-21  7:04             ` Jens Axboe

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=20051220183857.GQ3734@suse.de \
    --to=axboe@suse.de \
    --cc=bcollins@ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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