linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Various cleanups
@ 2020-07-16  4:54 Damien Le Moal
  2020-07-16  4:54 ` [PATCH 1/4] md: Fix compilation warning Damien Le Moal
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Damien Le Moal @ 2020-07-16  4:54 UTC (permalink / raw)
  To: Song Liu, linux-raid

Song,

These patches fix various compilation warnings showing up when
compiling with W=1. Therer are also a lot of warnings generated by
sparse (C=1 compilation). Working on addressing those too in a
follow-up series.

Damien Le Moal (4):
  md: Fix compilation warning
  md: raid5-cache: Remove set but unused variable
  md: raid5: Fix compilation warning
  md: raid10: Fix compilation warning

 drivers/md/md.c          | 12 ++++++------
 drivers/md/raid10.c      |  4 ++--
 drivers/md/raid5-cache.c |  4 +---
 drivers/md/raid5.c       | 12 ++++++------
 4 files changed, 15 insertions(+), 17 deletions(-)

-- 
2.26.2

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] md: Fix compilation warning
  2020-07-16  4:54 [PATCH 0/4] Various cleanups Damien Le Moal
@ 2020-07-16  4:54 ` Damien Le Moal
  2020-07-16  4:54 ` [PATCH 2/4] md: raid5-cache: Remove set but unused variable Damien Le Moal
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Damien Le Moal @ 2020-07-16  4:54 UTC (permalink / raw)
  To: Song Liu, linux-raid

Remove the if statement around the calls to sysfs_link_rdev() to avoid
the compilation warnings:

warning: suggest braces around empty body in an ‘if’ statement

when compiling with W=1. For the call to sysfs_create_link() generating
the same warning, use the err variable to store the function result,
avoiding triggering another warning as the function is declared
as 'warn_unused_result'.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 drivers/md/md.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index fc33f2f8a415..9d740e4181ff 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2469,8 +2469,8 @@ static int bind_rdev_to_array(struct md_rdev *rdev, struct mddev *mddev)
 		goto fail;
 
 	ko = &part_to_dev(rdev->bdev->bd_part)->kobj;
-	if (sysfs_create_link(&rdev->kobj, ko, "block"))
-		/* failure here is OK */;
+	/* failure here is OK */
+	err = sysfs_create_link(&rdev->kobj, ko, "block");
 	rdev->sysfs_state = sysfs_get_dirent_safe(rdev->kobj.sd, "state");
 	rdev->sysfs_unack_badblocks =
 		sysfs_get_dirent_safe(rdev->kobj.sd, "unacknowledged_bad_blocks");
@@ -3238,8 +3238,8 @@ slot_store(struct md_rdev *rdev, const char *buf, size_t len)
 			return err;
 		} else
 			sysfs_notify_dirent_safe(rdev->sysfs_state);
-		if (sysfs_link_rdev(rdev->mddev, rdev))
-			/* failure here is OK */;
+		/* failure here is OK */;
+		sysfs_link_rdev(rdev->mddev, rdev);
 		/* don't wakeup anyone, leave that to userspace. */
 	} else {
 		if (slot >= rdev->mddev->raid_disks &&
@@ -9113,8 +9113,8 @@ static int remove_and_add_spares(struct mddev *mddev,
 			rdev->recovery_offset = 0;
 		}
 		if (mddev->pers->hot_add_disk(mddev, rdev) == 0) {
-			if (sysfs_link_rdev(mddev, rdev))
-				/* failure here is OK */;
+			/* failure here is OK */
+			sysfs_link_rdev(mddev, rdev);
 			if (!test_bit(Journal, &rdev->flags))
 				spares++;
 			md_new_event(mddev);
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] md: raid5-cache: Remove set but unused variable
  2020-07-16  4:54 [PATCH 0/4] Various cleanups Damien Le Moal
  2020-07-16  4:54 ` [PATCH 1/4] md: Fix compilation warning Damien Le Moal
@ 2020-07-16  4:54 ` Damien Le Moal
  2020-07-16  4:54 ` [PATCH 3/4] md: raid5: Fix compilation warning Damien Le Moal
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Damien Le Moal @ 2020-07-16  4:54 UTC (permalink / raw)
  To: Song Liu, linux-raid

Remove the variable offset in r5c_tree_index() to avoid a "set but not
used" compilation warning when compiling with W=1.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 drivers/md/raid5-cache.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c
index 0bea21d81697..34fd942dad83 100644
--- a/drivers/md/raid5-cache.c
+++ b/drivers/md/raid5-cache.c
@@ -195,9 +195,7 @@ struct r5l_log {
 static inline sector_t r5c_tree_index(struct r5conf *conf,
 				      sector_t sect)
 {
-	sector_t offset;
-
-	offset = sector_div(sect, conf->chunk_sectors);
+	sector_div(sect, conf->chunk_sectors);
 	return sect;
 }
 
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] md: raid5: Fix compilation warning
  2020-07-16  4:54 [PATCH 0/4] Various cleanups Damien Le Moal
  2020-07-16  4:54 ` [PATCH 1/4] md: Fix compilation warning Damien Le Moal
  2020-07-16  4:54 ` [PATCH 2/4] md: raid5-cache: Remove set but unused variable Damien Le Moal
