Skip to contentSkip to conversation

pgp->priority average calculation

multipath tools Mike Christie 2 participants 2 messages Jan 8, 2013 – Jan 9, 2013 Device mapper

lore
Share & tools
lore
#0 lore raw

Hey Ben and Hannes and Christophe,

Happy multipath-tools patch submission day :)

I had a question on the pgp->priority average calculation and its display to the user.

Ben, you added the patch

commit cd21bd290a57eed350d564bac403da9d6941a144

Author: Benjamin Marzinski <[email protected]>
Date:   Wed Nov 10 12:52:20 2010 -0600

multipath: sort all pathgroups by priority

which did

@@ -25,14 +25,17 @@ path_group_prio_update (struct pathgroup * pgp)

                        pgp->enabled_paths++;
                }
        }

- pgp->priority = priority;
+ if (pgp->enabled_paths)
+ pgp->priority = priority / pgp->enabled_paths;
+ else
+

and

@@ -387,9 +386,7 @@ snprint_pg_pri (char * buff, size_t len, struct pathgroup *

         * Printing is another reason to update.
         */
        path_group_prio_update(pgp);

- if (pgp->enabled_paths)
- avg_priority = pgp->priority / pgp->enabled_paths;
- return snprint_int(buff, len, avg_priority);
+

but then Hannes later added the patch:

commit 750db1f0dc08bf1d96ce64d32786dfe07b8ae3f9

Author: Hannes Reinecke <[email protected]>
Date:   Wed Mar 17 08:32:51 2010 +0100

Display avg priority as group priority

which added it back in the print code:

- return snprint_int(buff, len, pgp->priority);
+ if (pgp->enabled_paths)
+ avg_priority = pgp->priority / pgp->enabled_paths;
+ return snprint_int(buff, len, avg_priority);

So when we print the prio, it ends up getting divided by the number of enabled paths twice.

Was Hannes's patch a mistake? Should it be reverted?

#1 lore raw
Quoted 61 lines · Mike Christie

Hey Ben and Hannes and Christophe,

Happy multipath-tools patch submission day :)

I had a question on the pgp->priority average calculation and its display to the user.

Ben, you added the patch

commit cd21bd290a57eed350d564bac403da9d6941a144

Author: Benjamin Marzinski <[email protected]>
Date:   Wed Nov 10 12:52:20 2010 -0600

multipath: sort all pathgroups by priority

which did

(quoted diff) +4 -1
@@ -25,14 +25,17 @@ path_group_prio_update (struct pathgroup * pgp)
                         pgp->enabled_paths++;
                 }
         }
-       pgp->priority = priority;
+       if (pgp->enabled_paths)
+               pgp->priority = priority / pgp->enabled_paths;
+       else
+
 

and

(quoted diff) +0 -0
@@ -387,9 +386,7 @@ snprint_pg_pri (char * buff, size_t len, struct

pathgroup *

          * Printing is another reason to update.
          */
         path_group_prio_update(pgp);
(quoted diff) +1 -3
-       if (pgp->enabled_paths)
-               avg_priority = pgp->priority / pgp->enabled_paths;
-       return snprint_int(buff, len, avg_priority);
+

but then Hannes later added the patch:

commit 750db1f0dc08bf1d96ce64d32786dfe07b8ae3f9

Author: Hannes Reinecke <[email protected]>
Date:   Wed Mar 17 08:32:51 2010 +0100

Display avg priority as group priority

which added it back in the print code:

(quoted diff) +3 -1
-       return snprint_int(buff, len, pgp->priority);
+       if (pgp->enabled_paths)
+               avg_priority = pgp->priority / pgp->enabled_paths;
+       return snprint_int(buff, len, avg_priority);
Quoted 6 lines

So when we print the prio, it ends up getting divided by the number of enabled paths twice.

Was Hannes's patch a mistake? Should it be reverted?

Yeah, that seems to be an error.
Please revert.

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)