Re: sleeping in block device driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/7/06, Fawad Lateef <fawadlateef@xxxxxxxxx> wrote:
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).

I hope this helps.

--
Fawad Lateef


So do you mean in:

sbull_make_request()
{
   sbull_transfer_bio();
   bio_endio();
}

sbull_transfer_bio() can sleep? If so I didn't know that.
Are you sure on this? Because in LDD3 page 475 says:

"... The invocation of the request function is entirely asynchronous
with respect to the actions of any user-space process. You cannot
assume that the kernel is running in the context of the process that
initiated the current request."

Perhaps this only applies to "bio_endio()" part of the request then?

Thanks,
Bahadir

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux