On 9/6/06, Bahadir Balban <bahadir.balban@xxxxxxxxx> wrote:
In linux device drivers 3, block drivers chapter, for block device io tranfers, a function is defined: int sbull_transfer_bio(struct sbull_dev *dev, struct bio *bio) { ... bio_for_each_segment(bvec, bio, i) { ... __bio_kmap_atomic(...); sbull_transfer(...); __bio_kunmap_atomic(...); ... } } Here, the transfer is not done in process context, and sbull_transfer() cannot sleep. How could I implement a sleeping transfer?
The request function of block devices are called in process context and they can sleep (but end_io is called in interrupt context). Although in above example sbull_transfer is done in atomic context and only doing memory transfer not the real IO operation. So you can do sleep before or after transfering the data or simple use kmap and then can go into sleep during transfer.
char drivers can sleep and receive data fetched in an irq context, can I not do this for block drivers?
Sorry I won't able to understand your question, but I can say that you can sleep in process context whether its char or block driver but if you got/receive data in irq context either in block or char driver you can sleep in that context rather can insert the data in a queue and just return from irq context; later use queued data in process context. I hope this helps. -- Fawad Lateef -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/