Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1634454 > unrolled thread

[PATCH 0/6] md: Fine-tuning for some function implementations

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-05-02 16:30 +0200
Last post2017-05-03 09:40 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/6] md: Fine-tuning for some function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-02 16:30 +0200
    [PATCH 6/6] md: Add some spaces for better code readability SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-02 16:40 +0200
    Re: [PATCH 0/6] md: Fine-tuning for some function implementations NeilBrown <neilb@suse.com> - 2017-05-02 23:40 +0200
      Re: [PATCH 0/6] md: Fine-tuning for some function implementations Nikola Pajkovsky <npajkovsky@suse.cz> - 2017-05-03 09:40 +0200

#1634454 — [PATCH 0/6] md: Fine-tuning for some function implementations

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-02 16:30 +0200
Subject[PATCH 0/6] md: Fine-tuning for some function implementations
Message-ID<tCGYp-7Na-3@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 2 May 2017 16:12:34 +0200

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

Markus Elfring (6):
  Replace seven seq_printf() calls by seq_putc()
  Replace 17 seq_printf() calls by seq_puts()
  Adjust four function calls together with a variable assignment
  Use seq_puts() in faulty_status()
  Adjust six function calls together with a variable assignment in faulty_status()
  Add some spaces for better code readability

 drivers/md/faulty.c | 48 ++++++++++++++++++++++----------------
 drivers/md/md.c     | 66 +++++++++++++++++++++++++++++------------------------
 2 files changed, 64 insertions(+), 50 deletions(-)

-- 
2.12.2

[toc] | [next] | [standalone]


#1634459 — [PATCH 6/6] md: Add some spaces for better code readability

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-02 16:40 +0200
Subject[PATCH 6/6] md: Add some spaces for better code readability
Message-ID<tCH85-7Q0-5@gated-at.bofh.it>
In reply to#1634454
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 2 May 2017 16:00:45 +0200

Use space characters and blank lines at some source code places
according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/md/faulty.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c
index 2573009b1265..434c3643c9c3 100644
--- a/drivers/md/faulty.c
+++ b/drivers/md/faulty.c
@@ -110,19 +110,20 @@ static int check_sector(struct faulty_conf *conf, sector_t start, sector_t end,
 {
 	/* If we find a ReadFixable sector, we fix it ... */
 	int i;
-	for (i=0; i<conf->nfaults; i++)
+
+	for (i = 0; i < conf->nfaults; i++)
 		if (conf->faults[i] >= start &&
 		    conf->faults[i] < end) {
 			/* found it ... */
 			switch (conf->modes[i] * 2 + dir) {
-			case WritePersistent*2+WRITE: return 1;
-			case ReadPersistent*2+READ: return 1;
-			case ReadFixable*2+READ: return 1;
-			case ReadFixable*2+WRITE:
+			case WritePersistent * 2 + WRITE: return 1;
+			case ReadPersistent * 2 + READ: return 1;
+			case ReadFixable * 2 + READ: return 1;
+			case ReadFixable * 2 + WRITE:
 				conf->modes[i] = NoPersist;
 				return 0;
-			case AllPersist*2+READ:
-			case AllPersist*2+WRITE: return 1;
+			case AllPersist * 2 + READ:
+			case AllPersist * 2 + WRITE: return 1;
 			default:
 				return 0;
 			}
@@ -134,9 +135,10 @@ static void add_sector(struct faulty_conf *conf, sector_t start, int mode)
 {
 	int i;
 	int n = conf->nfaults;
-	for (i=0; i<conf->nfaults; i++)
+
+	for (i = 0; i < conf->nfaults; i++)
 		if (conf->faults[i] == start) {
-			switch(mode) {
+			switch (mode) {
 			case NoPersist: conf->modes[i] = mode; return;
 			case WritePersistent:
 				if (conf->modes[i] == ReadPersistent ||
@@ -167,7 +169,7 @@ static void add_sector(struct faulty_conf *conf, sector_t start, int mode)
 	conf->faults[n] = start;
 	conf->modes[n] = mode;
 	if (conf->nfaults == n)
-		conf->nfaults = n+1;
+		conf->nfaults = n + 1;
 }
 
 static void faulty_make_request(struct mddev *mddev, struct bio *bio)
@@ -278,7 +280,8 @@ static int faulty_reshape(struct mddev *mddev)
 		conf->nfaults = 0;
 	else if (mode == ClearErrors) {
 		int i;
-		for (i=0 ; i < Modes ; i++) {
+
+		for (i = 0; i < Modes; i++) {
 			conf->period[i] = 0;
 			atomic_set(&conf->counters[i], 0);
 		}
@@ -317,7 +320,7 @@ static int faulty_run(struct mddev *mddev)
 	if (!conf)
 		return -ENOMEM;
 
-	for (i=0; i<Modes; i++) {
+	for (i = 0; i < Modes; i++) {
 		atomic_set(&conf->counters[i], 0);
 		conf->period[i] = 0;
 	}
-- 
2.12.2

[toc] | [prev] | [next] | [standalone]


#1634629

FromNeilBrown <neilb@suse.com>
Date2017-05-02 23:40 +0200
Message-ID<tCNGx-3EW-1@gated-at.bofh.it>
In reply to#1634454

[Multipart message — attachments visible in raw view] — view raw

On Tue, May 02 2017, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 2 May 2017 16:12:34 +0200
>
> Some update suggestions were taken into account
> from static source code analysis.
>
> Markus Elfring (6):
>   Replace seven seq_printf() calls by seq_putc()
>   Replace 17 seq_printf() calls by seq_puts()

Why does anyone care whether printf or putc/puts is used?  Really it
doesn't matter *at* *all*.
I don't object to the patch but if it would up to me I probably wouldn't
bother applying it it either.
Sometimes I just want to "print" something and I don't want to care
whether it is a constant string or a single-byte constant string, or
something more general.
I see these changes as worse than white-space fixes.

NeilBrown


>   Adjust four function calls together with a variable assignment
>   Use seq_puts() in faulty_status()
>   Adjust six function calls together with a variable assignment in faulty_status()
>   Add some spaces for better code readability
>
>  drivers/md/faulty.c | 48 ++++++++++++++++++++++----------------
>  drivers/md/md.c     | 66 +++++++++++++++++++++++++++++------------------------
>  2 files changed, 64 insertions(+), 50 deletions(-)
>
> -- 
> 2.12.2

[toc] | [prev] | [next] | [standalone]


#1634788

FromNikola Pajkovsky <npajkovsky@suse.cz>
Date2017-05-03 09:40 +0200
Message-ID<tCX3c-1Uk-7@gated-at.bofh.it>
In reply to#1634629
NeilBrown <neilb@suse.com> writes:

> On Tue, May 02 2017, SF Markus Elfring wrote:
>
>> From: Markus Elfring <elfring@users.sourceforge.net>
>> Date: Tue, 2 May 2017 16:12:34 +0200
>>
>> Some update suggestions were taken into account
>> from static source code analysis.
>>
>> Markus Elfring (6):
>>   Replace seven seq_printf() calls by seq_putc()
>>   Replace 17 seq_printf() calls by seq_puts()
>
> Why does anyone care whether printf or putc/puts is used?  Really it
> doesn't matter *at* *all*.

It could matter, but this patchset does not state it all. Does not
have any perf tests and so on.

f7a5f132b447 ("proc: faster /proc/*/status")
68ba0326b4e1 ("proc: much faster /proc/vmstat")

> I don't object to the patch but if it would up to me I probably wouldn't
> bother applying it it either.
> Sometimes I just want to "print" something and I don't want to care
> whether it is a constant string or a single-byte constant string, or
> something more general.
> I see these changes as worse than white-space fixes.
>
> NeilBrown
>
>
>>   Adjust four function calls together with a variable assignment
>>   Use seq_puts() in faulty_status()
>>   Adjust six function calls together with a variable assignment in faulty_status()
>>   Add some spaces for better code readability
>>
>>  drivers/md/faulty.c | 48 ++++++++++++++++++++++----------------
>>  drivers/md/md.c     | 66 +++++++++++++++++++++++++++++------------------------
>>  2 files changed, 64 insertions(+), 50 deletions(-)
>>
>> -- 
>> 2.12.2


-- 
Nikola

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web