Commit 73fc4f0d authored by Jens Axboe's avatar Jens Axboe

s390 zfcp: sg fixups

Based on initial patch from Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 5edadbd0
...@@ -559,6 +559,7 @@ zfcp_sg_list_alloc(struct zfcp_sg_list *sg_list, size_t size) ...@@ -559,6 +559,7 @@ zfcp_sg_list_alloc(struct zfcp_sg_list *sg_list, size_t size)
retval = -ENOMEM; retval = -ENOMEM;
goto out; goto out;
} }
sg_init_table(sg_list->sg, sg_list->count);
for (i = 0, sg = sg_list->sg; i < sg_list->count; i++, sg++) { for (i = 0, sg = sg_list->sg; i < sg_list->count; i++, sg++) {
sg->length = min(size, PAGE_SIZE); sg->length = min(size, PAGE_SIZE);
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
static inline void * static inline void *
zfcp_sg_to_address(struct scatterlist *list) zfcp_sg_to_address(struct scatterlist *list)
{ {
return (void *) (page_address(list->page) + list->offset); return sg_virt(list);
} }
/** /**
...@@ -74,7 +74,7 @@ zfcp_sg_to_address(struct scatterlist *list) ...@@ -74,7 +74,7 @@ zfcp_sg_to_address(struct scatterlist *list)
static inline void static inline void
zfcp_address_to_sg(void *address, struct scatterlist *list) zfcp_address_to_sg(void *address, struct scatterlist *list)
{ {
list->page = virt_to_page(address); sg_set_page(list, virt_to_page(address));
list->offset = ((unsigned long) address) & (PAGE_SIZE - 1); list->offset = ((unsigned long) address) & (PAGE_SIZE - 1);
} }
......
...@@ -308,13 +308,15 @@ zfcp_erp_adisc(struct zfcp_port *port) ...@@ -308,13 +308,15 @@ zfcp_erp_adisc(struct zfcp_port *port)
if (send_els == NULL) if (send_els == NULL)
goto nomem; goto nomem;
send_els->req = kzalloc(sizeof(struct scatterlist), GFP_ATOMIC); send_els->req = kmalloc(sizeof(struct scatterlist), GFP_ATOMIC);
if (send_els->req == NULL) if (send_els->req == NULL)
goto nomem; goto nomem;
sg_init_table(send_els->req, 1);
send_els->resp = kzalloc(sizeof(struct scatterlist), GFP_ATOMIC); send_els->resp = kmalloc(sizeof(struct scatterlist), GFP_ATOMIC);
if (send_els->resp == NULL) if (send_els->resp == NULL)
goto nomem; goto nomem;
sg_init_table(send_els->resp, 1);
address = (void *) get_zeroed_page(GFP_ATOMIC); address = (void *) get_zeroed_page(GFP_ATOMIC);
if (address == NULL) if (address == NULL)
...@@ -363,7 +365,7 @@ zfcp_erp_adisc(struct zfcp_port *port) ...@@ -363,7 +365,7 @@ zfcp_erp_adisc(struct zfcp_port *port)
retval = -ENOMEM; retval = -ENOMEM;
freemem: freemem:
if (address != NULL) if (address != NULL)
__free_pages(send_els->req->page, 0); __free_pages(sg_page(send_els->req), 0);
if (send_els != NULL) { if (send_els != NULL) {
kfree(send_els->req); kfree(send_els->req);
kfree(send_els->resp); kfree(send_els->resp);
...@@ -437,7 +439,7 @@ zfcp_erp_adisc_handler(unsigned long data) ...@@ -437,7 +439,7 @@ zfcp_erp_adisc_handler(unsigned long data)
out: out:
zfcp_port_put(port); zfcp_port_put(port);
__free_pages(send_els->req->page, 0); __free_pages(sg_page(send_els->req), 0);
kfree(send_els->req); kfree(send_els->req);
kfree(send_els->resp); kfree(send_els->resp);
kfree(send_els); kfree(send_els);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment