remove sglist_len
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tue, 18 Sep 2007 10:17:28 +0000 (12:17 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 16 Oct 2007 09:24:44 +0000 (11:24 +0200)
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
drivers/scsi/scsi_lib.c
include/scsi/scsi_cmnd.h

index 1a7e8d811a08799c3fb08aa13375d117e99636f3..aac8a02cbe8040348d8383d8551514a619598b2d 100644 (file)
@@ -769,10 +769,8 @@ struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask)
                /*
                 * first loop through, set initial index and return value
                 */
-               if (!ret) {
-                       cmd->sglist_len = index;
+               if (!ret)
                        ret = sgl;
-               }
 
                /*
                 * chain previous sglist, if any. we know the previous
@@ -825,8 +823,6 @@ void scsi_free_sgtable(struct scsi_cmnd *cmd)
        struct scatterlist *sgl = cmd->request_buffer;
        struct scsi_host_sg_pool *sgp;
 
-       BUG_ON(cmd->sglist_len >= SG_MEMPOOL_NR);
-
        /*
         * if this is the biggest size sglist, check if we have
         * chained parts we need to free
@@ -861,9 +857,10 @@ void scsi_free_sgtable(struct scsi_cmnd *cmd)
                 * Restore original, will be freed below
                 */
                sgl = cmd->request_buffer;
-       }
+               sgp = scsi_sg_pools + SG_MEMPOOL_NR - 1;
+       } else
+               sgp = scsi_sg_pools + scsi_sgtable_index(cmd->__use_sg);
 
-       sgp = scsi_sg_pools + cmd->sglist_len;
        mempool_free(sgl, sgp->pool);
 }
 
index 4a5fa2d1c44c806e108944f1c6a085040811e029..3f47e522a1ec3bedf6c85b9d30145c7208a626b5 100644 (file)
@@ -69,7 +69,6 @@ struct scsi_cmnd {
 
        /* These elements define the operation we ultimately want to perform */
        unsigned short use_sg;  /* Number of pieces of scatter-gather */
-       unsigned short sglist_len;      /* size of malloc'd scatter-gather list */
        unsigned short __use_sg;
 
        unsigned underflow;     /* Return error if less than