block/partitions/efi.c: fix bound check
[pandora-kernel.git] / block / blk-throttle.c
index 8331aba..0653404 100644 (file)
@@ -256,6 +256,12 @@ static struct throtl_data *sq_to_td(struct throtl_service_queue *sq)
        }                                                               \
 } while (0)
 
+static void tg_stats_init(struct tg_stats_cpu *tg_stats)
+{
+       blkg_rwstat_init(&tg_stats->service_bytes);
+       blkg_rwstat_init(&tg_stats->serviced);
+}
+
 /*
  * Worker for allocating per cpu stat for tgs. This is scheduled on the
  * system_wq once there are some groups on the alloc_list waiting for
@@ -269,12 +275,16 @@ static void tg_stats_alloc_fn(struct work_struct *work)
 
 alloc_stats:
        if (!stats_cpu) {
+               int cpu;
+
                stats_cpu = alloc_percpu(struct tg_stats_cpu);
                if (!stats_cpu) {
                        /* allocation failed, try again after some time */
                        schedule_delayed_work(dwork, msecs_to_jiffies(10));
                        return;
                }
+               for_each_possible_cpu(cpu)
+                       tg_stats_init(per_cpu_ptr(stats_cpu, cpu));
        }
 
        spin_lock_irq(&tg_stats_alloc_lock);