mirror of
https://github.com/ceph/ceph
synced 2025-02-23 02:57:21 +00:00
filestore: make list_collections() list all dirs
coll_t is now unstructured; list all dirs besides '.' and '..'.
The old coll_t::parse() was broken. Remove it. Fixes
a4138c9050
.
Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
parent
940354b986
commit
01ae1be288
@ -214,13 +214,6 @@ bool FileStore::parse_object(char *s, sobject_t& o)
|
||||
// 012345678901234567890123456789012
|
||||
// pppppppppppppppp.ssssssssssssssss
|
||||
|
||||
bool FileStore::parse_coll(char *s, coll_t& c)
|
||||
{
|
||||
bool r = c.parse(s);
|
||||
dout(0) << "parse " << s << " -> " << c << " = " << r << dendl;
|
||||
return r;
|
||||
}
|
||||
|
||||
void FileStore::get_cdir(coll_t cid, char *s, int len)
|
||||
{
|
||||
const string &cid_str(cid.to_str());
|
||||
@ -2214,9 +2207,14 @@ int FileStore::list_collections(vector<coll_t>& ls)
|
||||
while (::readdir_r(dir, &sde, &de) == 0) {
|
||||
if (!de)
|
||||
break;
|
||||
coll_t c;
|
||||
if (parse_coll(de->d_name, c))
|
||||
ls.push_back(c);
|
||||
if (!S_ISDIR(de->d_type << 12))
|
||||
continue;
|
||||
if (de->d_name[0] == '.' &&
|
||||
(de->d_name[1] == '\0' ||
|
||||
(de->d_name[1] == '.' &&
|
||||
de->d_name[2] == '\0')))
|
||||
continue;
|
||||
ls.push_back(coll_t(de->d_name));
|
||||
}
|
||||
|
||||
::closedir(dir);
|
||||
|
@ -265,24 +265,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool parse(const char *s) {
|
||||
if (strncmp(s, "meta", 4) == 0) {
|
||||
str = s;
|
||||
return true;
|
||||
}
|
||||
if (strncmp(s, "temp", 4) == 0) {
|
||||
str = s;
|
||||
return true;
|
||||
}
|
||||
pg_t pgid;
|
||||
snapid_t snap;
|
||||
if (is_pg(pgid, snap)) {
|
||||
str = s;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void encode(bufferlist& bl) const {
|
||||
__u8 struct_v = 3;
|
||||
::encode(struct_v, bl);
|
||||
|
Loading…
Reference in New Issue
Block a user