From 3b5da029435078c4f537373e8279148a0cca204b Mon Sep 17 00:00:00 2001 From: Mike Fleetwood Date: Sat, 6 Apr 2024 20:42:00 +0100 Subject: [PATCH] Add bcachefs checking (!123) [Only the options being used by GParted are quoted here from the help output. More options are available.] $ bcachefs fsck --help bcachefs fsck - filesystem check and repair Usage: bcachefs fsck [OPTION]... Options: -y Assume "yes" to all questions -f Force checking even if filesystem is marked clean -v Be verbose Closes !123 - Add support for bcachefs, single device file systems only --- include/bcachefs.h | 1 + src/bcachefs.cc | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/include/bcachefs.h b/include/bcachefs.h index b04744b9..815c495f 100644 --- a/include/bcachefs.h +++ b/include/bcachefs.h @@ -37,6 +37,7 @@ public: void read_label(Partition& partition); void read_uuid(Partition& partition); bool resize(const Partition& partition_new, OperationDetail& operationdetail, bool fill_partition); + bool check_repair(const Partition& partition, OperationDetail& operationdetail); }; diff --git a/src/bcachefs.cc b/src/bcachefs.cc index 1a6514ae..21958290 100644 --- a/src/bcachefs.cc +++ b/src/bcachefs.cc @@ -50,6 +50,7 @@ FS bcachefs::get_filesystem_support() if (Utils::kernel_version_at_least(3, 6, 0)) fs.online_grow = FS::EXTERNAL; #endif + fs.check = FS::EXTERNAL; } fs_limits.min_size = 32 * MEBIBYTE; @@ -143,4 +144,11 @@ bool bcachefs::resize(const Partition& partition_new, OperationDetail& operation } +bool bcachefs::check_repair(const Partition& partition, OperationDetail& operationdetail) +{ + return ! execute_command("bcachefs fsck -f -y -v " + Glib::shell_quote(partition.get_path()), + operationdetail, EXEC_CHECK_STATUS); +} + + } //GParted