Skip to content

os/chain_xattr: cope with xfs limit of 254 bytes for inlined xattrs. - #4070

Merged
athanatos merged 4 commits into
masterfrom
wip-chain-xattr
May 29, 2015
Merged

athanatos merged 4 commits into
masterfrom
wip-chain-xattr

Conversation

@liewegas

Copy link
Copy Markdown
Member

No description provided.

@liewegas

Copy link
Copy Markdown
Member Author

@mslovy how does this look? (untested, and really needs some tests in test/objectstore/chain_xattr.cc, if you have the time!)

@loic-bot

Copy link
Copy Markdown

FAIL: the output of run-make-check.sh on centos-7 for 083943598b746e95ac4a20824c4915a8d0f13517 is http://paste2.org/pysp2VEE

:octocat: Sent from GH.

@loic-bot

Copy link
Copy Markdown

FAIL: the output of run-make-check.sh on centos-7 for f7d6fb4dc6ab978ae31e7abe368071e3a2586adb is http://paste2.org/4hFvgYgm

:octocat: Sent from GH.

@liewegas

Copy link
Copy Markdown
Member Author

added tests, passes make check

@loic-bot

Copy link
Copy Markdown

FAIL: the output of run-make-check.sh on centos-7 for 9904310438c3229f29f8603a61b47bea61e56bff is http://paste2.org/H0Jk4Gy9

:octocat: Sent from GH.

@loic-bot

Copy link
Copy Markdown

SUCCESS: the output of run-make-check.sh on centos-7 for d4acd7463176e48c26ec33d91a8a925003ca4331 is http://paste2.org/MLWfEvGx

:octocat: Sent from GH.

@mslovy

mslovy commented Mar 19, 2015

Copy link
Copy Markdown
Contributor

@liewegas reasonable, I agree that it becomes awkward if it breaks into too many 250bytes attrs. Xfs does linear search if the number of xattr items is small. But too many xattr items will result in a BTree Extent Struct (which is also not inline) in order to improve the search speed. I remember the critical point it changes to a BTree Format is 10, but not sure now. So We may set CHAIN_XATTR_SHORT_LEN_THRESHOLD this value smaller (say, 1000 or 750)?

@yuyuyu101

Copy link
Copy Markdown
Contributor

I wonder whether 254 bytes or 10 items spill out value are configurated or hard-coded?

It looks a little inflexible to let hardcoded a spill out value in ceph? maybe we can detect it via xfs command?

@liewegas

Copy link
Copy Markdown
Member Author

changed it to 1000 (4x 250byte stripes) and repushed.

i don't think it's a good idea to make this tunable, since the read path explicitly looks for multiples of the stripe length and we will fail to read old ones if the values change. it is annoying that this is working around an XFS thing, though. :/ but, that's what almost everyone is using with FileStore..

@loic-bot

Copy link
Copy Markdown

SUCCESS: the output of run-make-check.sh on centos-7 for 1465a67c06afaacf6991677764bccf53d18df27f is http://paste2.org/gIfBbb5D

:octocat: Sent from GH.

@yuyuyu101

Copy link
Copy Markdown
Contributor

Oh, I think my meaning is whether 254 bytes and 10 items can be configurated in xfs side. So if we can improve 254 to 512 bytes, it should be enough to store ceph internal xattr in one call.

@liewegas

Copy link
Copy Markdown
Member Author

oh. in xfs the limit is fixed because of the on-disk format. they are
using a single byte to encode the length of the xattr value. the inode
size can change, which effects how small attrs we can store... right now
we recommend (and the tools use) 2k.

Comment thread src/os/chain_xattr.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ENODATA may be ENOATTR better

BSD, Linux, DARWIN all with return ENOATTR and ENOATTR is defined to be ENODATA in Linux

@liewegas

liewegas commented Apr 9, 2015

Copy link
Copy Markdown
Member Author

@athanatos I think we should run this through qa?

@ghost

ghost commented Apr 9, 2015

Copy link
Copy Markdown

please ignore the last bot failure (network problem)

@athanatos

Copy link
Copy Markdown
Contributor

error: os/chain_xattr.cc:141:20: 'ENOATTR' was not declared in this scope

@yuyuyu101

Copy link
Copy Markdown
Contributor

@liewegas It seemed that we need to wrap ENOATTR or ENODATA at lower level:

  1. return ENOATTR, while ENODATA is defined and has other usages: NetBSD
    and MacOS X

  2. return ENODATA, while ENOATTR is not defined: Linux

  3. return ENOATTR, while ENODATA is not defined: FreeBSD

Linux: ENOATTR is defined to be a synonym for ENODATA in <attr/xattr.h>

Since only linux doesn't define ENOATTR and <attr/xattr.h> is included in attr package, maybe we define ENOATTR to ENODATA in common/xattr.c for linux?

@liewegas

liewegas commented Apr 17, 2015 via email

Copy link
Copy Markdown
Member Author

@liewegas

Copy link
Copy Markdown
Member Author

error: os/chain_xattr.cc:141:20: 'ENOATTR' was not declared in this scope

Oh, i see.

Yeah, let's do

#ifndef ENOATTR

define ENOATTR ENODATA

#endif

in our errno.h?

@yuyuyu101

Copy link
Copy Markdown
Contributor

Yeah, it looks ok.

liewegas added 4 commits May 15, 2015 18:56
If we wrote an xattr that was a multiple of a chunk, we will try to read
the next chunk and get ENODATA.  If that happens bail out of the loop and
assume we've read the whole thing.

Backport: hammer, firefly
Signed-off-by: Sage Weil <[email protected]>
XFS has a hard limit of 255 (or 254?) bytes for xattrs to be inlined in the
inode due to a single byte for the length in the on-disk format.  If we
have an xattr that is a bit bigger than that it will get kicked out into a
separate extent, but if we stripe it across a few shorter xattrs it can
be inlined when the xfs inode is e.g. 2K.

Adjust the chain_xattr logic to capture this case.  Note that we are doing
this unconditionally regardless of fs type, but that is probably okay
given that most users use XFS and the cost isn't huge.

Reported-by: Ning Yao <[email protected]>
Signed-off-by: Sage Weil <[email protected]>
ENOATTR == ENODATA on Linux; other systems return ENOATTR.

Signed-off-by: Sage Weil <[email protected]>
...if it isn't already defined.  Haomai reported seeing this somewhere.

Signed-off-by: Sage Weil <[email protected]>
@liewegas

Copy link
Copy Markdown
Member Author

added the define and rebased

athanatos pushed a commit that referenced this pull request May 29, 2015
os/chain_xattr: cope with xfs limit of 254 bytes for inlined xattrs.

Reviewed-by: Haomai Wang <[email protected]>
Reviewed-by: Ning Yao <[email protected]>
@athanatos
athanatos merged commit d7fabeb into master May 29, 2015
@athanatos
athanatos deleted the wip-chain-xattr branch May 29, 2015 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants