Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 41446
b: refs/heads/master
c: 89b4e13
h: refs/heads/master
v: v3
  • Loading branch information
Pierre Ossman committed Dec 1, 2006
1 parent e76fd5b commit 9646d79
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 077df884835ebf2b5db16aacd9a24691d89902a0
refs/heads/master: 89b4e133afea9fce333054b94d89953583a55c19
8 changes: 3 additions & 5 deletions trunk/drivers/mmc/mmc_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ static void mmc_blk_put(struct mmc_blk_data *md)
md->usage--;
if (md->usage == 0) {
put_disk(md->disk);
mmc_cleanup_queue(&md->queue);
kfree(md);
}
mutex_unlock(&open_lock);
Expand Down Expand Up @@ -553,12 +552,11 @@ static void mmc_blk_remove(struct mmc_card *card)
if (md) {
int devidx;

/* Stop new requests from getting into the queue */
del_gendisk(md->disk);

/*
* I think this is needed.
*/
md->disk->queue = NULL;
/* Then flush out any already in there */
mmc_cleanup_queue(&md->queue);

devidx = md->disk->first_minor >> MMC_SHIFT;
__clear_bit(devidx, dev_use);
Expand Down
22 changes: 22 additions & 0 deletions trunk/drivers/mmc/mmc_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,19 @@ static int mmc_queue_thread(void *d)
static void mmc_request(request_queue_t *q)
{
struct mmc_queue *mq = q->queuedata;
struct request *req;
int ret;

if (!mq) {
printk(KERN_ERR "MMC: killing requests for dead queue\n");
while ((req = elv_next_request(q)) != NULL) {
do {
ret = end_that_request_chunk(req, 0,
req->current_nr_sectors << 9);
} while (ret);
}
return;
}

if (!mq->req)
wake_up_process(mq->thread);
Expand Down Expand Up @@ -168,6 +181,15 @@ EXPORT_SYMBOL(mmc_init_queue);

void mmc_cleanup_queue(struct mmc_queue *mq)
{
request_queue_t *q = mq->queue;
unsigned long flags;

/* Mark that we should start throwing out stragglers */
spin_lock_irqsave(q->queue_lock, flags);
q->queuedata = NULL;
spin_unlock_irqrestore(q->queue_lock, flags);

/* Then terminate our worker thread */
kthread_stop(mq->thread);

kfree(mq->sg);
Expand Down

0 comments on commit 9646d79

Please sign in to comment.