ca78f33aa3
0008-Detail-remove-duplicated-code.patch - mdadm: Fix native --detail --export (bsc#1226413) 0009-mdadm-Fix-native-detail-export.patch OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=239
80 lines
2.3 KiB
Diff
80 lines
2.3 KiB
Diff
From 60c19530dd7cc6b38a75695a0a3d004bbe60d430 Mon Sep 17 00:00:00 2001
|
|
From: Kinga Tanska <kinga.tanska@intel.com>
|
|
Date: Tue, 27 Feb 2024 03:36:14 +0100
|
|
Subject: [PATCH] Detail: remove duplicated code
|
|
Git-commit: 60c19530dd7cc6b38a75695a0a3d004bbe60d430
|
|
Patch-mainline: mdadm-4.3
|
|
References: bsc#1226413
|
|
|
|
Remove duplicated code from Detail(), where MD_UUID and MD_DEVNAME
|
|
are being set. Superblock is no longer required to print system
|
|
properties. Now it tries to obtain map in two ways.
|
|
|
|
Signed-off-by: Kinga Tanska <kinga.tanska@intel.com>
|
|
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
|
Signed-off-by: Coly Li <colyli@suse.de>
|
|
---
|
|
Detail.c | 33 +++++++++++++--------------------
|
|
1 file changed, 13 insertions(+), 20 deletions(-)
|
|
|
|
diff --git a/Detail.c b/Detail.c
|
|
index aaa3dd6e..f23ec16f 100644
|
|
--- a/Detail.c
|
|
+++ b/Detail.c
|
|
@@ -226,6 +226,9 @@ int Detail(char *dev, struct context *c)
|
|
str = map_num(pers, array.level);
|
|
|
|
if (c->export) {
|
|
+ char nbuf[64];
|
|
+ struct map_ent *mp = NULL, *map = NULL;
|
|
+
|
|
if (array.raid_disks) {
|
|
if (str)
|
|
printf("MD_LEVEL=%s\n", str);
|
|
@@ -247,32 +250,22 @@ int Detail(char *dev, struct context *c)
|
|
array.minor_version);
|
|
}
|
|
|
|
- if (st && st->sb && info) {
|
|
- char nbuf[64];
|
|
- struct map_ent *mp, *map = NULL;
|
|
-
|
|
- fname_from_uuid(st, info, nbuf, ':');
|
|
- printf("MD_UUID=%s\n", nbuf + 5);
|
|
+ if (info)
|
|
mp = map_by_uuid(&map, info->uuid);
|
|
+ if (!mp)
|
|
+ mp = map_by_devnm(&map, fd2devnm(fd));
|
|
|
|
- if (mp && mp->path && strncmp(mp->path, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0)
|
|
+ if (mp) {
|
|
+ __fname_from_uuid(mp->uuid, 0, nbuf, ':');
|
|
+ printf("MD_UUID=%s\n", nbuf + 5);
|
|
+ if (mp->path && strncmp(mp->path, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0)
|
|
printf("MD_DEVNAME=%s\n", mp->path + DEV_MD_DIR_LEN);
|
|
+ }
|
|
|
|
+ map_free(map);
|
|
+ if (st && st->sb) {
|
|
if (st->ss->export_detail_super)
|
|
st->ss->export_detail_super(st);
|
|
- map_free(map);
|
|
- } else {
|
|
- struct map_ent *mp, *map = NULL;
|
|
- char nbuf[64];
|
|
- mp = map_by_devnm(&map, fd2devnm(fd));
|
|
- if (mp) {
|
|
- __fname_from_uuid(mp->uuid, 0, nbuf, ':');
|
|
- printf("MD_UUID=%s\n", nbuf+5);
|
|
- }
|
|
- if (mp && mp->path && strncmp(mp->path, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0)
|
|
- printf("MD_DEVNAME=%s\n", mp->path + DEV_MD_DIR_LEN);
|
|
-
|
|
- map_free(map);
|
|
}
|
|
if (!c->no_devices && sra) {
|
|
struct mdinfo *mdi;
|
|
--
|
|
2.46.0
|
|
|