diff options
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r-- | drivers/scsi/sg.c | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index a8b05ce5de52..7405d0df95db 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -1139,32 +1139,6 @@ sg_fasync(int fd, struct file *filp, int mode) | |||
1139 | return (retval < 0) ? retval : 0; | 1139 | return (retval < 0) ? retval : 0; |
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | /* When startFinish==1 increments page counts for pages other than the | ||
1143 | first of scatter gather elements obtained from alloc_pages(). | ||
1144 | When startFinish==0 decrements ... */ | ||
1145 | static void | ||
1146 | sg_rb_correct4mmap(Sg_scatter_hold * rsv_schp, int startFinish) | ||
1147 | { | ||
1148 | struct scatterlist *sg = rsv_schp->buffer; | ||
1149 | struct page *page; | ||
1150 | int k, m; | ||
1151 | |||
1152 | SCSI_LOG_TIMEOUT(3, printk("sg_rb_correct4mmap: startFinish=%d, scatg=%d\n", | ||
1153 | startFinish, rsv_schp->k_use_sg)); | ||
1154 | /* N.B. correction _not_ applied to base page of each allocation */ | ||
1155 | for (k = 0; k < rsv_schp->k_use_sg; ++k, ++sg) { | ||
1156 | for (m = PAGE_SIZE; m < sg->length; m += PAGE_SIZE) { | ||
1157 | page = sg->page; | ||
1158 | if (startFinish) | ||
1159 | get_page(page); | ||
1160 | else { | ||
1161 | if (page_count(page) > 0) | ||
1162 | __put_page(page); | ||
1163 | } | ||
1164 | } | ||
1165 | } | ||
1166 | } | ||
1167 | |||
1168 | static struct page * | 1142 | static struct page * |
1169 | sg_vma_nopage(struct vm_area_struct *vma, unsigned long addr, int *type) | 1143 | sg_vma_nopage(struct vm_area_struct *vma, unsigned long addr, int *type) |
1170 | { | 1144 | { |
@@ -1236,10 +1210,7 @@ sg_mmap(struct file *filp, struct vm_area_struct *vma) | |||
1236 | sa += len; | 1210 | sa += len; |
1237 | } | 1211 | } |
1238 | 1212 | ||
1239 | if (0 == sfp->mmap_called) { | 1213 | sfp->mmap_called = 1; |
1240 | sg_rb_correct4mmap(rsv_schp, 1); /* do only once per fd lifetime */ | ||
1241 | sfp->mmap_called = 1; | ||
1242 | } | ||
1243 | vma->vm_flags |= VM_RESERVED; | 1214 | vma->vm_flags |= VM_RESERVED; |
1244 | vma->vm_private_data = sfp; | 1215 | vma->vm_private_data = sfp; |
1245 | vma->vm_ops = &sg_mmap_vm_ops; | 1216 | vma->vm_ops = &sg_mmap_vm_ops; |
@@ -2388,8 +2359,6 @@ __sg_remove_sfp(Sg_device * sdp, Sg_fd * sfp) | |||
2388 | SCSI_LOG_TIMEOUT(6, | 2359 | SCSI_LOG_TIMEOUT(6, |
2389 | printk("__sg_remove_sfp: bufflen=%d, k_use_sg=%d\n", | 2360 | printk("__sg_remove_sfp: bufflen=%d, k_use_sg=%d\n", |
2390 | (int) sfp->reserve.bufflen, (int) sfp->reserve.k_use_sg)); | 2361 | (int) sfp->reserve.bufflen, (int) sfp->reserve.k_use_sg)); |
2391 | if (sfp->mmap_called) | ||
2392 | sg_rb_correct4mmap(&sfp->reserve, 0); /* undo correction */ | ||
2393 | sg_remove_scat(&sfp->reserve); | 2362 | sg_remove_scat(&sfp->reserve); |
2394 | } | 2363 | } |
2395 | sfp->parentdp = NULL; | 2364 | sfp->parentdp = NULL; |
@@ -2471,9 +2440,9 @@ sg_page_malloc(int rqSz, int lowDma, int *retSzp) | |||
2471 | return resp; | 2440 | return resp; |
2472 | 2441 | ||
2473 | if (lowDma) | 2442 | if (lowDma) |
2474 | page_mask = GFP_ATOMIC | GFP_DMA | __GFP_NOWARN; | 2443 | page_mask = GFP_ATOMIC | GFP_DMA | __GFP_COMP | __GFP_NOWARN; |
2475 | else | 2444 | else |
2476 | page_mask = GFP_ATOMIC | __GFP_NOWARN; | 2445 | page_mask = GFP_ATOMIC | __GFP_COMP | __GFP_NOWARN; |
2477 | 2446 | ||
2478 | for (order = 0, a_size = PAGE_SIZE; a_size < rqSz; | 2447 | for (order = 0, a_size = PAGE_SIZE; a_size < rqSz; |
2479 | order++, a_size <<= 1) ; | 2448 | order++, a_size <<= 1) ; |