Merge branch 'pending-l2x0' into cache
[linux-2.6-block.git] / net / core / gen_stats.c
index 8569310268ab76ba786402e6b2e6dc994621a7fd..393b1d8618e22d412625c96308bcdf3be8f5a43a 100644 (file)
@@ -127,6 +127,7 @@ gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic_packed *b)
 /**
  * gnet_stats_copy_rate_est - copy rate estimator statistics into statistics TLV
  * @d: dumping handle
+ * @b: basic statistics
  * @r: rate estimator statistics
  *
  * Appends the rate estimator statistics to the top level TLV created by
@@ -136,8 +137,13 @@ gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic_packed *b)
  * if the room in the socket buffer was not sufficient.
  */
 int
-gnet_stats_copy_rate_est(struct gnet_dump *d, struct gnet_stats_rate_est *r)
+gnet_stats_copy_rate_est(struct gnet_dump *d,
+                        const struct gnet_stats_basic_packed *b,
+                        struct gnet_stats_rate_est *r)
 {
+       if (b && !gen_estimator_active(b, r))
+               return 0;
+
        if (d->compat_tc_stats) {
                d->tc_stats.bps = r->bps;
                d->tc_stats.pps = r->pps;