I am experimenting with XAM (eXtensible Access Method), which is a storage standard developed by SNIA (Storage Networking Industry Association and have developed a first prototype of a VIM (Vendor Interface Module) for the ext4 file system based on adding another namespace to the current extended file attributes support. Since other Linux developers might be interested in how to add an extended attributes namespace to a file system, I decided to publish this post as a guide.
Extended file attributes (EA) are extensions to the normal attributes which are associated with inodes in a file system. They are simply name:value pairs associated with files and directories and whose purpose is to provide additional functionality which is either defined by the operating system or a user application. An EA may be defined or undefined. If an EA is defined, its value may be empty or non-empty. Most of the initial work to support EAs in Linux was done by Andreas Gruenbacher in the 2001 to 2004 timeframe and is based on work done in the SGI XFS file system.
EAs are stored directly in inodes and on additional disk blocks if necessary. Currently all EAs associated with a file must fit in an inode and one additional block. Blocks that contain the identical set of EAs may be shared among several inodes. EAs in inodes and on blocks have a different header followed by multiple entry descriptors. Entry descriptors are sorted in disk blocks but are left unsorted in inodes.
EA names are zero-terminated strings and are always specified using a fully qualified namespace.attribute e.g. system.posix_acl_access or security.selinux. Namespaces are used to define different classes of EAs. Different EA classes are required because the permissions and capabilities required for manipulating EAs in one namespace may differ from one to another. Currently Linux supports EA namespaces for SELinux (security.), system (system.), trusted (trusted.) and user (user.).
Fedora 11 comes with EA support in the Linux kernel and hence it is the kernel which must be modified in order to add another EA namespace. In my case I wanted to add an EA namespace called snia in order to support XAM XSet metadata (see below).
Here is the patch file for the Fedora 11 2.6.29.4-167.fc11 kernel which implements the snia namespace. It should work for both 32-bit and 64-bit kernels but I have only tested it on a 64-bit kernel. diff

























