From: Arvin Schnell Date: Tue, 30 Jun 2026 12:43:31 +0000 (+0200) Subject: - allow to use generic directory comparison X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1164%2Fhead;p=thirdparty%2Fsnapper.git - allow to use generic directory comparison --- diff --git a/snapper/Btrfs.cc b/snapper/Btrfs.cc index 9513c136..d06681be 100644 --- a/snapper/Btrfs.cc +++ b/snapper/Btrfs.cc @@ -1,6 +1,6 @@ /* * Copyright (c) [2011-2015] Novell, Inc. - * Copyright (c) [2016-2025] SUSE LLC + * Copyright (c) [2016-2026] SUSE LLC * * All Rights Reserved. * @@ -80,7 +80,7 @@ namespace snapper Btrfs::Btrfs(const string& subvolume, const string& root_prefix) - : Filesystem(subvolume, root_prefix), qgroup(no_qgroup) + : Filesystem(subvolume, root_prefix) { } @@ -122,6 +122,8 @@ namespace snapper } #endif + + config_info.get_value("SPECIAL_CMP", special_cmp); } @@ -1363,24 +1365,33 @@ namespace snapper void Btrfs::cmpDirs(const SDir& dir1, const SDir& dir2, cmpdirs_cb_t cb) const { - y2mil("special btrfs cmpDirs"); - - try + if (special_cmp) { - Stopwatch stopwatch; + y2mil("special btrfs cmpDirs"); + + try + { + Stopwatch stopwatch; - const SDir subvolume(openSubvolumeDir()); + const SDir subvolume(openSubvolumeDir()); - StreamProcessor processor(subvolume, dir1, dir2); + StreamProcessor processor(subvolume, dir1, dir2); - processor.process(cb); + processor.process(cb); - y2mil("stopwatch " << stopwatch << " for comparing directories"); + y2mil("stopwatch " << stopwatch << " for comparing directories"); + } + catch (const Exception& e) + { + y2err("special btrfs cmpDirs failed, " << e.what()); + y2mil("cmpDirs fallback"); + + snapper::cmpDirs(dir1, dir2, cb); + } } - catch (const Exception& e) + else { - y2err("special btrfs cmpDirs failed, " << e.what()); - y2mil("cmpDirs fallback"); + y2mil("generic cmpDirs"); snapper::cmpDirs(dir1, dir2, cb); } diff --git a/snapper/Btrfs.h b/snapper/Btrfs.h index 21dc759c..affd94fa 100644 --- a/snapper/Btrfs.h +++ b/snapper/Btrfs.h @@ -99,7 +99,8 @@ namespace snapper private: - qgroup_t qgroup; + qgroup_t qgroup = no_qgroup; + bool special_cmp = true; mutable vector deleted_subvolids;