]> git.hungrycats.org Git - linux/commitdiff
[PATCH] block cleanups
authorJens Axboe <axboe@suse.de>
Fri, 18 Oct 2002 03:50:45 +0000 (20:50 -0700)
committerJens Axboe <axboe@suse.de>
Fri, 18 Oct 2002 03:50:45 +0000 (20:50 -0700)
o Change the blk_dump_rq_flags() a bit

o Use rq->bio as an indication of ->bio is valid or not, instead of
  checking REQ_PC. Now we can have a bio on a REQ_BLOCK_PC as well.

o Don't print eio error in end_that_request_first(), if REQ_QUIET is set.

o debug check for valid bio in end_that_request_first()

o Add blk_pc_request() check REQ_BLOCK_PC, similar to blk_fs_request()

drivers/block/ll_rw_blk.c
include/linux/blkdev.h

index eb877e50a8d11c4149f65a6cbe520a376a0e1068..c5697e05a6b80bb170b3c5de96eda90b91d2430c 100644 (file)
@@ -670,12 +670,10 @@ void blk_dump_rq_flags(struct request *rq, char *msg)
                bit++;
        } while (bit < __REQ_NR_BITS);
 
-       if (rq->flags & REQ_CMD)
-               printk("sector %llu, nr/cnr %lu/%u\n", (unsigned long long)rq->sector,
+       printk("sector %llu, nr/cnr %lu/%u\n", (unsigned long long)rq->sector,
                                                       rq->nr_sectors,
                                                       rq->current_nr_sectors);
-
-       printk("\n");
+       printk("bio %p, biotail %p\n", rq->bio, rq->biotail);
 }
 
 void blk_recount_segments(request_queue_t *q, struct bio *bio)
@@ -1927,7 +1925,7 @@ inline void blk_recalc_rq_segments(struct request *rq)
 
 inline void blk_recalc_rq_sectors(struct request *rq, int nsect)
 {
-       if (rq->flags & REQ_CMD) {
+       if (rq->bio) {
                rq->hard_sector += nsect;
                rq->nr_sectors = rq->hard_nr_sectors -= nsect;
                rq->sector = rq->hard_sector;
@@ -1968,20 +1966,28 @@ int end_that_request_first(struct request *req, int uptodate, int nr_sectors)
 
        req->errors = 0;
        if (!uptodate) {
-               printk("end_request: I/O error, dev %s, sector %llu\n",
-                       kdevname(req->rq_dev), (unsigned long long)req->sector);
                error = -EIO;
+               if (!(req->flags & REQ_QUIET))
+                       printk("end_request: I/O error, dev %s, sector %llu\n",
+                               kdevname(req->rq_dev),
+                               (unsigned long long)req->sector);
        }
 
        while ((bio = req->bio)) {
-               const int nsect = bio_iovec(bio)->bv_len >> 9;
-               int new_bio = 0;
+               int new_bio = 0, nsect;
+
+               if (unlikely(bio->bi_idx >= bio->bi_vcnt)) {
+                       printk("%s: bio idx %d >= vcnt %d\n", __FUNCTION__,
+                                               bio->bi_idx, bio->bi_vcnt);
+                       break;
+               }
 
                BIO_BUG_ON(bio_iovec(bio)->bv_len > bio->bi_size);
 
                /*
                 * not a complete bvec done
                 */
+               nsect = bio_iovec(bio)->bv_len >> 9;
                if (unlikely(nsect > nr_sectors)) {
                        int partial = nr_sectors << 9;
 
index ccb56d58de6ae66de310d38d280d8e89c896c8af..42e81a4a0cabd548c2476825426a24ded51f565a 100644 (file)
@@ -235,6 +235,7 @@ struct request_queue
 #define blk_queue_tagged(q)    test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
 #define blk_queue_empty(q)     elv_queue_empty(q)
 #define blk_fs_request(rq)     ((rq)->flags & REQ_CMD)
+#define blk_pc_request(rq)     ((rq)->flags & REQ_BLOCK_PC)
 #define list_entry_rq(ptr)     list_entry((ptr), struct request, queuelist)
 
 #define rq_data_dir(rq)                ((rq)->flags & 1)