Skip to content

Commit

Permalink
mds: drop useless double from DecayCounter
Browse files Browse the repository at this point in the history
No need to store k AND halflife.
  • Loading branch information
liewegas committed Mar 8, 2010
1 parent f07ce46 commit fdb85ca
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/common/DecayCounter.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
class DecayCounter {
protected:
public:
double half_life;
double k; // k = ln(.5)/half_life
double val; // value
double delta; // delta since last decay
Expand All @@ -42,9 +41,8 @@ class DecayCounter {
public:

void encode(bufferlist& bl) const {
__u8 struct_v = 1;
__u8 struct_v = 2;
::encode(struct_v, bl);
::encode(half_life, bl);
::encode(k, bl);
::encode(val, bl);
::encode(delta, bl);
Expand All @@ -53,7 +51,10 @@ class DecayCounter {
void decode(bufferlist::iterator &p) {
__u8 struct_v;
::decode(struct_v, p);
::decode(half_life, p);
if (struct_v < 2) {
double half_life;
::decode(half_life, p);
}
::decode(k, p);
::decode(val, p);
::decode(delta, p);
Expand Down Expand Up @@ -122,7 +123,6 @@ class DecayCounter {
*/

void set_halflife(double hl) {
half_life = hl;
k = log(.5) / hl;
}

Expand Down

0 comments on commit fdb85ca

Please sign in to comment.