Thread (4 messages) 4 messages, 2 authors, 2015-08-13

Re: bcachefs xattr

From: Kent Overstreet <hidden>
Date: 2015-08-13 07:41:26

On Thu, Aug 13, 2015 at 12:39:07AM -0700, Ming Lin wrote:
Hi Kent,

Seems the max length of xattr name+value is only 2004 bytes.
Why the limit of U8_MAX below?
The size of the key and value is stored as a u8 in units of u64s - the u64s
field of struct bkey.
root@bee:~# dd if=/dev/zero bs=1 count=1996 2>/dev/null | attr -s "long_attr" /mnt/test/attr.txt
attr_set: Numerical result out of range
Could not set "long_attr" for /mnt/test/attr.txt

183 int bch_xattr_set(struct inode *inode, const char *name,
...

230                 if (value) {
231                         struct keylist keys;
232                         struct bkey_i_xattr *xattr;
233                         unsigned u64s = BKEY_U64s +
234                                 DIV_ROUND_UP(sizeof(struct bch_xattr) +
235                                              qname.len + size,
236                                              sizeof(u64));
237 
238                         if (u64s > U8_MAX) {
239                                 ret = -ERANGE;
240                                 break;
241                         }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help