linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* bcachefs xattr
@ 2015-08-13  7:39 Ming Lin
  2015-08-13  7:41 ` Kent Overstreet
  0 siblings, 1 reply; 4+ messages in thread
From: Ming Lin @ 2015-08-13  7:39 UTC (permalink / raw)
  To: linux-bcache; +Cc: Kent Overstreet

Hi Kent,

Seems the max length of xattr name+value is only 2004 bytes.
Why the limit of U8_MAX below?

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                         }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bcachefs xattr
  2015-08-13  7:39 bcachefs xattr Ming Lin
@ 2015-08-13  7:41 ` Kent Overstreet
  2015-08-13  7:49   ` Ming Lin
  0 siblings, 1 reply; 4+ messages in thread
From: Kent Overstreet @ 2015-08-13  7:41 UTC (permalink / raw)
  To: Ming Lin; +Cc: linux-bcache

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                         }
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bcachefs xattr
  2015-08-13  7:41 ` Kent Overstreet
@ 2015-08-13  7:49   ` Ming Lin
  2015-08-13  7:50     ` Kent Overstreet
  0 siblings, 1 reply; 4+ messages in thread
From: Ming Lin @ 2015-08-13  7:49 UTC (permalink / raw)
  To: Kent Overstreet; +Cc: linux-bcache

On Wed, 2015-08-12 at 23:41 -0800, Kent Overstreet wrote:
> 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.

xfstests/generic/020 failed.
Got it now.

xfs supports 64KB values.
In order to support larger size of value, does it make sense to store
the value in "extent"?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bcachefs xattr
  2015-08-13  7:49   ` Ming Lin
@ 2015-08-13  7:50     ` Kent Overstreet
  0 siblings, 0 replies; 4+ messages in thread
From: Kent Overstreet @ 2015-08-13  7:50 UTC (permalink / raw)
  To: Ming Lin; +Cc: linux-bcache

On Thu, Aug 13, 2015 at 12:49:13AM -0700, Ming Lin wrote:
> On Wed, 2015-08-12 at 23:41 -0800, Kent Overstreet wrote:
> > 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.
> 
> xfstests/generic/020 failed.
> Got it now.
> 
> xfs supports 64KB values.
> In order to support larger size of value, does it make sense to store
> the value in "extent"?

Perhaps, but let's leave that for now and add it if there's demand for it.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-13  7:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-13  7:39 bcachefs xattr Ming Lin
2015-08-13  7:41 ` Kent Overstreet
2015-08-13  7:49   ` Ming Lin
2015-08-13  7:50     ` Kent Overstreet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).