Here is basic extended attributes implementation for tmpfs.
ItThe extattrs follows semantic of ufs, mean it cannot be set to char/block devices and fifos. mean extattrs cannot be set to char/block devices and fifos.The attributes are allocated using regular malloc with M_WAITOK
The attributes are allocated using regular malloc with M_WAITOK allocation with the own malloc tag M_TMPFSEA.allocation with the own malloc tag M_TMPFSEA. The memory consumed by extended attributes is limited to avoid OOM triggering by tmpfs_mount variable tm_ea_memory_max,
The memory consumed bywhich is set initially to 16 MB. The extended attributes is limited to avoid OOM triggeringentries are stored as linked list in the tmpfs node.
by sysctl variable tmpfs_ea_mem_reserved, which is set initiallyThe mount point lock is required only under setextattr and deleteextattr to 16 MB. If set to zeroupdate extended attributes memory-inuse counter, extended
attributes will be disabled and EOPNOTSUP will be returned.
The extended attribute entries are stored as linked list in the tmpfs node.
The mount point lock is required only under setextattr and deleteextattr to update extended attributes memory-in-use counter,
all other operations are doing under vnode lock.