aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sg.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-05-11 09:01:01 -0400
committerJens Axboe <jens.axboe@oracle.com>2007-10-16 05:14:18 -0400
commitb0f655d0ef02468232b69acad1d935db921db46b (patch)
treecd73f2c67dada1eb274edbe40acc240f3156bb93 /drivers/scsi/sg.c
parent852e034de7727f91dd51995c460a04db2955f1b3 (diff)
scsi generic: sg chaining support
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r--drivers/scsi/sg.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index f6f5fc7d0cee..7238b2dfc497 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1165,7 +1165,7 @@ sg_vma_nopage(struct vm_area_struct *vma, unsigned long addr, int *type)
1165 sg = rsv_schp->buffer; 1165 sg = rsv_schp->buffer;
1166 sa = vma->vm_start; 1166 sa = vma->vm_start;
1167 for (k = 0; (k < rsv_schp->k_use_sg) && (sa < vma->vm_end); 1167 for (k = 0; (k < rsv_schp->k_use_sg) && (sa < vma->vm_end);
1168 ++k, ++sg) { 1168 ++k, sg = sg_next(sg)) {
1169 len = vma->vm_end - sa; 1169 len = vma->vm_end - sa;
1170 len = (len < sg->length) ? len : sg->length; 1170 len = (len < sg->length) ? len : sg->length;
1171 if (offset < len) { 1171 if (offset < len) {
@@ -1209,7 +1209,7 @@ sg_mmap(struct file *filp, struct vm_area_struct *vma)
1209 sa = vma->vm_start; 1209 sa = vma->vm_start;
1210 sg = rsv_schp->buffer; 1210 sg = rsv_schp->buffer;
1211 for (k = 0; (k < rsv_schp->k_use_sg) && (sa < vma->vm_end); 1211 for (k = 0; (k < rsv_schp->k_use_sg) && (sa < vma->vm_end);
1212 ++k, ++sg) { 1212 ++k, sg = sg_next(sg)) {
1213 len = vma->vm_end - sa; 1213 len = vma->vm_end - sa;
1214 len = (len < sg->length) ? len : sg->length; 1214 len = (len < sg->length) ? len : sg->length;
1215 sa += len; 1215 sa += len;
@@ -1840,7 +1840,7 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size)
1840 } 1840 }
1841 for (k = 0, sg = schp->buffer, rem_sz = blk_size; 1841 for (k = 0, sg = schp->buffer, rem_sz = blk_size;
1842 (rem_sz > 0) && (k < mx_sc_elems); 1842 (rem_sz > 0) && (k < mx_sc_elems);
1843 ++k, rem_sz -= ret_sz, ++sg) { 1843 ++k, rem_sz -= ret_sz, sg = sg_next(sg)) {
1844 1844
1845 num = (rem_sz > scatter_elem_sz_prev) ? 1845 num = (rem_sz > scatter_elem_sz_prev) ?
1846 scatter_elem_sz_prev : rem_sz; 1846 scatter_elem_sz_prev : rem_sz;
@@ -1913,7 +1913,7 @@ sg_write_xfer(Sg_request * srp)
1913 if (res) 1913 if (res)
1914 return res; 1914 return res;
1915 1915
1916 for (; p; ++sg, ksglen = sg->length, 1916 for (; p; sg = sg_next(sg), ksglen = sg->length,
1917 p = page_address(sg->page)) { 1917 p = page_address(sg->page)) {
1918 if (usglen <= 0) 1918 if (usglen <= 0)
1919 break; 1919 break;
@@ -1992,7 +1992,7 @@ sg_remove_scat(Sg_scatter_hold * schp)
1992 int k; 1992 int k;
1993 1993
1994 for (k = 0; (k < schp->k_use_sg) && sg->page; 1994 for (k = 0; (k < schp->k_use_sg) && sg->page;
1995 ++k, ++sg) { 1995 ++k, sg = sg_next(sg)) {
1996 SCSI_LOG_TIMEOUT(5, printk( 1996 SCSI_LOG_TIMEOUT(5, printk(
1997 "sg_remove_scat: k=%d, pg=0x%p, len=%d\n", 1997 "sg_remove_scat: k=%d, pg=0x%p, len=%d\n",
1998 k, sg->page, sg->length)); 1998 k, sg->page, sg->length));
@@ -2045,7 +2045,7 @@ sg_read_xfer(Sg_request * srp)
2045 if (res) 2045 if (res)
2046 return res; 2046 return res;
2047 2047
2048 for (; p; ++sg, ksglen = sg->length, 2048 for (; p; sg = sg_next(sg), ksglen = sg->length,
2049 p = page_address(sg->page)) { 2049 p = page_address(sg->page)) {
2050 if (usglen <= 0) 2050 if (usglen <= 0)
2051 break; 2051 break;
@@ -2092,7 +2092,7 @@ sg_read_oxfer(Sg_request * srp, char __user *outp, int num_read_xfer)
2092 if ((!outp) || (num_read_xfer <= 0)) 2092 if ((!outp) || (num_read_xfer <= 0))
2093 return 0; 2093 return 0;
2094 2094
2095 for (k = 0; (k < schp->k_use_sg) && sg->page; ++k, ++sg) { 2095 for (k = 0; (k < schp->k_use_sg) && sg->page; ++k, sg = sg_next(sg)) {
2096 num = sg->length; 2096 num = sg->length;
2097 if (num > num_read_xfer) { 2097 if (num > num_read_xfer) {
2098 if (__copy_to_user(outp, page_address(sg->page), 2098 if (__copy_to_user(outp, page_address(sg->page),
@@ -2142,7 +2142,7 @@ sg_link_reserve(Sg_fd * sfp, Sg_request * srp, int size)
2142 SCSI_LOG_TIMEOUT(4, printk("sg_link_reserve: size=%d\n", size)); 2142 SCSI_LOG_TIMEOUT(4, printk("sg_link_reserve: size=%d\n", size));
2143 rem = size; 2143 rem = size;
2144 2144
2145 for (k = 0; k < rsv_schp->k_use_sg; ++k, ++sg) { 2145 for (k = 0; k < rsv_schp->k_use_sg; ++k, sg = sg_next(sg)) {
2146 num = sg->length; 2146 num = sg->length;
2147 if (rem <= num) { 2147 if (rem <= num) {
2148 sfp->save_scat_len = num; 2148 sfp->save_scat_len = num;