]> git.hungrycats.org Git - linux/commitdiff
[PATCH] misc generic block tag fixes
authorJens Axboe <axboe@suse.de>
Sun, 2 Jun 2002 10:15:19 +0000 (03:15 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sun, 2 Jun 2002 10:15:19 +0000 (03:15 -0700)
A buglet and a few adjustments.

drivers/block/ll_rw_blk.c

index 9e42c51e4fbf8492e576142786d9d4fa2d46c0fa..65f8680ed24aae61a7978b6e0d419abe4f3712c2 100644 (file)
@@ -336,8 +336,10 @@ int blk_queue_init_tags(request_queue_t *q, int depth)
        struct blk_queue_tag *tags;
        int bits, i;
 
-       if (depth > queue_nr_requests)
+       if (depth > queue_nr_requests) {
                depth = queue_nr_requests;
+               printk("blk_queue_init_tags: adjusted depth to %d\n", depth);
+       }
 
        tags = kmalloc(sizeof(struct blk_queue_tag),GFP_ATOMIC);
        if (!tags)
@@ -362,7 +364,7 @@ int blk_queue_init_tags(request_queue_t *q, int depth)
         * set the upper bits if the depth isn't a multiple of the word size
         */
        for (i = depth; i < bits * BLK_TAGS_PER_LONG; i++)
-               set_bit(i, tags->tag_map);
+               __set_bit(i, tags->tag_map);
 
        /*
         * assign it, all done
@@ -478,13 +480,19 @@ int blk_queue_start_tag(request_queue_t *q, struct request *rq)
 void blk_queue_invalidate_tags(request_queue_t *q)
 {
        struct blk_queue_tag *bqt = q->queue_tags;
-       struct list_head *tmp;
+       struct list_head *tmp, *n;
        struct request *rq;
 
-       list_for_each(tmp, &bqt->busy_list) {
+       list_for_each_safe(tmp, n, &bqt->busy_list) {
                rq = list_entry_rq(tmp);
 
-               blk_queue_end_tag(q, rq);
+               if (rq->tag == -1) {
+                       printk("bad tag found on list\n");
+                       list_del(&rq->queue);
+                       rq->tagged = 0;
+               } else
+                       blk_queue_end_tag(q, rq);
+
                rq->flags &= ~REQ_STARTED;
                elv_add_request(q, rq, 0);
        }