aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-10-23 03:17:53 -0400
committerJens Axboe <jens.axboe@oracle.com>2007-10-23 03:17:53 -0400
commit73fc4f0d2ce4a92c36b00649c58e0a068a6cdfa4 (patch)
treed13ebf925ccfbd5cf4b12ccf703a6a3bb09bcfcb /drivers
parent5edadbd0ae35d2daabaf6b44f2c58d67d4021ed2 (diff)
s390 zfcp: sg fixups
Based on initial patch from Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/s390/scsi/zfcp_aux.c1
-rw-r--r--drivers/s390/scsi/zfcp_def.h4
-rw-r--r--drivers/s390/scsi/zfcp_erp.c10
3 files changed, 9 insertions, 6 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 7507067351bd..fd5d0c1570df 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -559,6 +559,7 @@ zfcp_sg_list_alloc(struct zfcp_sg_list *sg_list, size_t size)
559 retval = -ENOMEM; 559 retval = -ENOMEM;
560 goto out; 560 goto out;
561 } 561 }
562 sg_init_table(sg_list->sg, sg_list->count);
562 563
563 for (i = 0, sg = sg_list->sg; i < sg_list->count; i++, sg++) { 564 for (i = 0, sg = sg_list->sg; i < sg_list->count; i++, sg++) {
564 sg->length = min(size, PAGE_SIZE); 565 sg->length = min(size, PAGE_SIZE);
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 57cac7008e0b..326e7ee232cb 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -63,7 +63,7 @@
63static inline void * 63static inline void *
64zfcp_sg_to_address(struct scatterlist *list) 64zfcp_sg_to_address(struct scatterlist *list)
65{ 65{
66 return (void *) (page_address(list->page) + list->offset); 66 return sg_virt(list);
67} 67}
68 68
69/** 69/**
@@ -74,7 +74,7 @@ zfcp_sg_to_address(struct scatterlist *list)
74static inline void 74static inline void
75zfcp_address_to_sg(void *address, struct scatterlist *list) 75zfcp_address_to_sg(void *address, struct scatterlist *list)
76{ 76{
77 list->page = virt_to_page(address); 77 sg_set_page(list, virt_to_page(address));
78 list->offset = ((unsigned long) address) & (PAGE_SIZE - 1); 78 list->offset = ((unsigned long) address) & (PAGE_SIZE - 1);
79} 79}
80 80
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index a6475a2bb8a7..9438d0b28799 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -308,13 +308,15 @@ zfcp_erp_adisc(struct zfcp_port *port)
308 if (send_els == NULL) 308 if (send_els == NULL)
309 goto nomem; 309 goto nomem;
310 310
311 send_els->req = kzalloc(sizeof(struct scatterlist), GFP_ATOMIC); 311 send_els->req = kmalloc(sizeof(struct scatterlist), GFP_ATOMIC);
312 if (send_els->req == NULL) 312 if (send_els->req == NULL)
313 goto nomem; 313 goto nomem;
314 sg_init_table(send_els->req, 1);
314 315
315 send_els->resp = kzalloc(sizeof(struct scatterlist), GFP_ATOMIC); 316 send_els->resp = kmalloc(sizeof(struct scatterlist), GFP_ATOMIC);
316 if (send_els->resp == NULL) 317 if (send_els->resp == NULL)
317 goto nomem; 318 goto nomem;
319 sg_init_table(send_els->resp, 1);
318 320
319 address = (void *) get_zeroed_page(GFP_ATOMIC); 321 address = (void *) get_zeroed_page(GFP_ATOMIC);
320 if (address == NULL) 322 if (address == NULL)
@@ -363,7 +365,7 @@ zfcp_erp_adisc(struct zfcp_port *port)
363 retval = -ENOMEM; 365 retval = -ENOMEM;
364 freemem: 366 freemem:
365 if (address != NULL) 367 if (address != NULL)
366 __free_pages(send_els->req->page, 0); 368 __free_pages(sg_page(send_els->req), 0);
367 if (send_els != NULL) { 369 if (send_els != NULL) {
368 kfree(send_els->req); 370 kfree(send_els->req);
369 kfree(send_els->resp); 371 kfree(send_els->resp);
@@ -437,7 +439,7 @@ zfcp_erp_adisc_handler(unsigned long data)
437 439
438 out: 440 out:
439 zfcp_port_put(port); 441 zfcp_port_put(port);
440 __free_pages(send_els->req->page, 0); 442 __free_pages(sg_page(send_els->req), 0);
441 kfree(send_els->req); 443 kfree(send_els->req);
442 kfree(send_els->resp); 444 kfree(send_els->resp);
443 kfree(send_els); 445 kfree(send_els);