mdadm/0002-monitor-refactor-checkpoint-update.patch

101 lines
3.3 KiB
Diff
Raw Normal View History

Accepting request 1149803 from home:colyli:branches:openSUSE:Factory - Update mdadm-4.3 to latest status (jsc#PED-7542) - Remove hardcoded checkpoint interval checking 0001-Remove-hardcoded-checkpoint-interval-checking.patch - monitor: refactor checkpoint update 0002-monitor-refactor-checkpoint-update.patch - Super-intel: Fix first checkpoint restart 0003-Super-intel-Fix-first-checkpoint-restart.patch - Grow: Move update_tail assign to Grow_reshape() 0004-Grow-Move-update_tail-assign-to-Grow_reshape.patch - Add understanding output section in man 0005-Add-understanding-output-section-in-man.patch - Upgrade to mdadm-4.3 (jsc#PED-7542). Beside previous already back ported patches, mdadm-4.3 has the following extra changes since last update upto commit 582945c2d3bb, - Fix null pointer for incremental in mdadm. - Super1: fix truncation check for journal device. - Fix some cases eyesore formatting. - Bump minimum kernel version to 2.6.32. - Remove the config files in mdcheck_start|continue service. - Define DEV_MD_DIR, DEV_NUM_PREF, is_devname_ignore(), ident_set_devname(). - Enable RAID for SATA under VMD. - Imsm: Fix possible segfault in check_no_platform() - Imsm refactor on imsm_get_free_size(), merge_extents(). - Imsm: return free space after volume for expand. - Imsm: fix free space calculations. - Add secure gethostname() wrapper. - mdadm: Stop mdcheck_continue timer when mdcheck_start service can finish check. OBS-URL: https://build.opensuse.org/request/show/1149803 OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=233
2024-02-23 11:44:13 +01:00
From cf87fe75fd83dac008ea116c2c52ec69783fdf6a Mon Sep 17 00:00:00 2001
From: Mateusz Kusiak <mateusz.kusiak@intel.com>
Date: Thu, 18 Jan 2024 11:30:16 +0100
Subject: [PATCH 2/5] monitor: refactor checkpoint update
Git-commit: cf87fe75fd83dac008ea116c2c52ec69783fdf6a
Patch-mainline: mdadm-4.3+
References: jsc#PED-7542
"if" statements of checkpoint updates have too many responsibilties.
This results in unclear code flow and duplicated code.
Refactor checkpoint update code and simplify "if" statements.
Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Signed-off-by: Coly Li <colyli@suse.de>
---
monitor.c | 51 +++++++++++++++++++++++++--------------------------
1 file changed, 25 insertions(+), 26 deletions(-)
diff --git a/monitor.c b/monitor.c
index b8d9e88..be0bec7 100644
--- a/monitor.c
+++ b/monitor.c
@@ -412,6 +412,7 @@ static int read_and_act(struct active_array *a, fd_set *fds)
int ret = 0;
int count = 0;
struct timeval tv;
+ bool write_checkpoint = false;
a->next_state = bad_word;
a->next_action = bad_action;
@@ -564,40 +565,38 @@ static int read_and_act(struct active_array *a, fd_set *fds)
}
}
- /* Handle reshape checkpointing
- */
- if ((a->curr_action == idle && a->prev_action == reshape) ||
- (a->curr_action == reshape && sync_completed > a->last_checkpoint)) {
- /* Reshape has progressed or completed so we need to
- * update the array state - and possibly the array size
- */
+ /* Update reshape checkpoint, depending if it finished or progressed */
+ if (a->curr_action == idle && a->prev_action == reshape) {
+ char buf[SYSFS_MAX_BUF_SIZE];
+
if (sync_completed != 0)
a->last_checkpoint = sync_completed;
- /* We might need to update last_checkpoint depending on
- * the reason that reshape finished.
- * if array reshape is really finished:
- * set check point to the end, this allows
- * set_array_state() to finalize reshape in metadata
- * if reshape if broken: do not set checkpoint to the end
- * this allows for reshape restart from checkpoint
+
+ /*
+ * If reshape really finished, set checkpoint to the end to finalize it.
+ * Do not set checkpoint if reshape is broken.
+ * Reshape will restart from last checkpoint.
*/
- if ((a->curr_action != reshape) &&
- (a->prev_action == reshape)) {
- char buf[SYSFS_MAX_BUF_SIZE];
- if ((sysfs_get_str(&a->info, NULL,
- "reshape_position",
- buf,
- sizeof(buf)) >= 0) &&
- str_is_none(buf) == true)
+ if (sysfs_get_str(&a->info, NULL, "reshape_position", buf, sizeof(buf)) >= 0)
+ if (str_is_none(buf) == true)
a->last_checkpoint = a->info.component_size;
- }
- a->container->ss->set_array_state(a, a->curr_state <= clean);
- a->last_checkpoint = sync_completed;
+
+ write_checkpoint = true;
}
- if (sync_completed > a->last_checkpoint) {
+ if (a->curr_action >= reshape && sync_completed > a->last_checkpoint) {
+ /* Update checkpoint if neither reshape nor idle action */
a->last_checkpoint = sync_completed;
+
+ write_checkpoint = true;
+ }
+
+ /* Save checkpoint */
+ if (write_checkpoint) {
a->container->ss->set_array_state(a, a->curr_state <= clean);
+
+ if (a->curr_action <= reshape)
+ a->last_checkpoint = sync_completed;
}
if (sync_completed >= a->info.component_size)
--
2.35.3