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                         }
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to