Re: [dm-devel] [PATCH] multipath-tools: beautify path_latency.c code

2017-08-05 Thread Bart Van Assche
Hello Christophe,

Thanks for asking. I have one pending patch for which I have not yet had the 
time to post it on the dm-devel mailing list but it does not affect the 
libmultipath/prioritizers/path_latency.c source file. So please proceed with 
merging Xose's patch.

Bart.

On Fri, 2017-08-04 at 19:18 +0200, Christophe Varoqui wrote:
Bart,

Do you have pending patches on this file you'd like to submit before I merge 
this l'indentation patch ?

Regards,
Christophe

Le 4 août 2017 18:39, "Xose Vazquez Perez" 
> a écrit :
On 06/22/2017 06:46 PM, Xose Vazquez Perez wrote:

> Mainly running scripts/Lindent, from kernel dir, to replace indent spaces
> by tabs.

Patch missing in last merge.

> Cc: Yang Feng >
> Cc: Christophe Varoqui 
> >
> Cc: device-mapper development 
> >
> Signed-off-by: Xose Vazquez Perez 
> >
> ---
>  libmultipath/prioritizers/path_latency.c | 354 
> +++
>  1 file changed, 177 insertions(+), 177 deletions(-)
>
> diff --git a/libmultipath/prioritizers/path_latency.c 
> b/libmultipath/prioritizers/path_latency.c
> index 34b734b..9fc2dfc 100644
> --- a/libmultipath/prioritizers/path_latency.c
> +++ b/libmultipath/prioritizers/path_latency.c
> @@ -17,8 +17,8 @@
>   * Author(s): Yang Feng 
> >
>   *
>   * This file is released under the GPL version 2, or any later version.
> - *
>   */
> +
>  #include 
>  #include 
>  #include 
> @@ -31,27 +31,28 @@
>
>  #define pp_pl_log(prio, fmt, args...) condlog(prio, "path_latency prio: " 
> fmt, ##args)
>
> -#define MAX_IO_NUM  200
> -#define MIN_IO_NUM  2
> +#define MAX_IO_NUM   200
> +#define MIN_IO_NUM   2
>
> -#define MAX_BASE_NUM10
> -#define MIN_BASE_NUM2
> +#define MAX_BASE_NUM 10
> +#define MIN_BASE_NUM 2
>
> -#define MAX_AVG_LATENCY 1.  /*Unit: us*/
> -#define MIN_AVG_LATENCY 1.  /*Unit: us*/
> +#define MAX_AVG_LATENCY  1.  /* Unit: us */
> +#define MIN_AVG_LATENCY  1.  /* Unit: us */
>
> -#define DEFAULT_PRIORITY0
> +#define DEFAULT_PRIORITY 0
>
> -#define MAX_CHAR_SIZE   30
> +#define MAX_CHAR_SIZE30
>
> -#define USEC_PER_SEC100LL
> -#define NSEC_PER_USEC   1000LL
> +#define USEC_PER_SEC 100LL
> +#define NSEC_PER_USEC1000LL
>
>  static long long path_latency[MAX_IO_NUM];
>
>  static inline long long timeval_to_us(const struct timespec *tv)
>  {
> - return ((long long) tv->tv_sec * USEC_PER_SEC) + (tv->tv_nsec / 
> NSEC_PER_USEC);
> + return ((long long)tv->tv_sec * USEC_PER_SEC) +
> + (tv->tv_nsec / NSEC_PER_USEC);
>  }
>
>  static int do_readsector0(int fd, unsigned int timeout)
> @@ -60,198 +61,197 @@ static int do_readsector0(int fd, unsigned int timeout)
>   unsigned char sbuf[SENSE_BUFF_LEN];
>   int ret;
>
> - ret = sg_read(fd, [0], 4096, [0],
> -   SENSE_BUFF_LEN, timeout);
> + ret = sg_read(fd, [0], 4096, [0], SENSE_BUFF_LEN, timeout);
>
>   return ret;
>  }
>
>  int check_args_valid(int io_num, int base_num)
>  {
> -if ((io_num < MIN_IO_NUM) || (io_num > MAX_IO_NUM))
> -{
> -pp_pl_log(0, "args io_num is outside the valid range");
> -return 0;
> -}
> -
> -if ((base_num < MIN_BASE_NUM) || (base_num > MAX_BASE_NUM))
> -{
> -pp_pl_log(0, "args base_num is outside the valid range");
> -return 0;
> -}
> -
> -return 1;
> + if ((io_num < MIN_IO_NUM) || (io_num > MAX_IO_NUM)) {
> + pp_pl_log(0, "args io_num is outside the valid range");
> + return 0;
> + }
> +
> + if ((base_num < MIN_BASE_NUM) || (base_num > MAX_BASE_NUM)) {
> + pp_pl_log(0, "args base_num is outside the valid range");
> + return 0;
> + }
> +
> + return 1;
>  }
>
> -/* In multipath.conf, args form: io_num|base_num. For example,
> -*  args is "20|10", this function can get io_num value 20, and
> -   base_num value 10.
> -*/
> -static int get_ionum_and_basenum(char *args,
> - int *ionum,
> - int *basenum)
> +/*
> + * In multipath.conf, args form: io_num|base_num. For example,
> + * args is "20|10", this function can get io_num value 20, and
> + * base_num value 10.
> + */
> +static int get_ionum_and_basenum(char *args, int *ionum, int *basenum)
>  {
> -char source[MAX_CHAR_SIZE];
> -char vertica = '|';
> -char *endstrbefore = NULL;
> -char *endstrafter = NULL;
> -unsigned int size = strlen(args);
> -
> -if ((args 

Re: [dm-devel] [PATCH] multipath-tools: beautify path_latency.c code

2017-08-05 Thread Christophe Varoqui
Ok, done.

On Fri, Aug 4, 2017 at 7:24 PM, Bart Van Assche 
wrote:

> Hello Christophe,
>
> Thanks for asking. I have one pending patch for which I have not yet had
> the time to post it on the dm-devel mailing list but it does not affect the
> libmultipath/prioritizers/path_latency.c source file. So please proceed
> with merging Xose's patch.
>
> Bart.
>
> On Fri, 2017-08-04 at 19:18 +0200, Christophe Varoqui wrote:
>
> Bart,
>
> Do you have pending patches on this file you'd like to submit before I
> merge this l'indentation patch ?
>
> Regards,
> Christophe
>
> Le 4 août 2017 18:39, "Xose Vazquez Perez"  a
> écrit :
>
> On 06/22/2017 06:46 PM, Xose Vazquez Perez wrote:
>
> > Mainly running scripts/Lindent, from kernel dir, to replace indent spaces
> > by tabs.
>
> Patch missing in last merge.
>
> > Cc: Yang Feng 
> > Cc: Christophe Varoqui 
> > Cc: device-mapper development 
> > Signed-off-by: Xose Vazquez Perez 
> > ---
> >  libmultipath/prioritizers/path_latency.c | 354
> +++
> >  1 file changed, 177 insertions(+), 177 deletions(-)
> >
> > diff --git a/libmultipath/prioritizers/path_latency.c
> b/libmultipath/prioritizers/path_latency.c
> > index 34b734b..9fc2dfc 100644
> > --- a/libmultipath/prioritizers/path_latency.c
> > +++ b/libmultipath/prioritizers/path_latency.c
> > @@ -17,8 +17,8 @@
> >   * Author(s): Yang Feng 
> >   *
> >   * This file is released under the GPL version 2, or any later version.
> > - *
> >   */
> > +
> >  #include 
> >  #include 
> >  #include 
> > @@ -31,27 +31,28 @@
> >
> >  #define pp_pl_log(prio, fmt, args...) condlog(prio, "path_latency prio:
> " fmt, ##args)
> >
> > -#define MAX_IO_NUM  200
> > -#define MIN_IO_NUM  2
> > +#define MAX_IO_NUM   200
> > +#define MIN_IO_NUM   2
> >
> > -#define MAX_BASE_NUM10
> > -#define MIN_BASE_NUM2
> > +#define MAX_BASE_NUM 10
> > +#define MIN_BASE_NUM 2
> >
> > -#define MAX_AVG_LATENCY 1.  /*Unit: us*/
> > -#define MIN_AVG_LATENCY 1.  /*Unit: us*/
> > +#define MAX_AVG_LATENCY  1.  /* Unit: us */
> > +#define MIN_AVG_LATENCY  1.  /* Unit: us */
> >
> > -#define DEFAULT_PRIORITY0
> > +#define DEFAULT_PRIORITY 0
> >
> > -#define MAX_CHAR_SIZE   30
> > +#define MAX_CHAR_SIZE30
> >
> > -#define USEC_PER_SEC100LL
> > -#define NSEC_PER_USEC   1000LL
> > +#define USEC_PER_SEC 100LL
> > +#define NSEC_PER_USEC1000LL
> >
> >  static long long path_latency[MAX_IO_NUM];
> >
> >  static inline long long timeval_to_us(const struct timespec *tv)
> >  {
> > - return ((long long) tv->tv_sec * USEC_PER_SEC) + (tv->tv_nsec /
> NSEC_PER_USEC);
> > + return ((long long)tv->tv_sec * USEC_PER_SEC) +
> > + (tv->tv_nsec / NSEC_PER_USEC);
> >  }
> >
> >  static int do_readsector0(int fd, unsigned int timeout)
> > @@ -60,198 +61,197 @@ static int do_readsector0(int fd, unsigned int
> timeout)
> >   unsigned char sbuf[SENSE_BUFF_LEN];
> >   int ret;
> >
> > - ret = sg_read(fd, [0], 4096, [0],
> > -   SENSE_BUFF_LEN, timeout);
> > + ret = sg_read(fd, [0], 4096, [0], SENSE_BUFF_LEN,
> timeout);
> >
> >   return ret;
> >  }
> >
> >  int check_args_valid(int io_num, int base_num)
> >  {
> > -if ((io_num < MIN_IO_NUM) || (io_num > MAX_IO_NUM))
> > -{
> > -pp_pl_log(0, "args io_num is outside the valid range");
> > -return 0;
> > -}
> > -
> > -if ((base_num < MIN_BASE_NUM) || (base_num > MAX_BASE_NUM))
> > -{
> > -pp_pl_log(0, "args base_num is outside the valid range");
> > -return 0;
> > -}
> > -
> > -return 1;
> > + if ((io_num < MIN_IO_NUM) || (io_num > MAX_IO_NUM)) {
> > + pp_pl_log(0, "args io_num is outside the valid range");
> > + return 0;
> > + }
> > +
> > + if ((base_num < MIN_BASE_NUM) || (base_num > MAX_BASE_NUM)) {
> > + pp_pl_log(0, "args base_num is outside the valid range");
> > + return 0;
> > + }
> > +
> > + return 1;
> >  }
> >
> > -/* In multipath.conf, args form: io_num|base_num. For example,
> > -*  args is "20|10", this function can get io_num value 20, and
> > -   base_num value 10.
> > -*/
> > -static int get_ionum_and_basenum(char *args,
> > - int *ionum,
> > - int *basenum)
> > +/*
> > + * In multipath.conf, args form: io_num|base_num. For example,
> > + * args is "20|10", this function can get io_num value 20, and
> > + * base_num value 10.
> > + */
> > +static int get_ionum_and_basenum(char *args, int *ionum, int *basenum)
> >  {
> > -char 

Re: [dm-devel] [PATCH] multipath-tools: beautify path_latency.c code

2017-08-04 Thread Christophe Varoqui
Bart,

Do you have pending patches on this file you'd like to submit before I
merge this l'indentation patch ?

Regards,
Christophe

Le 4 août 2017 18:39, "Xose Vazquez Perez"  a
écrit :

> On 06/22/2017 06:46 PM, Xose Vazquez Perez wrote:
>
> > Mainly running scripts/Lindent, from kernel dir, to replace indent spaces
> > by tabs.
>
> Patch missing in last merge.
>
> > Cc: Yang Feng 
> > Cc: Christophe Varoqui 
> > Cc: device-mapper development 
> > Signed-off-by: Xose Vazquez Perez 
> > ---
> >  libmultipath/prioritizers/path_latency.c | 354
> +++
> >  1 file changed, 177 insertions(+), 177 deletions(-)
> >
> > diff --git a/libmultipath/prioritizers/path_latency.c
> b/libmultipath/prioritizers/path_latency.c
> > index 34b734b..9fc2dfc 100644
> > --- a/libmultipath/prioritizers/path_latency.c
> > +++ b/libmultipath/prioritizers/path_latency.c
> > @@ -17,8 +17,8 @@
> >   * Author(s): Yang Feng 
> >   *
> >   * This file is released under the GPL version 2, or any later version.
> > - *
> >   */
> > +
> >  #include 
> >  #include 
> >  #include 
> > @@ -31,27 +31,28 @@
> >
> >  #define pp_pl_log(prio, fmt, args...) condlog(prio, "path_latency prio:
> " fmt, ##args)
> >
> > -#define MAX_IO_NUM  200
> > -#define MIN_IO_NUM  2
> > +#define MAX_IO_NUM   200
> > +#define MIN_IO_NUM   2
> >
> > -#define MAX_BASE_NUM10
> > -#define MIN_BASE_NUM2
> > +#define MAX_BASE_NUM 10
> > +#define MIN_BASE_NUM 2
> >
> > -#define MAX_AVG_LATENCY 1.  /*Unit: us*/
> > -#define MIN_AVG_LATENCY 1.  /*Unit: us*/
> > +#define MAX_AVG_LATENCY  1.  /* Unit: us */
> > +#define MIN_AVG_LATENCY  1.  /* Unit: us */
> >
> > -#define DEFAULT_PRIORITY0
> > +#define DEFAULT_PRIORITY 0
> >
> > -#define MAX_CHAR_SIZE   30
> > +#define MAX_CHAR_SIZE30
> >
> > -#define USEC_PER_SEC100LL
> > -#define NSEC_PER_USEC   1000LL
> > +#define USEC_PER_SEC 100LL
> > +#define NSEC_PER_USEC1000LL
> >
> >  static long long path_latency[MAX_IO_NUM];
> >
> >  static inline long long timeval_to_us(const struct timespec *tv)
> >  {
> > - return ((long long) tv->tv_sec * USEC_PER_SEC) + (tv->tv_nsec /
> NSEC_PER_USEC);
> > + return ((long long)tv->tv_sec * USEC_PER_SEC) +
> > + (tv->tv_nsec / NSEC_PER_USEC);
> >  }
> >
> >  static int do_readsector0(int fd, unsigned int timeout)
> > @@ -60,198 +61,197 @@ static int do_readsector0(int fd, unsigned int
> timeout)
> >   unsigned char sbuf[SENSE_BUFF_LEN];
> >   int ret;
> >
> > - ret = sg_read(fd, [0], 4096, [0],
> > -   SENSE_BUFF_LEN, timeout);
> > + ret = sg_read(fd, [0], 4096, [0], SENSE_BUFF_LEN,
> timeout);
> >
> >   return ret;
> >  }
> >
> >  int check_args_valid(int io_num, int base_num)
> >  {
> > -if ((io_num < MIN_IO_NUM) || (io_num > MAX_IO_NUM))
> > -{
> > -pp_pl_log(0, "args io_num is outside the valid range");
> > -return 0;
> > -}
> > -
> > -if ((base_num < MIN_BASE_NUM) || (base_num > MAX_BASE_NUM))
> > -{
> > -pp_pl_log(0, "args base_num is outside the valid range");
> > -return 0;
> > -}
> > -
> > -return 1;
> > + if ((io_num < MIN_IO_NUM) || (io_num > MAX_IO_NUM)) {
> > + pp_pl_log(0, "args io_num is outside the valid range");
> > + return 0;
> > + }
> > +
> > + if ((base_num < MIN_BASE_NUM) || (base_num > MAX_BASE_NUM)) {
> > + pp_pl_log(0, "args base_num is outside the valid range");
> > + return 0;
> > + }
> > +
> > + return 1;
> >  }
> >
> > -/* In multipath.conf, args form: io_num|base_num. For example,
> > -*  args is "20|10", this function can get io_num value 20, and
> > -   base_num value 10.
> > -*/
> > -static int get_ionum_and_basenum(char *args,
> > - int *ionum,
> > - int *basenum)
> > +/*
> > + * In multipath.conf, args form: io_num|base_num. For example,
> > + * args is "20|10", this function can get io_num value 20, and
> > + * base_num value 10.
> > + */
> > +static int get_ionum_and_basenum(char *args, int *ionum, int *basenum)
> >  {
> > -char source[MAX_CHAR_SIZE];
> > -char vertica = '|';
> > -char *endstrbefore = NULL;
> > -char *endstrafter = NULL;
> > -unsigned int size = strlen(args);
> > -
> > -if ((args == NULL) || (ionum == NULL) || (basenum == NULL))
> > -{
> > -pp_pl_log(0, "args string is NULL");
> > -return 0;
> > -}
> > -
> > -if ((size < 1) || (size > MAX_CHAR_SIZE-1))
> > -{
> > -pp_pl_log(0, "args string's size is too long");
> > -

Re: [dm-devel] [PATCH] multipath-tools: beautify path_latency.c code

2017-08-04 Thread Xose Vazquez Perez
On 06/22/2017 06:46 PM, Xose Vazquez Perez wrote:

> Mainly running scripts/Lindent, from kernel dir, to replace indent spaces
> by tabs.

Patch missing in last merge.

> Cc: Yang Feng 
> Cc: Christophe Varoqui 
> Cc: device-mapper development 
> Signed-off-by: Xose Vazquez Perez 
> ---
>  libmultipath/prioritizers/path_latency.c | 354 
> +++
>  1 file changed, 177 insertions(+), 177 deletions(-)
> 
> diff --git a/libmultipath/prioritizers/path_latency.c 
> b/libmultipath/prioritizers/path_latency.c
> index 34b734b..9fc2dfc 100644
> --- a/libmultipath/prioritizers/path_latency.c
> +++ b/libmultipath/prioritizers/path_latency.c
> @@ -17,8 +17,8 @@
>   * Author(s): Yang Feng 
>   *
>   * This file is released under the GPL version 2, or any later version.
> - *
>   */
> +
>  #include 
>  #include 
>  #include 
> @@ -31,27 +31,28 @@
>  
>  #define pp_pl_log(prio, fmt, args...) condlog(prio, "path_latency prio: " 
> fmt, ##args)
>  
> -#define MAX_IO_NUM  200
> -#define MIN_IO_NUM  2
> +#define MAX_IO_NUM   200
> +#define MIN_IO_NUM   2
>  
> -#define MAX_BASE_NUM10
> -#define MIN_BASE_NUM2
> +#define MAX_BASE_NUM 10
> +#define MIN_BASE_NUM 2
>  
> -#define MAX_AVG_LATENCY 1.  /*Unit: us*/
> -#define MIN_AVG_LATENCY 1.  /*Unit: us*/
> +#define MAX_AVG_LATENCY  1.  /* Unit: us */
> +#define MIN_AVG_LATENCY  1.  /* Unit: us */
>  
> -#define DEFAULT_PRIORITY0
> +#define DEFAULT_PRIORITY 0
>  
> -#define MAX_CHAR_SIZE   30
> +#define MAX_CHAR_SIZE30
>  
> -#define USEC_PER_SEC100LL
> -#define NSEC_PER_USEC   1000LL
> +#define USEC_PER_SEC 100LL
> +#define NSEC_PER_USEC1000LL
>  
>  static long long path_latency[MAX_IO_NUM];
>  
>  static inline long long timeval_to_us(const struct timespec *tv)
>  {
> - return ((long long) tv->tv_sec * USEC_PER_SEC) + (tv->tv_nsec / 
> NSEC_PER_USEC);
> + return ((long long)tv->tv_sec * USEC_PER_SEC) +
> + (tv->tv_nsec / NSEC_PER_USEC);
>  }
>  
>  static int do_readsector0(int fd, unsigned int timeout)
> @@ -60,198 +61,197 @@ static int do_readsector0(int fd, unsigned int timeout)
>   unsigned char sbuf[SENSE_BUFF_LEN];
>   int ret;
>  
> - ret = sg_read(fd, [0], 4096, [0],
> -   SENSE_BUFF_LEN, timeout);
> + ret = sg_read(fd, [0], 4096, [0], SENSE_BUFF_LEN, timeout);
>  
>   return ret;
>  }
>  
>  int check_args_valid(int io_num, int base_num)
>  {
> -if ((io_num < MIN_IO_NUM) || (io_num > MAX_IO_NUM))
> -{
> -pp_pl_log(0, "args io_num is outside the valid range");
> -return 0;
> -}
> -
> -if ((base_num < MIN_BASE_NUM) || (base_num > MAX_BASE_NUM))
> -{
> -pp_pl_log(0, "args base_num is outside the valid range");
> -return 0;
> -}
> -
> -return 1;
> + if ((io_num < MIN_IO_NUM) || (io_num > MAX_IO_NUM)) {
> + pp_pl_log(0, "args io_num is outside the valid range");
> + return 0;
> + }
> +
> + if ((base_num < MIN_BASE_NUM) || (base_num > MAX_BASE_NUM)) {
> + pp_pl_log(0, "args base_num is outside the valid range");
> + return 0;
> + }
> +
> + return 1;
>  }
>  
> -/* In multipath.conf, args form: io_num|base_num. For example,
> -*  args is "20|10", this function can get io_num value 20, and
> -   base_num value 10.
> -*/
> -static int get_ionum_and_basenum(char *args,
> - int *ionum,
> - int *basenum)
> +/*
> + * In multipath.conf, args form: io_num|base_num. For example,
> + * args is "20|10", this function can get io_num value 20, and
> + * base_num value 10.
> + */
> +static int get_ionum_and_basenum(char *args, int *ionum, int *basenum)
>  {
> -char source[MAX_CHAR_SIZE];
> -char vertica = '|';
> -char *endstrbefore = NULL;
> -char *endstrafter = NULL;
> -unsigned int size = strlen(args);
> -
> -if ((args == NULL) || (ionum == NULL) || (basenum == NULL))
> -{
> -pp_pl_log(0, "args string is NULL");
> -return 0;
> -}
> -
> -if ((size < 1) || (size > MAX_CHAR_SIZE-1))
> -{
> -pp_pl_log(0, "args string's size is too long");
> -return 0;
> -}
> -
> -memcpy(source, args, size+1);
> -
> -if (!isdigit(source[0]))
> -{
> -pp_pl_log(0, "invalid prio_args format: %s", source);
> -return 0;
> -}
> -
> -*ionum = (int)strtoul(source, , 10);
> -if (endstrbefore[0] != vertica)
> -{
> -pp_pl_log(0, "invalid prio_args format: %s", source);
> -return 0;
> -}
> -
> -if (!isdigit(endstrbefore[1]))
> -{
> -

Re: [dm-devel] [PATCH] multipath-tools: beautify path_latency.c code

2017-06-26 Thread Bart Van Assche
On Thu, 2017-06-22 at 18:46 +0200, Xose Vazquez Perez wrote:
> Mainly running scripts/Lindent, from kernel dir, to replace indent spaces
> by tabs.

Hello Xose,

Why do you think this kind of changes is useful? Are you aware that
whitespace-only changes are very annoying to anyone else who is preparing
changes on the same file because such changes result in a huge number of
annoying rebase conflicts?

Bart.

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


Re: [dm-devel] [PATCH] multipath-tools: beautify path_latency.c code

2017-06-24 Thread Yang Feng
Hi Xose,
Thanks for your work.

ACK
-Yang

On 2017/6/23 0:46, Xose Vazquez Perez wrote:
> Mainly running scripts/Lindent, from kernel dir, to replace indent spaces
> by tabs.
> 
> Cc: Yang Feng 
> Cc: Christophe Varoqui 
> Cc: device-mapper development 
> Signed-off-by: Xose Vazquez Perez 
> ---
>  libmultipath/prioritizers/path_latency.c | 354 
> +++
>  1 file changed, 177 insertions(+), 177 deletions(-)
> 
> diff --git a/libmultipath/prioritizers/path_latency.c 
> b/libmultipath/prioritizers/path_latency.c
> index 34b734b..9fc2dfc 100644
> --- a/libmultipath/prioritizers/path_latency.c
> +++ b/libmultipath/prioritizers/path_latency.c
> @@ -17,8 +17,8 @@
>   * Author(s): Yang Feng 
>   *
>   * This file is released under the GPL version 2, or any later version.
> - *
>   */
> +
>  #include 
>  #include 
>  #include 
> @@ -31,27 +31,28 @@
>  
>  #define pp_pl_log(prio, fmt, args...) condlog(prio, "path_latency prio: " 
> fmt, ##args)
>  
> -#define MAX_IO_NUM  200
> -#define MIN_IO_NUM  2
> +#define MAX_IO_NUM   200
> +#define MIN_IO_NUM   2
>  
> -#define MAX_BASE_NUM10
> -#define MIN_BASE_NUM2
> +#define MAX_BASE_NUM 10
> +#define MIN_BASE_NUM 2
>  
> -#define MAX_AVG_LATENCY 1.  /*Unit: us*/
> -#define MIN_AVG_LATENCY 1.  /*Unit: us*/
> +#define MAX_AVG_LATENCY  1.  /* Unit: us */
> +#define MIN_AVG_LATENCY  1.  /* Unit: us */
>  
> -#define DEFAULT_PRIORITY0
> +#define DEFAULT_PRIORITY 0
>  
> -#define MAX_CHAR_SIZE   30
> +#define MAX_CHAR_SIZE30
>  
> -#define USEC_PER_SEC100LL
> -#define NSEC_PER_USEC   1000LL
> +#define USEC_PER_SEC 100LL
> +#define NSEC_PER_USEC1000LL
>  
>  static long long path_latency[MAX_IO_NUM];
>  
>  static inline long long timeval_to_us(const struct timespec *tv)
>  {
> - return ((long long) tv->tv_sec * USEC_PER_SEC) + (tv->tv_nsec / 
> NSEC_PER_USEC);
> + return ((long long)tv->tv_sec * USEC_PER_SEC) +
> + (tv->tv_nsec / NSEC_PER_USEC);
>  }
>  
>  static int do_readsector0(int fd, unsigned int timeout)
> @@ -60,198 +61,197 @@ static int do_readsector0(int fd, unsigned int timeout)
>   unsigned char sbuf[SENSE_BUFF_LEN];
>   int ret;
>  
> - ret = sg_read(fd, [0], 4096, [0],
> -   SENSE_BUFF_LEN, timeout);
> + ret = sg_read(fd, [0], 4096, [0], SENSE_BUFF_LEN, timeout);
>  
>   return ret;
>  }
>  
>  int check_args_valid(int io_num, int base_num)
>  {
> -if ((io_num < MIN_IO_NUM) || (io_num > MAX_IO_NUM))
> -{
> -pp_pl_log(0, "args io_num is outside the valid range");
> -return 0;
> -}
> -
> -if ((base_num < MIN_BASE_NUM) || (base_num > MAX_BASE_NUM))
> -{
> -pp_pl_log(0, "args base_num is outside the valid range");
> -return 0;
> -}
> -
> -return 1;
> + if ((io_num < MIN_IO_NUM) || (io_num > MAX_IO_NUM)) {
> + pp_pl_log(0, "args io_num is outside the valid range");
> + return 0;
> + }
> +
> + if ((base_num < MIN_BASE_NUM) || (base_num > MAX_BASE_NUM)) {
> + pp_pl_log(0, "args base_num is outside the valid range");
> + return 0;
> + }
> +
> + return 1;
>  }
>  
> -/* In multipath.conf, args form: io_num|base_num. For example,
> -*  args is "20|10", this function can get io_num value 20, and
> -   base_num value 10.
> -*/
> -static int get_ionum_and_basenum(char *args,
> - int *ionum,
> - int *basenum)
> +/*
> + * In multipath.conf, args form: io_num|base_num. For example,
> + * args is "20|10", this function can get io_num value 20, and
> + * base_num value 10.
> + */
> +static int get_ionum_and_basenum(char *args, int *ionum, int *basenum)
>  {
> -char source[MAX_CHAR_SIZE];
> -char vertica = '|';
> -char *endstrbefore = NULL;
> -char *endstrafter = NULL;
> -unsigned int size = strlen(args);
> -
> -if ((args == NULL) || (ionum == NULL) || (basenum == NULL))
> -{
> -pp_pl_log(0, "args string is NULL");
> -return 0;
> -}
> -
> -if ((size < 1) || (size > MAX_CHAR_SIZE-1))
> -{
> -pp_pl_log(0, "args string's size is too long");
> -return 0;
> -}
> -
> -memcpy(source, args, size+1);
> -
> -if (!isdigit(source[0]))
> -{
> -pp_pl_log(0, "invalid prio_args format: %s", source);
> -return 0;
> -}
> -
> -*ionum = (int)strtoul(source, , 10);
> -if (endstrbefore[0] != vertica)
> -{
> -pp_pl_log(0, "invalid prio_args format: %s", source);
> -return 0;
> -}
> -
> -if (!isdigit(endstrbefore[1]))
> -{
> -   

Re: [dm-devel] [PATCH] multipath-tools: beautify path_latency.c code

2017-06-23 Thread Xose Vazquez Perez
On 06/22/2017 06:59 PM, Bart Van Assche wrote:

> Why do you think this kind of changes is useful? Are you aware that
> whitespace-only changes are very annoying to anyone else who is preparing
> changes on the same file because such changes result in a huge number of
> annoying rebase conflicts?

Be consistent with the rest of the multipath-tools code. Have do you seen
the original and the patched file?
Cleanings like this were done before without troubles.

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel