Linux RAID subsystem development
 help / color / mirror / Atom feed
* Re: md/dm-crypt: Rename a jump label in crypt_message() ?
From: SF Markus Elfring @ 2016-09-30 11:53 UTC (permalink / raw)
  To: Bjørn Mork
  Cc: Dan Carpenter, Theodore Ts'o, dm-devel, linux-raid,
	Alasdair Kergon, Mike Snitzer, Shaohua Li, Julia Lawall,
	kernel-janitors, LKML, linux-doc
In-Reply-To: <87mvip1us4.fsf@miraculix.mork.no>

> When someone tells you that you are wasting their time,

This information can be useful to some degree


> then that is not a subject for further discussion.

I got an other impression. I guess that there are constraints for such a response
which can become interesting for further considerations.

Is it just usual that other software changes are more welcome?

Regards,
Markus

^ permalink raw reply

* Re: md/dm-crypt: Rename a jump label in crypt_message() ?
From: Dan Carpenter @ 2016-09-30 12:02 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: Theodore Ts'o, dm-devel, linux-raid, Alasdair Kergon,
	Mike Snitzer, Shaohua Li, Julia Lawall, kernel-janitors, LKML,
	linux-doc
In-Reply-To: <d9c6668b-65b3-e410-81ed-1e43c227f015@users.sourceforge.net>

On Fri, Sep 30, 2016 at 01:32:23PM +0200, SF Markus Elfring wrote:
> > I specifically did not say that "out:" or "error:" labels are bad names.
> 
> Did you inform me once that you had also a special opinion about an identifier
> like "out"?

I don't like out labels, but that's my opinion.  There is nothing in
CodingStyle which says you can't do it.

regards,
dan carpenter

^ permalink raw reply

* Re: md/dm-crypt: Rename a jump label in crypt_message() ?
From: Bjørn Mork @ 2016-09-30 12:06 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: Dan Carpenter, Theodore Ts'o, dm-devel, linux-raid,
	Alasdair Kergon, Mike Snitzer, Shaohua Li, Julia Lawall,
	kernel-janitors, LKML, linux-doc
In-Reply-To: <9d9cde54-b701-aac6-0bb8-4ba65c5046c2@users.sourceforge.net>

SF Markus Elfring <elfring@users.sourceforge.net> writes:

>> When someone tells you that you are wasting their time,
>
> This information can be useful to some degree

Yes.  If you continue discussing after that point, then you make a clear
statement that it isn't an accident.  You are deliberately wasting their
time.

A lot of people already know this.  But you're right that it would be
useful to make it even clearer.  Maybe you could add a note about it to
each patch?  Something along "I will not listen.  I will not change.
Nothing you tell me will ever make it worth your time to do so"?

Just an idea...



Bjørn

^ permalink raw reply

* Re: md/dm-crypt: Rename a jump label in crypt_message() ?
From: SF Markus Elfring @ 2016-09-30 12:19 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Theodore Ts'o, dm-devel, linux-raid, Alasdair Kergon,
	Mike Snitzer, Shaohua Li, Julia Lawall, kernel-janitors, LKML,
	linux-doc
In-Reply-To: <20160930120214.GW26713@mwanda>

> I don't like out labels, but that's my opinion.

Thanks for this acknowledgement that you have still got a special opinion
about such an identifier.

 
> There is nothing in CodingStyle which says you can't do it.

Does the terse description there try to suggest also to choose
better identifiers for source code places?

Does the meaning of such a coding style specification include also
the selection of a more pleasing identifier than "error"
for this software module?

Regards,
Markus

^ permalink raw reply

* Re: md/dm-crypt: Rename a jump label in crypt_message() ?
From: SF Markus Elfring @ 2016-09-30 12:54 UTC (permalink / raw)
  To: Bjørn Mork
  Cc: Dan Carpenter, Theodore Ts'o, dm-devel, linux-raid,
	Alasdair Kergon, Mike Snitzer, Shaohua Li, Julia Lawall,
	kernel-janitors, LKML, linux-doc
In-Reply-To: <87fuoh1tin.fsf@miraculix.mork.no>

> If you continue discussing after that point,

I guess that such a condition is not needed.


> then you make a clear statement that it isn't an accident.

I hope that most of my software development activities are not "an accident".
Is the intent for any update suggestion (like the renaming of a jump label
in this case) reasonable to some degree?


> You are deliberately wasting their time.

I imagine that I do not really try to "waste" others time. But I am trying
also to change some "things".
There are circumstances when these contributions are interpreted as "wasted efforts".
Is the change acceptance usually higher for other update patterns?


> Something along "I will not listen.

I am listening while my responses might not fit to your current expectations.


> I will not change.

I have got also some personal change opportunities.


> Nothing you tell me will ever make it worth your time to do so"?

While you can be so clear about a rejection for this software module at the moment,
other contributors showed occasionally more positive information.

Regards,
Markus

^ permalink raw reply

* Re: RAID6 - CPU At 100% Usage After Reassembly
From: Francisco Parada @ 2016-09-30 13:06 UTC (permalink / raw)
  To: Shaohua Li, mdraid, Michael J. Shaver
In-Reply-To: <CAOW94usC2AFt4uGRZRidcXN1Gii0PqSqfGAjL6_2Y1m6GAcZsg@mail.gmail.com>

Hello Shaohua and all,

Was anyone able to take a look at the trace I provided?  Curious if I
should just give up hope and start from scratch.  Any feedback is
appreciated.

Thank you,
Cisco

On Mon, Sep 26, 2016 at 10:29 AM, Francisco Parada
<advanceandconquer@gmail.com> wrote:
> Hi all,
>
> It doesn't seem like my response from last night, made it to the list:
>
>
> Hi Shaohua and all,
>
> I was finally able to upgrade my Ubuntu server to a newer version of
> the kernel and mdadm:
> ==========================
> $ uname -r; mdadm -V
>
> 4.8.0-rc7-custom
>
> mdadm - v3.4 - 28th January 2016
> ==========================
>
>
> I rebuilt the kernel with the options that Shaohua asked me to build it with:
> ======================================
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 5883ef0..db484ca 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -62,6 +62,9 @@
>  #include "raid0.h"
>  #include "bitmap.h"
>
> +#undef pr_debug
> +#define pr_debug trace_printk
> +
>  #define cpu_to_group(cpu) cpu_to_node(cpu)
>  #define ANY_GROUP NUMA_NO_NODE
> ======================================
>
>
> Here's how things look so far, nothing different yet:
> ======================================
> $ cat /proc/mdstat
> Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5]
> [raid4] [raid10]
> md127 : inactive sdd[10](S) sdk[0](S) sdj[2](S) sdh[3](S) sde[11](S)
> sdg[9](S) sdf[7](S) sdb[13](S) sdc[12](S)
>       26371219608 blocks super 1.2
>
> unused devices: <none>
> ======================================
>
>
> Here's an event snapshot of my array, just keep in mind that
> "/dev/sdi" is my failed drive, so I omitted it from the examination:
> ======================================
> # mdadm -E /dev/sd[b-h,j,k] |grep Events
>          Events : 280033
>          Events : 280033
>          Events : 280033
>          Events : 280033
>          Events : 280033
>          Events : 280033
>          Events : 280011
>          Events : 280033
>          Events : 280033
> ======================================
>
>
> It's important to note, that since I haven't done anything yet, my CPU is idle:
> ======================================
> top - 20:22:00 up  5:56,  2 users,  load average: 0.04, 0.03, 0.00
>
> Tasks: 221 total,   1 running, 220 sleeping,   0 stopped,   0 zombie
>
> %Cpu(s):  1.0 us,  1.0 sy,  0.0 ni, 97.5 id,  0.5 wa,  0.0 hi,  0.0 si,  0.0 st
>
> KiB Mem :  1525400 total,   103836 free,   696208 used,   725356 buff/cache
>
> KiB Swap: 25153532 total, 25117380 free,    36152 used.   454808 avail Mem
>  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
>  2093 cisco     20   0 1761112 153108  55640 S   1.0 10.0   0:12.61 gnome-shell
>  4322 root      20   0   40520   3684   3100 R   1.0  0.2   0:00.22 top
>     1 root      20   0  119692   5540   3992 S   0.0  0.4   0:02.44 systemd
>     2 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kthreadd
>     3 root      20   0       0      0      0 S   0.0  0.0   0:00.09 ksoftirqd/0
>     5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:
> ======================================
>
>
> Now onto the fun part.  I stopped "/dev/md127":
> ======================================
> # mdadm --stop /dev/md127
> mdadm: stopped /dev/md127
> # cat /proc/mdstat
> Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5]
> [raid4] [raid10]
> unused devices: <none>
> ======================================
>
>
> For completion, here's the trace output after stopping the array, and
> before reassembling:
> ======================================
> # tracer: nop
> #
> # entries-in-buffer/entries-written: 0/0   #P:2
> #
> #                              _-----=> irqs-off
> #                             / _----=> need-resched
> #                            | / _---=> hardirq/softirq
> #                            || / _--=> preempt-depth
> #                            ||| /     delay
> #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
> #              | |       |   ||||       |         |
> /sys/kernel/debug/tracing/trace (END)
> ======================================
>
>
> Then I reassembled the array:
> ======================================
> # mdadm -Afv /dev/md127 /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf
> /dev/sdg /dev/sdh /dev/sdj /dev/sdk
> mdadm: looking for devices for /dev/md127
> mdadm: /dev/sdb is busy - skipping
> mdadm: Merging with already-assembled /dev/md/en1
> mdadm: /dev/sdb is identified as a member of /dev/md/en1, slot 7.
> mdadm: /dev/sdc is identified as a member of /dev/md/en1, slot 8.
> mdadm: /dev/sdd is identified as a member of /dev/md/en1, slot 6.
> mdadm: /dev/sde is identified as a member of /dev/md/en1, slot 9.
> mdadm: /dev/sdf is identified as a member of /dev/md/en1, slot 4.
> mdadm: /dev/sdg is identified as a member of /dev/md/en1, slot 1.
> mdadm: /dev/sdh is identified as a member of /dev/md/en1, slot 3.
> mdadm: /dev/sdj is identified as a member of /dev/md/en1, slot 2.
> mdadm: /dev/sdk is identified as a member of /dev/md/en1, slot 0.
> mdadm: Marking array /dev/md/en1 as 'clean'
> mdadm: /dev/md/en1 has an active reshape - checking if critical
> section needs to be restored
> mdadm: No backup metadata on device-7
> mdadm: No backup metadata on device-8
> mdadm: No backup metadata on device-9
> mdadm: added /dev/sdg to /dev/md/en1 as 1
> mdadm: added /dev/sdj to /dev/md/en1 as 2
> mdadm: added /dev/sdh to /dev/md/en1 as 3 (possibly out of date)
> mdadm: added /dev/sdf to /dev/md/en1 as 4
> mdadm: no uptodate device for slot 5 of /dev/md/en1
> mdadm: added /dev/sdd to /dev/md/en1 as 6
> mdadm: /dev/sdb is already in /dev/md/en1 as 7
> mdadm: added /dev/sdc to /dev/md/en1 as 8
> mdadm: added /dev/sde to /dev/md/en1 as 9
> mdadm: added /dev/sdk to /dev/md/en1 as 0
> ======================================
>
>
> And of course, CPU shoots to 100%:
> ======================================
> top - 20:38:44 up  6:13,  3 users,  load average: 5.05, 3.25, 1.41
> Tasks: 239 total,   3 running, 236 sleeping,   0 stopped,   0 zombie
> %Cpu(s):  5.9 us, 52.7 sy,  0.0 ni,  0.0 id, 41.4 wa,  0.0 hi,  0.0 si,  0.0 st
> KiB Mem :  1525400 total,    73124 free,   739576 used,   712700 buff/cache
> KiB Swap: 25153532 total, 25111140 free,    42392 used.   415840 avail Mem
>
>  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
>  6423 root      20   0       0      0      0 R  99.0  0.0   4:43.51 md127_raid6
>  1166 root      20   0  280588   8780   6192 S   3.0  0.6   0:06.56 polkitd
>  4022 cisco     20   0  394756  32884  26064 S   3.0  2.2   0:08.77 gnome-disks
>  1903 cisco     20   0  256660  34060  26280 S   2.0  2.2   0:29.56 Xorg
>  2093 cisco     20   0 1760364 153572  55572 S   2.0 10.1   0:17.96 gnome-shell
> ======================================
>
>
> Then surely the array reshape speed goes back down to nothing:
> ======================================
> # cat /proc/mdstat
> Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5]
> [raid4] [raid10]
> md127 : active raid6 sdk[0] sde[11] sdc[12] sdd[10] sdf[7] sdj[2] sdg[9] sdb[13]
>       14650675200 blocks super 1.2 level 6, 512k chunk, algorithm 2
> [10/8] [UUU_U_UUUU]
>       [=======>.............]  reshape = 39.1% (1146348512/2930135040)
> finish=22057575.1min speed=1K/sec
>       bitmap: 0/22 pages [0KB], 65536KB chunk
>
> unused devices: <none>
> ======================================
>
>
> The size of the trace file is gigantic, so hopefully it doesn't get
> trimmed in the email, but any help would be appreciated, thanks in
> advance:
> ================
> # tracer: nop
> #
> # entries-in-buffer/entries-written: 44739/81554230   #P:2
> #
> #                              _-----=> irqs-off
> #                             / _----=> need-resched
> #                            | / _---=> hardirq/softirq
> #                            || / _--=> preempt-depth
> #                            ||| /     delay
> #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
> #              | |       |   ||||       |         |
>      md127_raid6-6423  [001] .... 22228.159918: analyse_stripe: check
> 7: state 0x13 read           (null) write           (null) written
>       (null)
>      md127_raid6-6423  [001] .... 22228.159919: analyse_stripe: check
> 6: state 0xa01 read           (null) write           (null) written
>        (null)
>      md127_raid6-6423  [001] .... 22228.159919: analyse_stripe: check
> 5: state 0x801 read           (null) write           (null) written
>        (null)
>      md127_raid6-6423  [001] .... 22228.159920: analyse_stripe: check
> 4: state 0x811 read           (null) write           (null) written
>        (null)
>      md127_raid6-6423  [001] .... 22228.159921: analyse_stripe: check
> 3: state 0x801 read           (null) write           (null) written
>        (null)
>      md127_raid6-6423  [001] .... 22228.159921: analyse_stripe: check
> 2: state 0x811 read           (null) write           (null) written
>        (null)
>      md127_raid6-6423  [001] .... 22228.159922: analyse_stripe: check
> 1: state 0xa01 read           (null) write           (null) written
>        (null)
>      md127_raid6-6423  [001] .... 22228.159923: analyse_stripe: check
> 0: state 0x811 read           (null) write           (null) written
>        (null)
>      md127_raid6-6423  [001] .... 22228.159924: handle_stripe:
> locked=2 uptodate=10 to_read=0 to_write=0 failed=4 failed_num=6,5
>      md127_raid6-6423  [001] .... 22228.159925:
> schedule_reconstruction: schedule_reconstruction: stripe 2292697672
> locked: 4 ops_request: 10
>      md127_raid6-6423  [001] .... 22228.159925: raid_run_ops:
> ops_run_reconstruct6: stripe 2292697672
>      md127_raid6-6423  [001] .... 22228.159943:
> ops_complete_reconstruct: ops_complete_reconstruct: stripe 2292697672
>      md127_raid6-6423  [001] .... 22228.159944: handle_stripe:
> handling stripe 2292697680, state=0x1401 cnt=1, pd_idx=7, qd_idx=8
> , check:0, reconstruct:6
> ===========================================
>
> I trimmed it because of the failure to send issue.  However, if
> someone needs a lengthier snip of the trace, let me know.
>
> Thanks,
>
> 'Cisco

^ permalink raw reply

* [PATCH] md: set rotational bit
From: Shaohua Li @ 2016-09-30 16:45 UTC (permalink / raw)
  To: linux-raid; +Cc: Kernel-team

if all disks in an array are non-rotational, set the array
non-rotational.

This only works for array with all disks populated at startup. Support
for disk hotadd/hotremove could be added later if necessary.

Signed-off-by: Shaohua Li <shli@fb.com>
---
 drivers/md/md.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 457b538..eac84d8 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5297,6 +5297,21 @@ int md_run(struct mddev *mddev)
 		return err;
 	}
 	if (mddev->queue) {
+		bool nonrot = true;
+
+		rdev_for_each(rdev, mddev) {
+			if (rdev->raid_disk >= 0 &&
+			    !blk_queue_nonrot(bdev_get_queue(rdev->bdev))) {
+				nonrot = false;
+				break;
+			}
+		}
+		if (mddev->degraded)
+			nonrot = false;
+		if (nonrot)
+			queue_flag_set_unlocked(QUEUE_FLAG_NONROT, mddev->queue);
+		else
+			queue_flag_clear_unlocked(QUEUE_FLAG_NONROT, mddev->queue);
 		mddev->queue->backing_dev_info.congested_data = mddev;
 		mddev->queue->backing_dev_info.congested_fn = md_congested;
 	}
