]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
ext4: reserve space for xattr entries/names
authorTahsin Erdogan <tahsin@google.com>
Thu, 22 Jun 2017 15:48:53 +0000 (11:48 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 22 Jun 2017 15:48:53 +0000 (11:48 -0400)
commit9c6e7853c531c7cecca8c257bde767d089e5c880
tree1d214d0d7da251f2063721240b99c2bfaa3a4afb
parent7a9ca53aea10ad4677a0f347ad7639c304b80194
ext4: reserve space for xattr entries/names

New ea_inode feature allows putting large xattr values into external
inodes.  struct ext4_xattr_entry and the attribute name however have to
remain in the inode extra space or external attribute block.  Once that
space is exhausted, no further entries can be added.  Some of that space
could also be used by values that fit in there at the time of addition.

So, a single xattr entry whose value barely fits in the external block
could prevent further entries being added.

To mitigate the problem, this patch introduces a notion of reserved
space in the external attribute block that cannot be used by value data.
This reserve is enforced when ea_inode feature is enabled.  The amount
of reserve is arbitrarily chosen to be min(block_size/8, 1024).  The
table below shows how much space is reserved for each block size and the
guaranteed mininum number of entries that can be placed in the external
attribute block.

block size     reserved bytes  entries (name length = 16)
 1k            128              3
 2k            256              7
 4k            512             15
 8k            1024            31
16k            1024            31
32k            1024            31
64k            1024            31

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/xattr.c