[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: page->mapping and page->buffers
> >
> > IIRC, it points to the list of buffer heads describing the disk
> > location of the data resident in the page. Buffer heads are the
> > structs used to schedule traditional (read()/write()) disk
> > I/O, whereas page->mapping is used for mmap() I/O. So a
> > "buffer" is just a logical block of data within a page
> > that correponds to a physical disk block somewhere; and
> > the buffer head is a description of that relationship. In the
> > older 2.4 kernels, they were complimentary: when a mmap()ed page
> > had to be written out, the VM created buffers describing the page
> > and then handed those buffers off to the disk I/O subsystem. I'm
> > not sure if things work the same now. (Probably so.)
>
> Each page in page cache belongs to an inode or is anonymous. But
> page_launder() writes the pages out independently of what they belong
> to. So it one cache. Mappings are there so page_launder knows where to
> write the page (it calls down to writepage method in mapping).
>
> With buffers, IIRC it's still the same way. When a page has to be
> written to disk, it's turned into buffers and these are queued for disk
> write.
>
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?
As far as I know, a page(not anonymous) with its mapping points to
mapping of inode of the file in page_cache_read() function like this:
inode = file->f_dentry->d_inode;
struct address_space *mapping = inode->i_mapping;
page = page_cache_alloc(mapping);
page->mapping = mapping;
when page got swapped, it's mapping is set to
page->mapping = &swapper_space;
so when is the condition (!page->mapping) true and what it represents for?
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)?
Thanks, :)
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/