Thanks for your reply, Fawad :) I have the similar thought as you. I do believe that the current process would be put to sleep ( like in a wait queue) at sometime when the request is queued. However, I just cannot find the code that explicitly do this. I followed all the code from sys_read until __make_request, at where the request is queued in the request queue. I was wondering I might miss something. Could anybody help me out of it? On Sat, 29 Oct 2005, Fawad Lateef wrote: > 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/ > > -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/