Skip to content

Commit

Permalink
s390 zfcp: sg fixups
Browse files Browse the repository at this point in the history
Based on initial patch from Heiko Carstens <heiko.carstens@de.ibm.com>

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Jens Axboe committed Oct 23, 2007
1 parent 5edadbd commit 73fc4f0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions drivers/s390/scsi/zfcp_aux.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ zfcp_sg_list_alloc(struct zfcp_sg_list *sg_list, size_t size)
retval = -ENOMEM;
goto out;
}
sg_init_table(sg_list->sg, sg_list->count);

for (i = 0, sg = sg_list->sg; i < sg_list->count; i++, sg++) {
sg->length = min(size, PAGE_SIZE);
Expand Down
4 changes: 2 additions & 2 deletions drivers/s390/scsi/zfcp_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
static inline void *
zfcp_sg_to_address(struct scatterlist *list)
{
return (void *) (page_address(list->page) + list->offset);
return sg_virt(list);
}

/**
Expand All @@ -74,7 +74,7 @@ zfcp_sg_to_address(struct scatterlist *list)
static inline void
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);
}

Expand Down
10 changes: 6 additions & 4 deletions drivers/s390/scsi/zfcp_erp.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,15 @@ zfcp_erp_adisc(struct zfcp_port *port)
if (send_els == NULL)
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)
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)
goto nomem;
sg_init_table(send_els->resp, 1);

address = (void *) get_zeroed_page(GFP_ATOMIC);
if (address == NULL)
Expand Down Expand Up @@ -363,7 +365,7 @@ zfcp_erp_adisc(struct zfcp_port *port)
retval = -ENOMEM;
freemem:
if (address != NULL)
__free_pages(send_els->req->page, 0);
__free_pages(sg_page(send_els->req), 0);
if (send_els != NULL) {
kfree(send_els->req);
kfree(send_els->resp);
Expand Down Expand Up @@ -437,7 +439,7 @@ zfcp_erp_adisc_handler(unsigned long data)

out:
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->resp);
kfree(send_els);
Expand Down

0 comments on commit 73fc4f0

Please sign in to comment.