Fwd: Document about page and buffer cache.

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

 



Ooops pressed the wrong reply button, forwarding it to list.....


---------- Forwarded message ----------
From: Manish Katiyar <mkatiyar@xxxxxxxxx>
Date: Wed, Mar 12, 2008 at 7:51 PM
Subject: Re: Document about page and buffer cache.
To: Sushil Patil <sushilpa@xxxxxxxxx>


On Wed, Mar 12, 2008 at 11:28 AM, Sushil Patil <sushilpa@xxxxxxxxx> wrote:
 > Yeh I think we do have such unified approach now.The following document
 > provides some initial pointers on where page & buffer caches were used
 > and how they can be _unified_ to avoid double copying.
 >
 > http://www.usenix.org/publications/library/proceedings/usenix2000/freenix/full_papers/silvers/silvers_html/
 >

 hi,

 Thanks a lot for the links. Just sharing what I understand, so that it
 will help for others and will be corrected by Gurus If i am wrong.

 buffer cache and page cache were merged due to overheads in management
 during 2.4. Currently buffer heads are used to map the block data and
 can be of size 512, 1024, 2048 or 4KB. So if you have a buffer
 blocksize less than 4K multiple buffers will be mapped to a single
 page. They are defined by the structure buffer_head and have a pointer
 to the page on which they are mapped. The field b_data points to the
 offset in the page from where the particular buffer data starts. When
 a buffer head is submitted for I/O a new bio structure is allocated
 (See function submit_bh() ) via a call to bio_alloc() which is then
 later submitted for Block I/O layer for read/writes.

 Since your bio operates on sectors, In function submit_bh() the block
 number in buffer_head is mapped to sector in bio using the assignment

  bio->bi_sector = bh->b_blocknr * (bh->b_size >> 9);

 Here b_blocknr is the physical block number in the block device, So if
 you have a b_size=1024 and you want to read/write to 5th block in your
 block device, your bio will map to 10th sector in your device since
 sectors are normally of 512 and thus you ask your block device driver
 to read the 10th sector.

 However I could not find the definitions of following


 test_set_buffer_req(bh)
 buffer_ordered(bh)
 buffer_mapped(bh)
 ... and some others....


 Thanks


 > Regards,
 > Sushil
 >
 >
 >
 > On Wed, Mar 12, 2008 at 8:18 AM, Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx>
 > wrote:
 > >
 > >
 > >
 > > HI
 > >
 > >
 > > On Wed, Mar 12, 2008 at 8:46 AM, Peter Teoh <htmldeveloper@xxxxxxxxx>
 > wrote:
 > > > What is the difference between Page cache and Buffer cache?
 > >
 > > To the best I know, both actually reside in page cache. in <=2.2.x,
 > > they are separated and this leads to synchronization headache.
 > >
 > >
 > > Buffer cache handles things like icache, dcache etc while page cache
 > > handle page based reading like read()/write() of block devices.
 > >
 > > regards,
 > >
 > > Mulyadi.
 > >
 > >
 > >
 > >
 > >
 > > --
 > > To unsubscribe from this list: send an email with
 > > "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
 > > Please read the FAQ at http://kernelnewbies.org/FAQ
 > >
 > >
 >
 >





--
 Thanks & Regards,
 ********************************************
 Manish Katiyar ( http://mkatiyar.googlepages.com )
 3rd Floor, Fair Winds Block
 EGL Software Park
 Off Intermediate Ring Road
 Bangalore 560071, India
 ***********************************************



-- 
Thanks & Regards,
********************************************
Manish Katiyar ( http://mkatiyar.googlepages.com )
3rd Floor, Fair Winds Block
EGL Software Park
Off Intermediate Ring Road
Bangalore 560071, India
***********************************************

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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