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

Re: [Xen-devel] RE: [Xen-users] cache for partition based VBD?

> The block device cache would be efficient in the sense that it's useful
> for every type of file-system, and it's not going to have to be clever
> about what sort of accesses are frequent, not so frequent etc. This
> gives benefit to the "cache at the device level".
> On the other hand, a file-system level cache would also make sense.
> Caching directory structurs or file-allocation-table [not necessarily in
> the Microsoft sense] would obviously help a whole lot more than caching
> some block from the middle of a file that isn't ever going to be read
> again. This motivates having a targetted caching mechanism in the
> file-system (VFS) layer.

Linux does caching at the level of blocks on a device and of contiguous pages 
within a file by stuffing them both in the page cache.  Disk-based 
filesystems are able to use a cached interface to block storage (when 
appropriate) to access their on disk data structures.  Filesystems use the 
block-level interface to the page cache to read their own metadata but store 
file contents into the page cache in a file-oriented manner.

The VFS manipulates and caches various meta-stuff like inode data generically 
(although it has to get this from the filesystem, which in term retrieves 
that data from the block layer).

The filesystem is also free to build its own data structures that cache useful 
information.  For instance, filesystems may choose to store metadata in 
privately allocated structures or (sometimes) in parts of the page cache.  
There are private pointers in the file and inode structures to facilitate 

> A combination would of course make even more sense - cache important
> data structures in the File-system layer, and cache blocks that have
> frequent/recent accesses in the block-device.


> > I think that the Linux architecture puts the buffer cache in
> > front of all block device access, not at the VFS layer.  So
> > does that answer the question?  The dom0 disk backend driver
> > sits "above" the buffer cache?  (sorry for my crude
> > understanding)
> I would say that this is correct - the Dom0 disk driver would have a
> cache in itself, and the DomU would also have a caching layer. But I'm
> not SURE about this at all.
> If someone can make further comments, it would be great.

I'm pretty sure our blkback driver uses a non-caching interface to storage: it 
requests stuff directly from the block layer, rather than from the 
block-level interface to the page cache.  The only way caching gets to happen 
in dom0 is if you're using loop devices in which case direct block access is 
looped back into the VFS (and therefore the page cache inevitable gets 

Sounds sane?,

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.