Re: when does a process sleep in reading a file from disk?

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

 



I went through the floppy code you mentioned, yes, it works as you said.
But the problem is, I don't think that the ide disk works the similar way.
In linux 2.4 kernel, the reading process explicitly sleep at
do_generic_file_read()->wait_on_page(), that is why the coder try
everything to postpone calling wait_on_page. However, I think things
change in 2.6. I have a guess that the synchronous read has been improved
by some asynchronous method. That is, the process (which performs a
synchronous read) just submit  a synchronous read request and return, even
though the buffer is not filled with data from disk. It would turn to
sleep only when it performs real operating on the buffer (if the buffer
is still not filled in valid data by then). In this way, the
performance is improved. That is why I did not find any "put to sleeo
code" in the file system and ide driver code. But this is only my guess.
Any suggestion? And thanks Fawad for your kindly reply:)



On Sat, 29 Oct 2005, Fawad Lateef wrote:

> On 10/29/05, Hui Cheng <hcheng@xxxxxxxxxxx> wrote:
> >
> > 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?
> >
> >
>
> After your reply, I did some code study from __make_request
> (ll_rw_blk.c) to actual storage driver and for this I studied the code
> of drivers/block/floppy.c because floppy.c is the simplest real
> storage driver. And I found that the sleeping is done by the real
> hardware driver  (which I was thinking earlier too, but now confirm)
> as when the request_function (do_fd_request) specified by the floppy.c
> is called, after some processing it calls the process_fd_request which
> calls the schedule_bh function (defined in floppy.c) schedules the
> floppy_work with the handler redo_fd_request.
>
> When the redo_fd_request is called from the schedule_work, it  use
> make_raw_rw_request to actually fullfil the request and later
> redo_fd_request calls request_done which through floppy_end_request
> function ends/signals the kernel that request is done.
>
> I hope this will help! You can also work-out on floppy.c in detail ...
>
>
> --
> 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/


[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