فهرست منبع

[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>
Michael S. Tsirkin 19 سال پیش
والد
کامیت
adfaa888a2
4فایلهای تغییر یافته به همراه7 افزوده شده و 7 حذف شده
  1. 4 4
      drivers/infiniband/core/fmr_pool.c
  2. 1 1
      drivers/infiniband/ulp/iser/iser_verbs.c
  3. 1 1
      drivers/infiniband/ulp/srp/ib_srp.c
  4. 1 1
      include/rdma/ib_fmr_pool.h

+ 4 - 4
drivers/infiniband/core/fmr_pool.c

@@ -426,7 +426,7 @@ EXPORT_SYMBOL(ib_flush_fmr_pool);
 struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,
 struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,
 					 u64                *page_list,
 					 u64                *page_list,
 					 int                 list_len,
 					 int                 list_len,
-					 u64                *io_virtual_address)
+					 u64                 io_virtual_address)
 {
 {
 	struct ib_fmr_pool *pool = pool_handle;
 	struct ib_fmr_pool *pool = pool_handle;
 	struct ib_pool_fmr *fmr;
 	struct ib_pool_fmr *fmr;
@@ -440,7 +440,7 @@ struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,
 	fmr = ib_fmr_cache_lookup(pool,
 	fmr = ib_fmr_cache_lookup(pool,
 				  page_list,
 				  page_list,
 				  list_len,
 				  list_len,
-				  *io_virtual_address);
+				  io_virtual_address);
 	if (fmr) {
 	if (fmr) {
 		/* found in cache */
 		/* found in cache */
 		++fmr->ref_count;
 		++fmr->ref_count;
@@ -464,7 +464,7 @@ struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,
 	spin_unlock_irqrestore(&pool->pool_lock, flags);
 	spin_unlock_irqrestore(&pool->pool_lock, flags);
 
 
 	result = ib_map_phys_fmr(fmr->fmr, page_list, list_len,
 	result = ib_map_phys_fmr(fmr->fmr, page_list, list_len,
-				 *io_virtual_address);
+				 io_virtual_address);
 
 
 	if (result) {
 	if (result) {
 		spin_lock_irqsave(&pool->pool_lock, flags);
 		spin_lock_irqsave(&pool->pool_lock, flags);
@@ -481,7 +481,7 @@ struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,
 	fmr->ref_count = 1;
 	fmr->ref_count = 1;
 
 
 	if (pool->cache_bucket) {
 	if (pool->cache_bucket) {
-		fmr->io_virtual_address = *io_virtual_address;
+		fmr->io_virtual_address = io_virtual_address;
 		fmr->page_list_len      = list_len;
 		fmr->page_list_len      = list_len;
 		memcpy(fmr->page_list, page_list, list_len * sizeof(*page_list));
 		memcpy(fmr->page_list, page_list, list_len * sizeof(*page_list));
 
 

+ 1 - 1
drivers/infiniband/ulp/iser/iser_verbs.c

@@ -594,7 +594,7 @@ int iser_reg_page_vec(struct iser_conn     *ib_conn,
 	mem  = ib_fmr_pool_map_phys(ib_conn->fmr_pool,
 	mem  = ib_fmr_pool_map_phys(ib_conn->fmr_pool,
 				    page_list,
 				    page_list,
 				    page_vec->length,
 				    page_vec->length,
-				    &io_addr);
+				    io_addr);
 
 
 	if (IS_ERR(mem)) {
 	if (IS_ERR(mem)) {
 		status = (int)PTR_ERR(mem);
 		status = (int)PTR_ERR(mem);

+ 1 - 1
drivers/infiniband/ulp/srp/ib_srp.c

@@ -615,7 +615,7 @@ static int srp_map_fmr(struct srp_device *dev, struct scatterlist *scat,
 				(sg_dma_address(&scat[i]) & dev->fmr_page_mask) + j;
 				(sg_dma_address(&scat[i]) & dev->fmr_page_mask) + j;
 
 
 	req->fmr = ib_fmr_pool_map_phys(dev->fmr_pool,
 	req->fmr = ib_fmr_pool_map_phys(dev->fmr_pool,
-					dma_pages, page_cnt, &io_addr);
+					dma_pages, page_cnt, io_addr);
 	if (IS_ERR(req->fmr)) {
 	if (IS_ERR(req->fmr)) {
 		ret = PTR_ERR(req->fmr);
 		ret = PTR_ERR(req->fmr);
 		req->fmr = NULL;
 		req->fmr = NULL;

+ 1 - 1
include/rdma/ib_fmr_pool.h

@@ -88,7 +88,7 @@ int ib_flush_fmr_pool(struct ib_fmr_pool *pool);
 struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,
 struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,
 					 u64                *page_list,
 					 u64                *page_list,
 					 int                 list_len,
 					 int                 list_len,
-					 u64                *io_virtual_address);
+					 u64                 io_virtual_address);
 
 
 int ib_fmr_pool_unmap(struct ib_pool_fmr *fmr);
 int ib_fmr_pool_unmap(struct ib_pool_fmr *fmr);