+static inline void __account_pc_queue(struct io_stats *ios,
+ struct blk_io_trace *t, int rw)
+{
+ if (rw) {
+ ios->qwrites_pc++;
+ ios->qwrite_kb_pc += t_kb(t);
+ ios->qwrite_b_pc += t_b(t);
+ } else {
+ ios->qreads_pc++;
+ ios->qread_kb += t_kb(t);
+ ios->qread_b_pc += t_b(t);
+ }
+}
+
+static inline void account_pc_queue(struct blk_io_trace *t,
+ struct per_cpu_info *pci, int rw)
+{
+ __account_pc_queue(&pci->io_stats, t, rw);
+
+ if (per_process_stats) {
+ struct io_stats *ios = find_process_io_stats(t->pid);
+
+ __account_pc_queue(ios, t, rw);
+ }
+}
+
+static inline void __account_pc_issue(struct io_stats *ios, int rw,
+ unsigned int bytes)
+{
+ if (rw) {
+ ios->iwrites_pc++;
+ ios->iwrite_kb_pc += bytes >> 10;
+ ios->iwrite_b_pc += bytes & 1023;
+ } else {
+ ios->ireads_pc++;
+ ios->iread_kb_pc += bytes >> 10;
+ ios->iread_b_pc += bytes & 1023;
+ }
+}
+
+static inline void account_pc_issue(struct blk_io_trace *t,
+ struct per_cpu_info *pci, int rw)
+{
+ __account_pc_issue(&pci->io_stats, rw, t->bytes);
+
+ if (per_process_stats) {
+ struct io_stats *ios = find_process_io_stats(t->pid);
+
+ __account_pc_issue(ios, rw, t->bytes);
+ }
+}
+
+static inline void __account_pc_requeue(struct io_stats *ios,
+ struct blk_io_trace *t, int rw)
+{
+ if (rw) {
+ ios->wrqueue_pc++;
+ ios->iwrite_kb_pc -= t_kb(t);
+ ios->iwrite_b_pc -= t_b(t);
+ } else {
+ ios->rrqueue_pc++;
+ ios->iread_kb_pc -= t_kb(t);
+ ios->iread_b_pc -= t_b(t);
+ }
+}
+
+static inline void account_pc_requeue(struct blk_io_trace *t,
+ struct per_cpu_info *pci, int rw)
+{
+ __account_pc_requeue(&pci->io_stats, t, rw);
+
+ if (per_process_stats) {
+ struct io_stats *ios = find_process_io_stats(t->pid);
+
+ __account_pc_requeue(ios, t, rw);
+ }
+}
+
+static inline void __account_pc_c(struct io_stats *ios, int rw)
+{
+ if (rw)
+ ios->cwrites_pc++;
+ else
+ ios->creads_pc++;
+}
+
+static inline void account_pc_c(struct blk_io_trace *t,
+ struct per_cpu_info *pci, int rw)
+{
+ __account_pc_c(&pci->io_stats, rw);
+
+ if (per_process_stats) {
+ struct io_stats *ios = find_process_io_stats(t->pid);
+
+ __account_pc_c(ios, rw);
+ }
+}
+