On 10/28/05, Hui Cheng <hcheng@xxxxxxxxxxx> wrote: > > I was looking at the code of linux 2.6 file systems, and cannot find the > code that make the current process sleep when it performs a synchronous > read. My understanding is, a process will turn to sleep if the content it > tries to read is not in the cache. I thought that the process might be put > in the request->waiting queue, but after a long time searching, I cannot > find such code. So my question is, if a process is going to sleep for > reading something from disk, when and where this sleep happens? I am new > to this list, and thanks for any help :) > > I havn't created a file-system, but I think I can give answer to your question which will be correct to some extent and might give you some hint too: Here by saying "process is going to sleep for reading something from disk" you mean the delay for accessing the data from the storage ? If yes then the sleep occurs at the block-layer, as you can see the functions for reading/writing the pages in almost all file-systems are calling mpage_readpages/mpage_writepages which creates bio, do some other memory/buffer related stuffs and in the last call submit_bio which directly sends the request to the storage queue and got signal of request done from the storage through bi_end_io already assigned to bio before calling submit_bio. So the sleeping is actually at the block level where the request is added to the device queue and then waits for its completion ...... -- Fawad Lateef -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/