Messages in this thread | | | Date | Thu, 25 Mar 2004 09:15:42 +0530 | From | mohanlal jangir <> | Subject | Re: sleeping in request function |
| |
> 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 functions > > which performs read/write from the device are blocking. Therefore I can't > > call these functions directly from request function. Can somebody tell me > > how can I call blocking functions from request function. I tried to set BH > > 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?
Regards Mohanlal
- 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/
| |