@ 2020-07-16  4:54 ` Damien Le Moal
  2020-07-16  4:54 ` [PATCH 4/4] md: raid10: " Damien Le Moal
  2020-07-16  5:53 ` [PATCH 0/4] Various cleanups Song Liu
  4 siblings, 0 replies; 6+ messages in thread
From: Damien Le Moal @ 2020-07-16  4:54 UTC (permalink / raw)
  To: Song Liu, linux-raid

Remove the if statement around the calls to sysfs_link_rdev() to avoid
the compilation warning "suggest braces around empty body in an ‘if’
statement" when compiling with W=1.

Also fix function description comments to avoid kdoc format warnings.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 drivers/md/raid5.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index a4fbafa5b8f8..2dad541a60da 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2217,9 +2217,9 @@ static int grow_stripes(struct r5conf *conf, int num)
 /**
  * scribble_alloc - allocate percpu scribble buffer for required size
  *		    of the scribble region
- * @percpu - from for_each_present_cpu() of the caller
- * @num - total number of disks in the array
- * @cnt - scribble objs count for required size of the scribble region
+ * @percpu: from for_each_present_cpu() of the caller
+ * @num: total number of disks in the array
+ * @cnt: scribble objs count for required size of the scribble region
  *
  * The scribble buffer size must be enough to contain:
  * 1/ a struct page pointer for each device in the array +2
@@ -3710,7 +3710,7 @@ static int fetch_block(struct stripe_head *sh, struct stripe_head_state *s,
 	return 0;
 }
 
-/**
+/*
  * handle_stripe_fill - read or compute data to satisfy pending requests.
  */
 static void handle_stripe_fill(struct stripe_head *sh,
@@ -7944,8 +7944,8 @@ static int raid5_start_reshape(struct mddev *mddev)
 					else
 						rdev->recovery_offset = 0;
 
-					if (sysfs_link_rdev(mddev, rdev))
-						/* Failure here is OK */;
+					/* Failure here is OK */
+					sysfs_link_rdev(mddev, rdev);
 				}
 			} else if (rdev->raid_disk >= conf->previous_raid_disks
 				   && !test_bit(Faulty, &rdev->flags)) {
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] md: raid10: Fix compilation warning
  2020-07-16  4:54 [PATCH 0/4] Various cleanups Damien Le Moal
                   ` (2 preceding siblings ...)
  2020-07-16  4:54 ` [PATCH 3/4] md: raid5: Fix compilation warning Damien Le Moal
@ 2020-07-16  4:54 ` Damien Le Moal
  2020-07-16  5:53 ` [PATCH 0/4] Various cleanups Song Liu
  4 siblings, 0 replies; 6+ messages in thread
From: Damien Le Moal @ 2020-07-16  4:54 UTC (permalink / raw)
  To: Song Liu, linux-raid

Remove the if statement around the call to sysfs_link_rdev() in
raid10_start_reshape() to avoid the compilation warning:

warning: suggest braces around empty body in an ‘if’ statement

when compiling with W=1.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 drivers/md/raid10.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 2c47474fa69d..14b1ba732cd7 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -4307,8 +4307,8 @@ static int raid10_start_reshape(struct mddev *mddev)
 					else
 						rdev->recovery_offset = 0;
 
-					if (sysfs_link_rdev(mddev, rdev))
-						/* Failure here  is OK */;
+					/* Failure here is OK */
+					sysfs_link_rdev(mddev, rdev);
 				}
 			} else if (rdev->raid_disk >= conf->prev.raid_disks
 				   && !test_bit(Faulty, &rdev->flags)) {
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] Various cleanups
  2020-07-16  4:54 [PATCH 0/4] Various cleanups Damien Le Moal
                   ` (3 preceding siblings ...)
  2020-07-16  4:54 ` [PATCH 4/4] md: raid10: " Damien Le Moal
@ 2020-07-16  5:53 ` Song Liu
  4 siblings, 0 replies; 6+ messages in thread
From: Song Liu @ 2020-07-16  5:53 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-raid

Hi Damien,

On Wed, Jul 15, 2020 at 9:54 PM Damien Le Moal <damien.lemoal@wdc.com> wrote:
>
> Song,
>
> These patches fix various compilation warnings showing up when
> compiling with W=1. Therer are also a lot of warnings generated by
> sparse (C=1 compilation). Working on addressing those too in a
> follow-up series.

Thanks for these fixes. Applied to md-next.

Song

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-16  5:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16  4:54 [PATCH 0/4] Various cleanups Damien Le Moal
2020-07-16  4:54 ` [PATCH 1/4] md: Fix compilation warning Damien Le Moal
2020-07-16  4:54 ` [PATCH 2/4] md: raid5-cache: Remove set but unused variable Damien Le Moal
2020-07-16  4:54 ` [PATCH 3/4] md: raid5: Fix compilation warning Damien Le Moal
2020-07-16  4:54 ` [PATCH 4/4] md: raid10: " Damien Le Moal
2020-07-16  5:53 ` [PATCH 0/4] Various cleanups Song Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).