All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mateusz Kusiak <mateusz.kusiak@intel.com>
To: linux-raid@vger.kernel.org
Cc: mariusz.tkaczyk@linux.intel.com, jes@trained-monkey.org
Subject: [PATCH] sysfs: remove vers parameter from sysfs_set_array
Date: Mon, 18 Mar 2024 16:53:31 +0100	[thread overview]
Message-ID: <20240318155331.1439-1-mateusz.kusiak@intel.com> (raw)

9003 was passed directly to sysfs_set_array() since md_get_version()
always returned this value. md_get_version() was removed long ago.

Remove dead version check from sysfs_set_array().
Remove "vers" argument and fix function calls.

Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
---
 Assemble.c | 2 +-
 mdadm.h    | 2 +-
 sysfs.c    | 6 ++----
 util.c     | 3 +--
 4 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/Assemble.c b/Assemble.c
index 9d042055ad4e..f6c5b99e25e2 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -1988,7 +1988,7 @@ int assemble_container_content(struct supertype *st, int mdfd,
 	 * and ignoring special character on the first place.
 	 */
 	if (strcmp(sra->text_version + 1, content->text_version + 1) != 0) {
-		if (sysfs_set_array(content, 9003) != 0) {
+		if (sysfs_set_array(content) != 0) {
 			sysfs_free(sra);
 			return 1;
 		}
diff --git a/mdadm.h b/mdadm.h
index 1f28b3e754be..48e5a4935868 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -807,7 +807,7 @@ extern int sysfs_attribute_available(struct mdinfo *sra, struct mdinfo *dev,
 extern int sysfs_get_str(struct mdinfo *sra, struct mdinfo *dev,
 			 char *name, char *val, int size);
 extern int sysfs_set_safemode(struct mdinfo *sra, unsigned long ms);
-extern int sysfs_set_array(struct mdinfo *info, int vers);
+extern int sysfs_set_array(struct mdinfo *info);
 extern int sysfs_add_disk(struct mdinfo *sra, struct mdinfo *sd, int resume);
 extern int sysfs_disk_to_scsi_id(int fd, __u32 *id);
 extern int sysfs_unique_holder(char *devnm, long rdev);
diff --git a/sysfs.c b/sysfs.c
index f95ef7013e84..937a02e88a79 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -655,7 +655,7 @@ int sysfs_set_safemode(struct mdinfo *sra, unsigned long ms)
 	return sysfs_set_str(sra, NULL, "safe_mode_delay", delay);
 }
 
-int sysfs_set_array(struct mdinfo *info, int vers)
+int sysfs_set_array(struct mdinfo *info)
 {
 	int rv = 0;
 	char ver[100];
@@ -679,9 +679,7 @@ int sysfs_set_array(struct mdinfo *info, int vers)
 			if (strlen(buf) >= 9 && buf[9] == '-')
 				ver[9] = '-';
 
-		if ((vers % 100) < 2 ||
-		    sysfs_set_str(info, NULL, "metadata_version",
-				  ver) < 0) {
+		if (sysfs_set_str(info, NULL, "metadata_version", ver) < 0) {
 			pr_err("This kernel does not support external metadata.\n");
 			return 1;
 		}
diff --git a/util.c b/util.c
index b145447370b3..a3a46255d297 100644
--- a/util.c
+++ b/util.c
@@ -1899,8 +1899,7 @@ int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info)
 	int rv;
 
 	if (st->ss->external)
-		return sysfs_set_array(info, 9003);
-		
+		return sysfs_set_array(info);
 	memset(&inf, 0, sizeof(inf));
 	inf.major_version = info->array.major_version;
 	inf.minor_version = info->array.minor_version;
-- 
2.39.2


             reply	other threads:[~2024-03-18 15:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-18 15:53 Mateusz Kusiak [this message]
2024-03-22 11:18 ` [PATCH] sysfs: remove vers parameter from sysfs_set_array Mariusz Tkaczyk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240318155331.1439-1-mateusz.kusiak@intel.com \
    --to=mateusz.kusiak@intel.com \
    --cc=jes@trained-monkey.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=mariusz.tkaczyk@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.