Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] fmr pool: remove unnecessary pointer dereference

ib_fmr_pool_map_phys gets the virtual address by pointer but never writes
there, and users (e.g. srp) seem to assume this and ignore the value
returned. This patch cleans up the API to get the VA by value, and updates
all users.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Acked-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Michael S. Tsirkin and committed by
Linus Torvalds
adfaa888 74f76fba

+7 -7
+4 -4
drivers/infiniband/core/fmr_pool.c
··· 426 426 struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle, 427 427 u64 *page_list, 428 428 int list_len, 429 - u64 *io_virtual_address) 429 + u64 io_virtual_address) 430 430 { 431 431 struct ib_fmr_pool *pool = pool_handle; 432 432 struct ib_pool_fmr *fmr; ··· 440 440 fmr = ib_fmr_cache_lookup(pool, 441 441 page_list, 442 442 list_len, 443 - *io_virtual_address); 443 + io_virtual_address); 444 444 if (fmr) { 445 445 /* found in cache */ 446 446 ++fmr->ref_count; ··· 464 464 spin_unlock_irqrestore(&pool->pool_lock, flags); 465 465 466 466 result = ib_map_phys_fmr(fmr->fmr, page_list, list_len, 467 - *io_virtual_address); 467 + io_virtual_address); 468 468 469 469 if (result) { 470 470 spin_lock_irqsave(&pool->pool_lock, flags); ··· 481 481 fmr->ref_count = 1; 482 482 483 483 if (pool->cache_bucket) { 484 - fmr->io_virtual_address = *io_virtual_address; 484 + fmr->io_virtual_address = io_virtual_address; 485 485 fmr->page_list_len = list_len; 486 486 memcpy(fmr->page_list, page_list, list_len * sizeof(*page_list)); 487 487
+1 -1
drivers/infiniband/ulp/iser/iser_verbs.c
··· 594 594 mem = ib_fmr_pool_map_phys(ib_conn->fmr_pool, 595 595 page_list, 596 596 page_vec->length, 597 - &io_addr); 597 + io_addr); 598 598 599 599 if (IS_ERR(mem)) { 600 600 status = (int)PTR_ERR(mem);
+1 -1
drivers/infiniband/ulp/srp/ib_srp.c
··· 615 615 (sg_dma_address(&scat[i]) & dev->fmr_page_mask) + j; 616 616 617 617 req->fmr = ib_fmr_pool_map_phys(dev->fmr_pool, 618 - dma_pages, page_cnt, &io_addr); 618 + dma_pages, page_cnt, io_addr); 619 619 if (IS_ERR(req->fmr)) { 620 620 ret = PTR_ERR(req->fmr); 621 621 req->fmr = NULL;
+1 -1
include/rdma/ib_fmr_pool.h
··· 88 88 struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle, 89 89 u64 *page_list, 90 90 int list_len, 91 - u64 *io_virtual_address); 91 + u64 io_virtual_address); 92 92 93 93 int ib_fmr_pool_unmap(struct ib_pool_fmr *fmr); 94 94