-- 
2.9.3


^ permalink raw reply related

* [PATCH] md/dm-stats: Use kmalloc_array() in parse_histogram()
From: SF Markus Elfring @ 2016-10-01  4:06 UTC (permalink / raw)
  To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
  Cc: LKML, kernel-janitors, Julia Lawall

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 05:55:05 +0200

* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus use the corresponding function "kmalloc_array".

  This issue was detected by using the Coccinelle software.

* Replace the specification of a data type by a pointer dereference
  to make the corresponding size determination a bit safer according to
  the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/md/dm-stats.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-stats.c b/drivers/md/dm-stats.c
index 38b05f2..7b79425 100644
--- a/drivers/md/dm-stats.c
+++ b/drivers/md/dm-stats.c
@@ -917,7 +917,9 @@ static int parse_histogram(const char *h, unsigned *n_histogram_entries,
 		if (*q == ',')
 			(*n_histogram_entries)++;
 
-	*histogram_boundaries = kmalloc(*n_histogram_entries * sizeof(unsigned long long), GFP_KERNEL);
+	*histogram_boundaries = kmalloc_array(*n_histogram_entries,
+					      sizeof(**histogram_boundaries),
+					      GFP_KERNEL);
 	if (!*histogram_boundaries)
 		return -ENOMEM;
 
-- 
2.10.0

^ permalink raw reply related

* [PATCH 0/9] md/dm-table: Fine-tuning for several function implementations
From: SF Markus Elfring @ 2016-10-01  7:41 UTC (permalink / raw)
  To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
  Cc: LKML, kernel-janitors, Julia Lawall

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 09:35:43 +0200

Some update suggestions were taken into account
from static source code analysis.

Markus Elfring (9):
  Use kmalloc_array() in realloc_argv()
  Reduce the scope for a variable in dm_table_verify_integrity()
  Delete an unnecessary variable initialisation in dm_table_register_integrity()
  Delete an unnecessary variable initialisation in dm_split_args()
  Move an assignment for the variable "end" in dm_split_args()
  Combine substrings for ten messages
  Adjust one function call together with a variable assignment
  Delete an unwanted space in high()
  Delete an unwanted space in dm_table_get_integrity_disk()

 drivers/md/dm-table.c | 51 ++++++++++++++++++++-------------------------------
 1 file changed, 20 insertions(+), 31 deletions(-)

-- 
2.10.0


^ permalink raw reply

* [PATCH 1/9] md/dm-table: Use kmalloc_array() in realloc_argv()
From: SF Markus Elfring @ 2016-10-01  7:43 UTC (permalink / raw)
  To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
  Cc: LKML, kernel-janitors, Julia Lawall
In-Reply-To: <45984567-4421-5f8d-ddf3-eb2a769a1860@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 06:47:16 +0200

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/md/dm-table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 3e407a9..f6b817c 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -523,7 +523,7 @@ static char **realloc_argv(unsigned *array_size, char **old_argv)
 		new_size = 8;
 		gfp = GFP_NOIO;
 	}
