[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: page->mapping and page->buffers
On Mon, 9 Sep 2002, Haijin Yan wrote:
> Are you guys saying that pages for traditional I/O(read/write) do not
> have page->mapping while clean mmap()ed pages do not have page->buffer?
No. Any pagecache page has page->mapping and page->index, no
matter whether it's used for read/write or for mmap.
These pages will have page->buffers when we're doing _disk_
IO on them, buffer heads are the way the kernel tells the
block IO subsystem what should be done with a page.
> so when is the condition (!page->mapping) true and what it represents for?
It can happen in 3 situations:
1) a new anonymous page is allocated to the process, this
is a private page that is only visible in the process
page tables
2) a page _was_ part of a page cache mapping, but truncate()
removed it from the page cache ... at the same time, a
process was doing a pagefault on this page and added it
to its page tables, now the page is converted into anonymous
memory
3) a page was swapped in and removed from the swap cache in
order to reclaim swap space.
> If page->buffers is true, Does that ony mean either page is brought in
> by traditional IO or a disk block is allocated for this mmap()ed page
> for written(because page is dirty)?
Yes, but note that buffer heads can stay around after disk IO
has finished.
regards,
Rik
--
Spamtrap of the month: september@surriel.com
http://www.surriel.com/ http://distro.conectiva.com/
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/