diff options
author | Patrick Donnelly <pdonnell@redhat.com> | 2017-11-21 17:49:51 +0100 |
---|---|---|
committer | Patrick Donnelly <pdonnell@redhat.com> | 2017-12-04 23:05:50 +0100 |
commit | 4f2fa427f483a29df168053d0021ee35c1aa207d (patch) | |
tree | 88d46fec5eeee9152efe46d8c193a921d755c6cb /src/tools/ceph-client-debug.cc | |
parent | client: cleanup Dentry definition (diff) | |
download | ceph-4f2fa427f483a29df168053d0021ee35c1aa207d.tar.xz ceph-4f2fa427f483a29df168053d0021ee35c1aa207d.zip |
client: xlist link dentries instead of set
This saves space and avoids unnecessary set logic. In particular, we no longer
need to do a heap allocation for each Dentry * in the std::set.
Before:
(gdb) print sizeof(Inode)
$1 = 1336
(gdb) print sizeof(Inode::dn_set)
$2 = 48
After:
(gdb) print sizeof(Inode)
$1 = 1360
(gdb) print sizeof(Inode::dentries)
$2 = 24
I'm not sure why the Inode size increased when the member size decreased (weird
padding by g++)? Anyway, we still get the benefit of no heap allocations for
the Dentry *s.
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
Diffstat (limited to 'src/tools/ceph-client-debug.cc')
-rw-r--r-- | src/tools/ceph-client-debug.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/tools/ceph-client-debug.cc b/src/tools/ceph-client-debug.cc index 2984db678cf..7af2ec6f87c 100644 --- a/src/tools/ceph-client-debug.cc +++ b/src/tools/ceph-client-debug.cc @@ -39,11 +39,11 @@ void usage() */ void traverse_dentries(Inode *ino, std::vector<Dentry*> &parts) { - if (ino->dn_set.empty()) { + if (ino->dentries.empty()) { return; } - Dentry* dn = *(ino->dn_set.begin()); + Dentry* dn = *(ino->dentries.begin()); parts.push_back(dn); traverse_dentries(dn->dir->parent_inode, parts); } @@ -61,8 +61,8 @@ int lookup_trace(ceph_mount_info *client, inodeno_t const ino) if (r != 0) { return r; } else { - if (!inode->dn_set.empty()) { - Dentry *dn = *(inode->dn_set.begin()); + if (!inode->dentries.empty()) { + Dentry *dn = *(inode->dentries.begin()); assert(dn->dir); assert(dn->dir->parent_inode); r = lookup_trace(client, dn->dir->parent_inode->ino); |