Terribly sorry for the long message. I have been digging for attribute
caching details everywhere, but cant seem to find any complete answers.
I am reading up on extended attributes, and see a great potential for
reducing the complexity of managing metadata associated with a file. The
approach I would be replacing uses a scheme where by meta files are
stored in the same directory as the data file with fixed tags appended
to the original file's name.
The idea, as expected, is to place the meta information beneath foo/bar,
with large attributes XXX and YYY.
In my case, I have 2 - 3 meta file containing roughly 3k of packed data.
For simplicity / syscall overhead sakes it will be most conveinient for
me to simply stuff the existing formats within the attributes, treating
them like forks. I also need to account for potentially large volumes of
files (ex: 1 Million or greater) spread across the filesystem.
In this scenario (small attribute count, large attribute size), the
ideal solution would be to have a special short-form attribute type that
directly references a standalone extent(s); again, much like a file
fork. The benefit here, is that the single inode would be able to map
the data of 3 different files, resulting in a 3:1 reduction in I/O
lookup overhead and a 3:1 reduction of inode/dentry cache entries.
While this would be ideal for my particular case, my understanding is
that, in this scenario, XFS will create 'leaf attributes.' This is
understandable given the N/V interface of attributes, however, I get the
impression that the overall performance could be worse than the 3 file
approach, as the leaf block will place an additional I/O between the
inode and meta data.
Though the I/O seems to be higher in this scenario, the simplcity of the
attribute design might still outweigh the performance impact. Once more,
given a mostly-read scenario, the effective I/O overhead could be
greatly reduced depending on how the leaf block / attribute data are
In the typical 'file' scenario, dentries and inodes will be cached in
their respective VFS caches, and file data will be cached in association
with the inode's address space via the page cache. To my knowledge, none
of these caches gel with the concept of extended attributes, and thus,
if caching is happening, it would be up to the filesystem to implement
That said, here are my basic questions...
1) How are leaf blocks cached? What are the cached entries lifetimes,
and when will the cache shrink?
2) How will attribute data be cached, and what is its lifetime? Is there
a XFS-maintained equivalent of a page cache?
3) Does an extended attribute modification update the inode? This would
imply 3 updates for adding an attribute: inode, leaf block, data
block(s)... or more if the temporary state of leaf attribute while
allocating external blocks?
Also, I am happy to trace through the code, if someone can point me to
the respective functions / files.