Commit ab67ed8d authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Doug Ledford

IB: remove the write-only usecnt field from struct ib_mr

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarBart Van Assche <bvanassche@sandisk.com>
Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 7cf9ff64
...@@ -993,7 +993,6 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file, ...@@ -993,7 +993,6 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file,
mr->pd = pd; mr->pd = pd;
mr->uobject = uobj; mr->uobject = uobj;
atomic_inc(&pd->usecnt); atomic_inc(&pd->usecnt);
atomic_set(&mr->usecnt, 0);
uobj->object = mr; uobj->object = mr;
ret = idr_add_uobj(&ib_uverbs_mr_idr, uobj); ret = idr_add_uobj(&ib_uverbs_mr_idr, uobj);
...@@ -1091,11 +1090,6 @@ ssize_t ib_uverbs_rereg_mr(struct ib_uverbs_file *file, ...@@ -1091,11 +1090,6 @@ ssize_t ib_uverbs_rereg_mr(struct ib_uverbs_file *file,
} }
} }
if (atomic_read(&mr->usecnt)) {
ret = -EBUSY;
goto put_uobj_pd;
}
old_pd = mr->pd; old_pd = mr->pd;
ret = mr->device->rereg_user_mr(mr, cmd.flags, cmd.start, ret = mr->device->rereg_user_mr(mr, cmd.flags, cmd.start,
cmd.length, cmd.hca_va, cmd.length, cmd.hca_va,
......
...@@ -1345,7 +1345,6 @@ struct ib_mr *ib_get_dma_mr(struct ib_pd *pd, int mr_access_flags) ...@@ -1345,7 +1345,6 @@ struct ib_mr *ib_get_dma_mr(struct ib_pd *pd, int mr_access_flags)
mr->pd = pd; mr->pd = pd;
mr->uobject = NULL; mr->uobject = NULL;
atomic_inc(&pd->usecnt); atomic_inc(&pd->usecnt);
atomic_set(&mr->usecnt, 0);
} }
return mr; return mr;
...@@ -1354,13 +1353,9 @@ EXPORT_SYMBOL(ib_get_dma_mr); ...@@ -1354,13 +1353,9 @@ EXPORT_SYMBOL(ib_get_dma_mr);
int ib_dereg_mr(struct ib_mr *mr) int ib_dereg_mr(struct ib_mr *mr)
{ {
struct ib_pd *pd; struct ib_pd *pd = mr->pd;
int ret; int ret;
if (atomic_read(&mr->usecnt))
return -EBUSY;
pd = mr->pd;
ret = mr->device->dereg_mr(mr); ret = mr->device->dereg_mr(mr);
if (!ret) if (!ret)
atomic_dec(&pd->usecnt); atomic_dec(&pd->usecnt);
...@@ -1396,7 +1391,6 @@ struct ib_mr *ib_alloc_mr(struct ib_pd *pd, ...@@ -1396,7 +1391,6 @@ struct ib_mr *ib_alloc_mr(struct ib_pd *pd,
mr->pd = pd; mr->pd = pd;
mr->uobject = NULL; mr->uobject = NULL;
atomic_inc(&pd->usecnt); atomic_inc(&pd->usecnt);
atomic_set(&mr->usecnt, 0);
} }
return mr; return mr;
......
...@@ -458,9 +458,6 @@ static int iwch_dereg_mr(struct ib_mr *ib_mr) ...@@ -458,9 +458,6 @@ static int iwch_dereg_mr(struct ib_mr *ib_mr)
u32 mmid; u32 mmid;
PDBG("%s ib_mr %p\n", __func__, ib_mr); PDBG("%s ib_mr %p\n", __func__, ib_mr);
/* There can be no memory windows */
if (atomic_read(&ib_mr->usecnt))
return -EINVAL;
mhp = to_iwch_mr(ib_mr); mhp = to_iwch_mr(ib_mr);
kfree(mhp->pages); kfree(mhp->pages);
......
...@@ -704,9 +704,6 @@ int c4iw_dereg_mr(struct ib_mr *ib_mr) ...@@ -704,9 +704,6 @@ int c4iw_dereg_mr(struct ib_mr *ib_mr)
u32 mmid; u32 mmid;
PDBG("%s ib_mr %p\n", __func__, ib_mr); PDBG("%s ib_mr %p\n", __func__, ib_mr);
/* There can be no memory windows */
if (atomic_read(&ib_mr->usecnt))
return -EINVAL;
mhp = to_c4iw_mr(ib_mr); mhp = to_c4iw_mr(ib_mr);
rhp = mhp->rhp; rhp = mhp->rhp;
......
...@@ -1339,7 +1339,6 @@ int ehca_reg_internal_maxmr( ...@@ -1339,7 +1339,6 @@ int ehca_reg_internal_maxmr(
e_mr->ib.ib_mr.pd = &e_pd->ib_pd; e_mr->ib.ib_mr.pd = &e_pd->ib_pd;
e_mr->ib.ib_mr.uobject = NULL; e_mr->ib.ib_mr.uobject = NULL;
atomic_inc(&(e_pd->ib_pd.usecnt)); atomic_inc(&(e_pd->ib_pd.usecnt));
atomic_set(&(e_mr->ib.ib_mr.usecnt), 0);
*e_maxmr = e_mr; *e_maxmr = e_mr;
return 0; return 0;
......
...@@ -1414,7 +1414,6 @@ struct ib_mr { ...@@ -1414,7 +1414,6 @@ struct ib_mr {
u64 iova; u64 iova;
u32 length; u32 length;
unsigned int page_size; unsigned int page_size;
atomic_t usecnt; /* count number of MWs */
}; };
struct ib_mw { struct ib_mw {
......
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