diff --git a/include/crucible/fs.h b/include/crucible/fs.h index 79f7e75..05ee5e1 100644 --- a/include/crucible/fs.h +++ b/include/crucible/fs.h @@ -169,6 +169,12 @@ namespace crucible { bool operator<(const BtrfsIoctlSearchHeader &that) const; }; + // Perf blames this function for a few percent overhead; move it here so it can be inline + inline bool BtrfsIoctlSearchHeader::operator<(const BtrfsIoctlSearchHeader &that) const + { + return tie(objectid, type, offset, len, transid) < tie(that.objectid, that.type, that.offset, that.len, that.transid); + } + ostream & operator<<(ostream &os, const btrfs_ioctl_search_header &hdr); ostream & operator<<(ostream &os, const BtrfsIoctlSearchHeader &hdr); diff --git a/lib/fs.cc b/lib/fs.cc index f45b84c..4275f99 100644 --- a/lib/fs.cc +++ b/lib/fs.cc @@ -756,12 +756,6 @@ namespace crucible { return offset + len; } - bool - BtrfsIoctlSearchHeader::operator<(const BtrfsIoctlSearchHeader &that) const - { - return tie(objectid, type, offset, len, transid) < tie(that.objectid, that.type, that.offset, that.len, that.transid); - } - bool BtrfsIoctlSearchKey::do_ioctl_nothrow(int fd) {