Chapter 11: Extended Attributes and Access Control Lists
The course of action is basically identical with the previously considered case where the data were located
in the inode, but two modifications need to be made:❑ The kernel needs to read the extended attribute block; the address is stored in thei_file_acl
element ofstruct ext3_inode_info.
❑ Metadata blocks are cached by callingext3_xattr_cache_insert. The kernel uses the so-called
filesystem metadata block cache implemented infs/mbcache.cfor this.^2 Since nothing really
unexpected happens there, it is not necessary to discuss the code in more detail.Setting Extended Attributes
Setting extended attributes for theusernamespace is handled by — you guessed it —ext3_xattr_user_
set. As for the get operation, the function is just a wrapper for the generic helperext3_xattr_set.The
code flow diagram in Figure 11-8 shows that this is yet another wrapper function that is responsible for
handling the interaction with the journal. The real work is delegated toext3_xattr_set_handle;the
associated code flow diagram can be seen in Figure 11-9.Get handleStop Journalext3_xattr_setext3_xattr_set_handleFigure 11-8: Code flow diagram for
ext3_xattr_set.Get inode locationAttibute not directly in inode?Set attribute in the appropriate locationUpdate superblock and mark inode dirtyYesNovalue == NULL?ext3_xattr_set_handleext3_xattr_ibody_findext3_xattr_block_findext3_xattr_{ibody,block}_setFigure 11-9: Code flow diagram forext3_xattr_set.(^2) Although the structure of this cache is generic, it is currently only used by the extended filesystem family.