mirror of
https://github.com/torvalds/linux.git
synced 2024-11-16 00:52:01 +00:00
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>
This commit is contained in:
parent
5edadbd0ae
commit
73fc4f0d2c
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
@ -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);
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user