In the filestore in ceph, there is a key-value that implements cascade in chain_xattr.cc. Of course, the xattr here is saved in the file system in extended properties. The so-called cascade means that a key can correspond to a fragment of multiple values For example key@1 and key@2 are parsed as key-12 by chain_xattr Ceph mainly uses the user command space of xattr The user namespace in xattr used by ceph can be seen from the code below static void get_attrname(const char *name, char *buf, int len) { snprintf(buf, len, "user.ceph.%s", name); } bool parse_attrname(char **name) { if (strncmp(*name, "user.ceph.", 10) == 0) { *name += 10; return true; } return false; } Why use @ as separator between key and value? As can be seen from the code below void get_raw_xattr_name(const char *name, int i, char *raw_name, int raw_len) { int pos = 0; while (*name) { switch (*name) { case '@': /* escape it */ pos += 2; assert (pos < raw_len - 1); *raw_name = '@'; raw_name++; *raw_name = '@'; break; default: pos++; assert(pos < raw_len - 1); *raw_name = *name; break; } name++; raw_name++; } if (!i) { *raw_name = '\0'; } else { #From here you can know that @ is used as a separator between key and value int r = snprintf(raw_name, raw_len - pos, "@%d", i); assert(r < raw_len - pos); } }
Using extended attributes of the file system in ceph
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=324601298&siteId=291194637
Recommended
Ranking