12 #include <linux/slab.h>
13 #include <linux/module.h>
23 #define MMC_QUEUE_BOUNCESZ 65536
25 #define MMC_QUEUE_SUSPENDED (1 << 0)
37 if (req->cmd_type != REQ_TYPE_FS && !(req->cmd_flags &
REQ_DISCARD)) {
50 static int mmc_queue_thread(
void *
d)
62 spin_lock_irq(q->queue_lock);
66 spin_unlock_irq(q->queue_lock);
134 unsigned max_discard;
140 queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q);
141 q->limits.max_discard_sectors = max_discard;
143 q->limits.discard_zeroes_data = 1;
144 q->limits.discard_granularity = card->
pref_erase << 9;
147 q->limits.discard_granularity = 0;
149 queue_flag_set_unlocked(QUEUE_FLAG_SECDISCARD, q);
171 limit = *
mmc_dev(host)->dma_mask;
180 mq->
queue->queuedata = mq;
183 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, mq->
queue);
185 mmc_queue_setup_discard(mq->
queue, card);
187 #ifdef CONFIG_MMC_BLOCK_BOUNCE
189 unsigned int bouncesz;
200 if (bouncesz > 512) {
204 "allocate bounce cur buffer\n",
210 "allocate bounce prev buffer\n",
223 mqrq_cur->
sg = mmc_alloc_sg(1, &ret);
228 mmc_alloc_sg(bouncesz / 512, &ret);
232 mqrq_prev->
sg = mmc_alloc_sg(1, &ret);
237 mmc_alloc_sg(bouncesz / 512, &ret);
251 mqrq_cur->
sg = mmc_alloc_sg(host->
max_segs, &ret);
256 mqrq_prev->
sg = mmc_alloc_sg(host->
max_segs, &ret);
264 host->
index, subname ? subname :
"");
267 ret = PTR_ERR(mq->
thread);
310 spin_unlock_irqrestore(q->queue_lock, flags);
352 spin_unlock_irqrestore(q->queue_lock, flags);
374 spin_unlock_irqrestore(q->queue_lock, flags);
415 if (rq_data_dir(mqrq->
req) !=
WRITE)
431 if (rq_data_dir(mqrq->
req) !=
READ)