From 7c764a73c8fcf11935111e9a6f13db5785a8a474 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Mon, 20 Feb 2023 23:44:20 -0500 Subject: [PATCH] fs: allow BtrfsIoctlLogicalInoArgs to be reused, remove virtual methods Some malloc implementations will try to mmap() and munmap() large buffers every time they are used, causing a severe loss of performance. Nothing ever overrode the virtual methods, and there was no virtual destructor, so they cause compiler warnings at build time when used with a template that tries to delete pointers to them. Signed-off-by: Zygo Blaxell --- include/crucible/fs.h | 6 ++++-- lib/fs.cc | 12 ++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/crucible/fs.h b/include/crucible/fs.h index df7b936..6d1780b 100644 --- a/include/crucible/fs.h +++ b/include/crucible/fs.h @@ -69,9 +69,11 @@ namespace crucible { uint64_t get_flags() const; void set_flags(uint64_t new_flags); + void set_logical(uint64_t new_logical); + void set_size(uint64_t new_size); - virtual void do_ioctl(int fd); - virtual bool do_ioctl_nothrow(int fd); + void do_ioctl(int fd); + bool do_ioctl_nothrow(int fd); struct BtrfsInodeOffsetRootSpan { using iterator = BtrfsInodeOffsetRoot*; diff --git a/lib/fs.cc b/lib/fs.cc index 002c7a7..4327c28 100644 --- a/lib/fs.cc +++ b/lib/fs.cc @@ -315,6 +315,18 @@ namespace crucible { return m_flags; } + void + BtrfsIoctlLogicalInoArgs::set_logical(uint64_t new_logical) + { + m_logical = new_logical; + } + + void + BtrfsIoctlLogicalInoArgs::set_size(uint64_t new_size) + { + m_container_size = new_size; + } + bool BtrfsIoctlLogicalInoArgs::do_ioctl_nothrow(int fd) {