From bcf3e7de3ef3f1f19765c47c00222d8348f221fc Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Fri, 23 Apr 2021 08:03:09 -0400 Subject: [PATCH] uuid: drop dependency on uuid.h The weird things distros do to the path where uuid.h gets installed have broken bees builds for the last time. We were only using uuid to support a legacy feature that was removed over four years ago. Hypothetical users who are upgrading directly from bees v0.1 should probably restart all the crawlers anyway--there were bugs. Also, if any such users exist, I respect their tremendous patience with the horrible performance all these years--bees got about 30x faster since v0.1. Signed-off-by: Zygo Blaxell --- docs/install.md | 9 ++------- include/crucible/fs.h | 1 - include/crucible/uuid.h | 14 -------------- lib/Makefile | 1 - lib/fs.cc | 8 -------- lib/uuid.cc | 16 ---------------- src/Makefile | 2 +- src/bees-context.cc | 4 ---- src/bees-roots.cc | 22 ++-------------------- src/bees.h | 2 -- 10 files changed, 5 insertions(+), 74 deletions(-) delete mode 100644 include/crucible/uuid.h delete mode 100644 lib/uuid.cc diff --git a/docs/install.md b/docs/install.md index fff0be2..afca571 100644 --- a/docs/install.md +++ b/docs/install.md @@ -17,11 +17,6 @@ Dependencies Needed at runtime by the service wrapper script. -* libuuid-dev - - This library is only required for a feature that was removed after v0.1. - The lingering support code can be removed. - * [Linux kernel version](btrfs-kernel.md) gets its own page. * markdown for documentation @@ -73,10 +68,10 @@ Both of the latter use the filesystem UUID to mount the root subvolume within a temporary runtime directory. ### Ubuntu 16.04 - 17.04: -`$ apt -y install build-essential btrfs-tools uuid-dev markdown && make` +`$ apt -y install build-essential btrfs-tools markdown && make` ### Ubuntu 18.10: -`$ apt -y install build-essential btrfs-progs uuid-dev markdown && make` +`$ apt -y install build-essential btrfs-progs markdown && make` ### Ubuntu 14.04: You can try to carry on the work done here: diff --git a/include/crucible/fs.h b/include/crucible/fs.h index 4ce5b94..fcd61e0 100644 --- a/include/crucible/fs.h +++ b/include/crucible/fs.h @@ -238,7 +238,6 @@ namespace crucible { struct BtrfsIoctlFsInfoArgs : public btrfs_ioctl_fs_info_args_v2 { BtrfsIoctlFsInfoArgs(); void do_ioctl(int fd); - string uuid() const; uint16_t csum_type() const; uint16_t csum_size() const; }; diff --git a/include/crucible/uuid.h b/include/crucible/uuid.h deleted file mode 100644 index 7b1d545..0000000 --- a/include/crucible/uuid.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef CRUCIBLE_UUID_H -#define CRUCIBLE_UUID_H - -#include - -#include - -namespace crucible { - using namespace std; - - string uuid_unparse(const unsigned char a[16]); -} - -#endif // CRUCIBLE_UUID_H diff --git a/lib/Makefile b/lib/Makefile index 3c98850..c7386de 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -18,7 +18,6 @@ CRUCIBLE_OBJS = \ string.o \ task.o \ time.o \ - uuid.o \ include ../makeflags -include ../localconf diff --git a/lib/fs.cc b/lib/fs.cc index 4345025..53a3f94 100644 --- a/lib/fs.cc +++ b/lib/fs.cc @@ -5,7 +5,6 @@ #include "crucible/limits.h" #include "crucible/ntoa.h" #include "crucible/string.h" -#include "crucible/uuid.h" // FS_IOC_FIEMAP #include @@ -1071,7 +1070,6 @@ namespace crucible { os << "BtrfsIoctlFsInfoArgs {" << " max_id = " << a.max_id << "," << " num_devices = " << a.num_devices << "," - << " fsid = " << a.uuid() << "," #if 0 << " nodesize = " << a.nodesize << "," << " sectorsize = " << a.sectorsize << "," @@ -1099,12 +1097,6 @@ namespace crucible { } } - string - BtrfsIoctlFsInfoArgs::uuid() const - { - return uuid_unparse(fsid); - } - uint16_t BtrfsIoctlFsInfoArgs::csum_type() const { diff --git a/lib/uuid.cc b/lib/uuid.cc deleted file mode 100644 index 32c2958..0000000 --- a/lib/uuid.cc +++ /dev/null @@ -1,16 +0,0 @@ -#include "crucible/uuid.h" - -namespace crucible { - using namespace std; - - const size_t uuid_unparsed_size = 37; // "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\0" - - string - uuid_unparse(const unsigned char in[16]) - { - char out[uuid_unparsed_size]; - ::uuid_unparse(in, out); - return string(out); - } - -} diff --git a/src/Makefile b/src/Makefile index fcd362a..f6cc9bb 100644 --- a/src/Makefile +++ b/src/Makefile @@ -10,7 +10,7 @@ all: $(BEES) $(PROGRAMS) include ../makeflags -include ../localconf -LIBS = -lcrucible -luuid -lpthread +LIBS = -lcrucible -lpthread BEES_LDFLAGS = -L../lib $(LDFLAGS) BEES_OBJS = \ diff --git a/src/bees-context.cc b/src/bees-context.cc index 3f2407d..24d8039 100644 --- a/src/bees-context.cc +++ b/src/bees-context.cc @@ -941,10 +941,6 @@ BeesContext::set_root_fd(Fd fd) Stat st(fd); THROW_CHECK1(invalid_argument, st.st_ino, st.st_ino == BTRFS_FIRST_FREE_OBJECTID); m_root_fd = fd; - BtrfsIoctlFsInfoArgs fsinfo; - fsinfo.do_ioctl(fd); - m_root_uuid = fsinfo.uuid(); - BEESLOGINFO("Filesystem UUID is " << m_root_uuid); // 65536 is big enough for two max-sized extents. // Need enough total space in the cache for the maximum number of active threads. diff --git a/src/bees-roots.cc b/src/bees-roots.cc index 05a812e..f183b42 100644 --- a/src/bees-roots.cc +++ b/src/bees-roots.cc @@ -84,20 +84,8 @@ BeesRoots::set_workaround_btrfs_send(bool do_avoid) string BeesRoots::crawl_state_filename() const { - string rv; - - // Legacy filename included UUID - rv += "beescrawl."; - rv += m_ctx->root_uuid(); - rv += ".dat"; - - struct stat buf; - if (fstatat(m_ctx->home_fd(), rv.c_str(), &buf, AT_SYMLINK_NOFOLLOW)) { - // Use new filename - rv = "beescrawl.dat"; - } - - return rv; + // Legacy filename included UUID. That feature was removed in 2016. + return "beescrawl.dat"; } ostream & @@ -149,12 +137,6 @@ BeesRoots::state_save() m_crawl_state_file.write(ofs.str()); - // Renaming things is hard after release - if (m_crawl_state_file.name() != "beescrawl.dat") { - renameat(m_ctx->home_fd(), m_crawl_state_file.name().c_str(), m_ctx->home_fd(), "beescrawl.dat"); - m_crawl_state_file.name("beescrawl.dat"); - } - BEESNOTE("relocking crawl state"); lock.lock(); // Not really correct but probably close enough diff --git a/src/bees.h b/src/bees.h index 8a6fc10..eeb30a7 100644 --- a/src/bees.h +++ b/src/bees.h @@ -734,7 +734,6 @@ class BeesContext : public enable_shared_from_this { string m_root_path; Fd m_root_fd; - string m_root_uuid; mutable mutex m_blacklist_mutex; set m_blacklist; @@ -771,7 +770,6 @@ public: Fd root_fd() const { return m_root_fd; } Fd home_fd(); string root_path() const { return m_root_path; } - string root_uuid() const { return m_root_uuid; } BeesFileRange scan_forward(const BeesFileRange &bfr);