Initial Contribution
msm-2.6.38: tag AU_LINUX_ANDROID_GINGERBREAD.02.03.04.00.142
Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org>
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index 6413afa..9b64847 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -46,12 +46,20 @@
{
struct mmc_queue *mq = d;
struct request_queue *q = mq->queue;
+ struct request *req;
+
+#ifdef CONFIG_MMC_PERF_PROFILING
+ ktime_t start, diff;
+ struct mmc_host *host = mq->card->host;
+ unsigned long bytes_xfer;
+#endif
+
current->flags |= PF_MEMALLOC;
down(&mq->thread_sem);
do {
- struct request *req = NULL;
+ req = NULL; /* Must be set to NULL at each iteration */
spin_lock_irq(q->queue_lock);
set_current_state(TASK_INTERRUPTIBLE);
@@ -71,7 +79,26 @@
}
set_current_state(TASK_RUNNING);
- mq->issue_fn(mq, req);
+#ifdef CONFIG_MMC_PERF_PROFILING
+ bytes_xfer = blk_rq_bytes(req);
+ if (rq_data_dir(req) == READ) {
+ start = ktime_get();
+ mq->issue_fn(mq, req);
+ diff = ktime_sub(ktime_get(), start);
+ host->perf.rbytes_mmcq += bytes_xfer;
+ host->perf.rtime_mmcq =
+ ktime_add(host->perf.rtime_mmcq, diff);
+ } else {
+ start = ktime_get();
+ mq->issue_fn(mq, req);
+ diff = ktime_sub(ktime_get(), start);
+ host->perf.wbytes_mmcq += bytes_xfer;
+ host->perf.wtime_mmcq =
+ ktime_add(host->perf.wtime_mmcq, diff);
+ }
+#else
+ mq->issue_fn(mq, req);
+#endif
} while (1);
up(&mq->thread_sem);