buffer page concepts in the page cache

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

 



Dear all,

CONTEXT

I am spending the last weeks learning how the kernel executes disk I/O
writes and reads from the userland read() to the hard disk drive.  I
want to see (and understand) the WHOLE PICTURE regarding the VFS,
block I/O layer and page cache.

To do this, I am following as a base guide Bovet and Cesati UTLK 3rd
edition [1] (chapters 12-16 so far) and the new edition of Robert
Love's Linux Kernel Development[2] (chapters 13-16).  A lot of reading
so far that I still need to slowly digest.

For the moment, I have not dived yet into the details of "page frame
reclaiming", "swap memory" and "filesystem implementations" areas.  My
knowledge about memory allocation (slab allocator) is also limited.

[1]  Understanding The Linux Kernel 3rd Edition, O'Reilly
[2]  Linux Kernel Development 3rd Edition Addison Wesley


MY QUESTIONS

1.  What do we understand by "buffer pages"?

2.  Is the whole page cache content (i.e. the radix tree in the
    address_space of the different inodes) organized as buffer pages?

3.  What is the functional difference between "block device buffer
    pages" (stored in the address_space of the master bdev inode) and
    the "file buffer pages" stored in the address_space of a file
    inode? [ UTLK, page 614 ]


Maybe I am missing an important point of course...


MY INTERPRETATION (please correct me if I am wrong)

Q1  What is a "buffer page"?

A "buffer page" is a "struct page" data describing a page allocated to
hold one or more i/o blocks from disk.

As such, the "private" field points to a single circular  list of
"buffer_heads" each describing the mapping between the i/o blocks in
memory (b_data field) and the i/o blocks on disk (b_size,
b_blocknr...).

The buffer_head structures themselves are stored outside of the page
as shown in UTLK Fig 15.2.

---

Q2  Is the whole page cache content organized as buffer pages?

YES, there is no other way to link memory-mapped disk i/o data to the
struct page pointed by address_space radix-tree entries.

---

Q3  block device buffer_pages vs file buffer_pages

This I really don't understand.  From what UTLK page 614 says:

*  File buffer_pages ONLY refer to non-contiguous (on disk layout) file
   contents.

*  blockdev buffer_pages refer to single-block or continuous (on disk
   layout) portions of block.

My question is:  what happens with non-fragmented medium size files
that do not contain "disk holes" or non-adjancent block submissions?



Thanks in advance for your attention,

     Miguel



_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[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