Re: sleeping in request function

From: mohanlal jangir
Date: Wed Mar 24 2004 - 22:52:11 EST

> On Wed, Mar 24 2004, mohanlal jangir wrote:
> > I have a USB card reader. It is capable of read/write CF, Smartmedia
etc. It
> > works fine on Linux. While looking into driver, I found that the driver
> > works between USB host controller and SCSI layer.
> > Just for learning purpose, I want to write it as block driver. The
> > which performs read/write from the device are blocking. Therefore I
> > call these functions directly from request function. Can somebody tell
> > how can I call blocking functions from request function. I tried to set
> > but it didn't work.
> First of all, don't start a new thread by replying to some other mail.
> Your mail header includes references to that thread, thus screwing
> proper threading.
I am sorry for this. I will take care in future.

> You could push your request handling off to some thread to do the work
> for you, see how drivers/block/loop.c does this.
> --
> Jens Axboe
I will look into this code. At this point of time, I have another question.
Say an application calls read on the device and the data to be read is not
present in buffer cache. This should cause "request function" to be called
(read is waiting for completion). If request function hands over this to
some thread (which will perform actual read later) and returns, then what
happens to the read called in application (which was blocking). Because by
the time read in application returns, it should have read data. I am very
confused about this. Could someone shed some light on this?


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at