sysfs: remove vers parameter from sysfs_set_array
PATCH 1/1 sysfs: remove vers parameter from sysfs_set_array
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 <[email protected]>
--- Assemble.c | 2 +- mdadm.h | 2 +- sysfs.c | 6 ++---- util.c | 3 +-- 4 files changed, 5 insertions(+), 8 deletions(-)
Assemble.c +1 -1
@@ -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 ; }
mdadm.h +1 -1
@@ -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);
sysfs.c +2 -4
@@ -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 ; }
util.c +1 -2
@@ -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;
Signature · 1 line
2.39.2
Mariusz Tkaczyk
AppliedQuoted 7 lines · On Mon, 18 Mar 2024 16:53:31 +0100 Mateusz Kusiak <[email protected]>…
9003 was passed directly to
sysfs_set_array()sincemd_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 <[email protected]>
Applied!
Thanks,
Mariusz