-	argv = kmalloc(new_size * sizeof(*argv), gfp);
+	argv = kmalloc_array(new_size, sizeof(*argv), gfp);
 	if (argv) {
 		memcpy(argv, old_argv, *array_size * sizeof(*argv));
 		*array_size = new_size;
-- 
2.10.0


^ permalink raw reply related

* [PATCH 2/9] md/dm-table: Reduce the scope for a variable in dm_table_verify_integrity()
From: SF Markus Elfring @ 2016-10-01  7:44 UTC (permalink / raw)
  To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
  Cc: LKML, kernel-janitors, Julia Lawall
In-Reply-To: <45984567-4421-5f8d-ddf3-eb2a769a1860@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 07:10:43 +0200

Move the definition for the variable "template_disk" into an if branch
so that an extra initialisation can be avoided at the beginning
by this refactoring.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/md/dm-table.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index f6b817c..73d38d0 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1391,14 +1391,13 @@ int dm_calculate_queue_limits(struct dm_table *table,
  */
 static void dm_table_verify_integrity(struct dm_table *t)
 {
-	struct gendisk *template_disk = NULL;
-
 	if (t->integrity_supported) {
 		/*
 		 * Verify that the original integrity profile
 		 * matches all the devices in this table.
 		 */
-		template_disk = dm_table_get_integrity_disk(t);
+		struct gendisk *template_disk = dm_table_get_integrity_disk(t);
+
 		if (template_disk &&
 		    blk_integrity_compare(dm_disk(t->md), template_disk) >= 0)
 			return;
-- 
2.10.0


^ permalink raw reply related

* [PATCH 3/9] md/dm-table: Delete an unnecessary variable initialisation in dm_table_register_integrity()
From: SF Markus Elfring @ 2016-10-01  7:45 UTC (permalink / raw)
  To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
  Cc: LKML, kernel-janitors, Julia Lawall
In-Reply-To: <45984567-4421-5f8d-ddf3-eb2a769a1860@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 07:25:43 +0200

The local variable "template_disk" is reassigned by a statement
at the beginning. Thus omit the explicit initialisation.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/md/dm-table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 73d38d0..67cc635 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1165,7 +1165,7 @@ static struct gendisk * dm_table_get_integrity_disk(struct dm_table *t)
 static int dm_table_register_integrity(struct dm_table *t)
 {
 	struct mapped_device *md = t->md;
-	struct gendisk *template_disk = NULL;
+	struct gendisk *template_disk;
 
 	template_disk = dm_table_get_integrity_disk(t);
 	if (!template_disk)
-- 
2.10.0


^ permalink raw reply related

* [PATCH 4/9] md/dm-table: Delete an unnecessary variable initialisation in dm_split_args()
From: SF Markus Elfring @ 2016-10-01  7:46 UTC (permalink / raw)
  To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
  Cc: LKML, kernel-janitors, Julia Lawall
In-Reply-To: <45984567-4421-5f8d-ddf3-eb2a769a1860@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 07:37:27 +0200

The local variable "argv" will be set to an appropriate pointer
a bit later. Thus omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/md/dm-table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 67cc635..e74763c 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -538,7 +538,7 @@ static char **realloc_argv(unsigned *array_size, char **old_argv)
  */
 int dm_split_args(int *argc, char ***argvp, char *input)
 {
-	char *start, *end = input, *out, **argv = NULL;
+	char *start, *end = input, *out, **argv;
 	unsigned array_size = 0;
 
 	*argc = 0;
-- 
2.10.0


^ permalink raw reply related

* [PATCH 5/9] md/dm-table: Move an assignment for the variable "end" in dm_split_args()
From: SF Markus Elfring @ 2016-10-01  7:47 UTC (permalink / raw)
  To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
  Cc: LKML, kernel-janitors, Julia Lawall
In-Reply-To: <45984567-4421-5f8d-ddf3-eb2a769a1860@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 07:51:55 +0200

Move the assignment for the local variable "end" behind the source code
for the initial two condition checks by this function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/md/dm-table.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index e74763c..0f60417 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -538,7 +538,7 @@ static char **realloc_argv(unsigned *array_size, char **old_argv)
  */
 int dm_split_args(int *argc, char ***argvp, char *input)
 {
-	char *start, *end = input, *out, **argv;
+	char *start, *end, *out, **argv;
 	unsigned array_size = 0;
 
 	*argc = 0;
@@ -552,6 +552,7 @@ int dm_split_args(int *argc, char ***argvp, char *input)
 	if (!argv)
 		return -ENOMEM;
 
+	end = input;
 	while (1) {
 		/* Skip whitespace */
 		start = skip_spaces(end);
-- 
2.10.0

^ permalink raw reply related

* [PATCH 6/9] md/dm-table: Combine substrings for ten messages
From: SF Markus Elfring @ 2016-10-01  7:48 UTC (permalink / raw)
  To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
  Cc: LKML, kernel-janitors, Julia Lawall
In-Reply-To: <45984567-4421-5f8d-ddf3-eb2a769a1860@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 08:39:58 +0200

The script "checkpatch.pl" pointed information out like the following.

WARNING: quoted string split across lines

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/md/dm-table.c | 32 ++++++++++----------------------
 1 file changed, 10 insertions(+), 22 deletions(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 0f60417..9b7d8b7 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -296,8 +296,7 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
 	 */
 	q = bdev_get_queue(bdev);
 	if (!q || !q->make_request_fn) {
-		DMWARN("%s: %s is not yet initialised: "
-		       "start=%llu, len=%llu, dev_size=%llu",
+		DMWARN("%s: %s is not yet initialised: start=%llu, len=%llu, dev_size=%llu",
 		       dm_device_name(ti->table->md), bdevname(bdev, b),
 		       (unsigned long long)start,
 		       (unsigned long long)len,
@@ -309,8 +308,7 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
 		return 0;
 
 	if ((start >= dev_size) || (start + len > dev_size)) {
-		DMWARN("%s: %s too small for target: "
-		       "start=%llu, len=%llu, dev_size=%llu",
+		DMWARN("%s: %s too small for target: start=%llu, len=%llu, dev_size=%llu",
 		       dm_device_name(ti->table->md), bdevname(bdev, b),
 		       (unsigned long long)start,
 		       (unsigned long long)len,
@@ -322,8 +320,7 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
 		return 0;
 
 	if (start & (logical_block_size_sectors - 1)) {
-		DMWARN("%s: start=%llu not aligned to h/w "
-		       "logical block size %u of %s",
+		DMWARN("%s: start=%llu not aligned to h/w logical block size %u of %s",
 		       dm_device_name(ti->table->md),
 		       (unsigned long long)start,
 		       limits->logical_block_size, bdevname(bdev, b));
@@ -331,8 +328,7 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
 	}
 
 	if (len & (logical_block_size_sectors - 1)) {
-		DMWARN("%s: len=%llu not aligned to h/w "
-		       "logical block size %u of %s",
+		DMWARN("%s: len=%llu not aligned to h/w logical block size %u of %s",
 		       dm_device_name(ti->table->md),
 		       (unsigned long long)len,
 		       limits->logical_block_size, bdevname(bdev, b));
@@ -446,9 +442,7 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
 	}
 
 	if (bdev_stack_limits(limits, bdev, start) < 0)
-		DMWARN("%s: adding target device %s caused an alignment inconsistency: "
-		       "physical_block_size=%u, logical_block_size=%u, "
-		       "alignment_offset=%u, start=%llu",
+		DMWARN("%s: adding target device %s caused an alignment inconsistency: physical_block_size=%u, logical_block_size=%u, alignment_offset=%u, start=%llu",
 		       dm_device_name(ti->table->md), bdevname(bdev, b),
 		       q->limits.physical_block_size,
 		       q->limits.logical_block_size,
@@ -659,8 +653,7 @@ static int validate_hardware_logical_block_alignment(struct dm_table *table,
 	}
 
 	if (remaining) {
-		DMWARN("%s: table line %u (start sect %llu len %llu) "
-		       "not aligned to h/w logical block size %u",
+		DMWARN("%s: table line %u (start sect %llu len %llu) not aligned to h/w logical block size %u",
 		       dm_device_name(table->md), i,
 		       (unsigned long long) ti->begin,
 		       (unsigned long long) ti->len,
@@ -902,8 +895,7 @@ static int dm_table_determine_type(struct dm_table *t)
 			bio_based = 1;
 
 		if (bio_based && request_based) {
-			DMWARN("Inconsistent table: different target types"
-			       " can't be mixed up");
+			DMWARN("Inconsistent table: different target types can't be mixed up");
 			return -EINVAL;
 		}
 	}
@@ -960,8 +952,7 @@ static int dm_table_determine_type(struct dm_table *t)
 		struct request_queue *q = bdev_get_queue(dd->dm_dev->bdev);
 
 		if (!blk_queue_stackable(q)) {
-			DMERR("table load rejected: including"
-			      " non-request-stackable devices");
+			DMERR("table load rejected: including non-request-stackable devices");
 			return -EINVAL;
 		}
 
@@ -973,8 +964,7 @@ static int dm_table_determine_type(struct dm_table *t)
 		/* verify _all_ devices in the table are blk-mq devices */
 		list_for_each_entry(dd, devices, list)
 			if (!bdev_get_queue(dd->dm_dev->bdev)->mq_ops) {
-				DMERR("table load rejected: not all devices"
-				      " are blk-mq request-stackable");
+				DMERR("table load rejected: not all devices are blk-mq request-stackable");
 				return -EINVAL;
 			}
 
@@ -1374,9 +1364,7 @@ int dm_calculate_queue_limits(struct dm_table *table,
 		 * for the table.
 		 */
 		if (blk_stack_limits(limits, &ti_limits, 0) < 0)
-			DMWARN("%s: adding target device "
-			       "(start sect %llu len %llu) "
-			       "caused an alignment inconsistency",
+			DMWARN("%s: adding target device (start sect %llu len %llu) caused an alignment inconsistency",
 			       dm_device_name(table->md),
 			       (unsigned long long) ti->begin,
 			       (unsigned long long) ti->len);
-- 
2.10.0


^ permalink raw reply related

* [PATCH 7/9] md/dm-table: Adjust one function call together with a variable assignment
From: SF Markus Elfring @ 2016-10-01  7:50 UTC (permalink / raw)
  To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
  Cc: LKML, kernel-janitors, Julia Lawall
In-Reply-To: <45984567-4421-5f8d-ddf3-eb2a769a1860@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 08:53:37 +0200

The script "checkpatch.pl" pointed information out like the following.

ERROR: do not use assignment in if condition

Thus fix the affected source code place.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/md/dm-table.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 9b7d8b7..40dde87 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -407,7 +407,8 @@ int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
 		if (!dd)
 			return -ENOMEM;
 
-		if ((r = dm_get_table_device(t->md, dev, mode, &dd->dm_dev))) {
+		r = dm_get_table_device(t->md, dev, mode, &dd->dm_dev);
+		if (r) {
 			kfree(dd);
 			return r;
 		}
-- 
2.10.0


^ permalink raw reply related

* [PATCH 8/9] md/dm-table: Delete an unwanted space in high()
From: SF Markus Elfring @ 2016-10-01  7:52 UTC (permalink / raw)
  To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
  Cc: LKML, kernel-janitors, Julia Lawall
In-Reply-To: <45984567-4421-5f8d-ddf3-eb2a769a1860@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 09:04:06 +0200

The script "checkpatch.pl" pointed information out like the following.

ERROR: space prohibited after that '-' (ctx:WxW)

Thus fix the affected source code place.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/md/dm-table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 40dde87..a948ffb 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -109,7 +109,7 @@ static sector_t high(struct dm_table *t, unsigned int l, unsigned int n)
 		n = get_child(n, CHILDREN_PER_NODE - 1);
 
 	if (n >= t->counts[l])
-		return (sector_t) - 1;
+		return (sector_t) -1;
 
 	return get_node(t, l, n)[KEYS_PER_NODE - 1];
 }
-- 
2.10.0


^ permalink raw reply related

* [PATCH 9/9] md/dm-table: Delete an unwanted space in dm_table_get_integrity_disk()
From: SF Markus Elfring @ 2016-10-01  7:53 UTC (permalink / raw)
  To: dm-devel, linux-raid, Alasdair Kergon, Mike Snitzer, Shaohua Li
  Cc: LKML, kernel-janitors, Julia Lawall
In-Reply-To: <45984567-4421-5f8d-ddf3-eb2a769a1860@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 09:24:56 +0200

The script "checkpatch.pl" pointed information out like the following.

ERROR: "foo * bar" should be "foo *bar"

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/md/dm-table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index a948ffb..3ad1b1a 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1117,7 +1117,7 @@ static bool integrity_profile_exists(struct gendisk *disk)
  * Get a disk whose integrity profile reflects the table's profile.
  * Returns NULL if integrity support was inconsistent or unavailable.
  */
-static struct gendisk * dm_table_get_integrity_disk(struct dm_table *t)
+static struct gendisk *dm_table_get_integrity_disk(struct dm_table *t)
 {
 	struct list_head *devices = dm_table_get_devices(t);
 	struct dm_dev_internal *dd = NULL;
-- 
2.10.0


^ permalink raw reply related

* Re: [PATCH] md: set rotational bit
From: Tejun Heo @ 2016-10-01 10:50 UTC (permalink / raw)
  To: Shaohua Li; +Cc: linux-raid, Kernel-team
In-Reply-To: <475298bb0650722bf38a2bf0d260a20579ee14e3.1475253807.git.shli@fb.com>

On Fri, Sep 30, 2016 at 09:45:40AM -0700, Shaohua Li wrote:
> if all disks in an array are non-rotational, set the array
> non-rotational.
> 
> This only works for array with all disks populated at startup. Support
> for disk hotadd/hotremove could be added later if necessary.
> 
> Signed-off-by: Shaohua Li <shli@fb.com>

FWIW,

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.

-- 
tejun

^ permalink raw reply

* [PATCH 00/15] md-cluster: Fine-tuning for ten function implementations
From: SF Markus Elfring @ 2016-10-01 14:44 UTC (permalink / raw)
  To: linux-raid, Guoqing Jiang, Shaohua Li; +Cc: LKML, kernel-janitors, Julia Lawall
In-Reply-To: <566ABCD9.1060404@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 16:38:17 +0200

Several update suggestions were taken into account
from static source code analysis.

Markus Elfring (15):
  Use kcalloc() in lock_all_bitmaps()
  Improve another size determination in resync_info_update()
  Improve another size determination in join()
  Improve another size determination in __sendmsg()
  Improve another size determination in recv_daemon()
  Rename a jump label in recv_daemon()
  Improve another size determination in process_suspend_info()
  Improve determination of sizes in read_resync_info()
  Improve another size determination in lockres_init()
  Delete an unnecessary variable initialisation in lockres_init()
  Delete four error messages for a failed memory allocation
  Rename a jump label in area_resyncing()
  Less function calls in join() after error detection
  Less function calls in lockres_init() after error detection
  Delete unnecessary braces in unlock_all_bitmaps()

 drivers/md/md-cluster.c | 114 ++++++++++++++++++++++++------------------------
 1 file changed, 56 insertions(+), 58 deletions(-)

-- 
2.10.0

^ permalink raw reply

* [PATCH 01/15] md-cluster: Use kcalloc() in lock_all_bitmaps()
From: SF Markus Elfring @ 2016-10-01 14:46 UTC (permalink / raw)
  To: linux-raid, Guoqing Jiang, Shaohua Li; +Cc: LKML, kernel-janitors, Julia Lawall
In-Reply-To: <3a03df66-92ce-20fb-17f3-fb79b9d43c8e@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 11:18:40 +0200

* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus reuse the corresponding function "kcalloc".

  This issue was detected by using the Coccinelle software.

* Replace the specification of a data type by a pointer dereference
  to make the corresponding size determination a bit safer according to
  the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/md/md-cluster.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 2b13117..0000e3a 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -1188,9 +1188,10 @@ static int lock_all_bitmaps(struct mddev *mddev)
 	char str[64];
 	struct md_cluster_info *cinfo = mddev->cluster_info;
 
-	cinfo->other_bitmap_lockres = kzalloc((mddev->bitmap_info.nodes - 1) *
-					     sizeof(struct dlm_lock_resource *),
-					     GFP_KERNEL);
+	cinfo->other_bitmap_lockres = kcalloc(mddev->bitmap_info.nodes - 1,
+					      sizeof(*cinfo
+						     ->other_bitmap_lockres),
+					      GFP_KERNEL);
 	if (!cinfo->other_bitmap_lockres) {
 		pr_err("md: can't alloc mem for other bitmap locks\n");
 		return 0;
-- 
2.10.0

^ permalink raw reply related

* [PATCH 02/15] md-cluster: Improve another size determination in resync_info_update()
From: SF Markus Elfring @ 2016-10-01 14:47 UTC (permalink / raw)
  To: linux-raid, Guoqing Jiang, Shaohua Li; +Cc: LKML, kernel-janitors, Julia Lawall
In-Reply-To: <3a03df66-92ce-20fb-17f3-fb79b9d43c8e@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 11:37:24 +0200

Replace the specification of a data structure by a variable name
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/md/md-cluster.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 0000e3a..c28f596 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -1057,7 +1057,7 @@ static int resync_info_update(struct mddev *mddev, sector_t lo, sector_t hi)
 
 	/* do not send zero again, if we have sent before */
 	if (hi == 0) {
-		memcpy(&ri, cinfo->bitmap_lockres->lksb.sb_lvbptr, sizeof(struct resync_info));
+		memcpy(&ri, cinfo->bitmap_lockres->lksb.sb_lvbptr, sizeof(ri));
 		if (le64_to_cpu(ri.hi) == 0)
 			return 0;
 	}
-- 
2.10.0


^ permalink raw reply related

* [PATCH 03/15] md-cluster: Improve another size determination in join()
From: SF Markus Elfring @ 2016-10-01 14:48 UTC (permalink / raw)
  To: linux-raid, Guoqing Jiang, Shaohua Li; +Cc: LKML, kernel-janitors, Julia Lawall
In-Reply-To: <3a03df66-92ce-20fb-17f3-fb79b9d43c8e@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 11:42:47 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/md/md-cluster.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index c28f596..7af27dd 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -823,7 +823,7 @@ static int join(struct mddev *mddev, int nodes)
 	int ret, ops_rv;
 	char str[64];
 
-	cinfo = kzalloc(sizeof(struct md_cluster_info), GFP_KERNEL);
+	cinfo = kzalloc(sizeof(*cinfo), GFP_KERNEL);
 	if (!cinfo)
 		return -ENOMEM;
 
-- 
2.10.0


^ permalink raw reply related

* [PATCH 04/15] md-cluster: Improve another size determination in __sendmsg()
From: SF Markus Elfring @ 2016-10-01 14:49 UTC (permalink / raw)
  To: linux-raid, Guoqing Jiang, Shaohua Li; +Cc: LKML, kernel-janitors, Julia Lawall
In-Reply-To: <3a03df66-92ce-20fb-17f3-fb79b9d43c8e@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 12:21:48 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/md/md-cluster.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 7af27dd..c81eed4 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -706,7 +706,7 @@ static int __sendmsg(struct md_cluster_info *cinfo, struct cluster_msg *cmsg)
 	}
 
 	memcpy(cinfo->message_lockres->lksb.sb_lvbptr, (void *)cmsg,
-			sizeof(struct cluster_msg));
+	       sizeof(*cmsg));
 	/*down-convert EX to CW on Message*/
 	error = dlm_lock_sync(cinfo->message_lockres, DLM_LOCK_CW);
 	if (error) {
-- 
2.10.0

^ permalink raw reply related

* [PATCH 05/15] md-cluster: Improve another size determination in recv_daemon()
From: SF Markus Elfring @ 2016-10-01 14:50 UTC (permalink / raw)
  To: linux-raid, Guoqing Jiang, Shaohua Li; +Cc: LKML, kernel-janitors, Julia Lawall
In-Reply-To: <3a03df66-92ce-20fb-17f3-fb79b9d43c8e@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 12:28:19 +0200

Replace the specification of a data structure by a variable name
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/md/md-cluster.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index c81eed4..adf9555 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -617,7 +617,7 @@ static void recv_daemon(struct md_thread *thread)
 	}
 
 	/* read lvb and wake up thread to process this message_lockres */
-	memcpy(&msg, message_lockres->lksb.sb_lvbptr, sizeof(struct cluster_msg));
+	memcpy(&msg, message_lockres->lksb.sb_lvbptr, sizeof(msg));
 	ret = process_recvd_msg(thread->mddev, &msg);
 	if (ret)
 		goto out;
-- 
2.10.0


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox