Whamcloud - gitweb
LU-11152 lnd: test fpo_fmr_poool pointer instead of special bool 08/33408/4
authorJames Simmons <uja.ornl@yahoo.com>
Tue, 23 Oct 2018 03:39:46 +0000 (23:39 -0400)
committerOleg Drokin <green@whamcloud.com>
Fri, 2 Nov 2018 07:18:51 +0000 (07:18 +0000)
For the ko2iblnd driver it sets a fpo_is_fmr bool to tell use if
a pool was allocated. The name fpo_is_fmr is very misleading to
its function and its a weak test to tell us if a pool was allocated
in the FMR case. It is much easier to test the actually FMR pool
pointer then manually setting a bool flag to tell us if the FMR
pool is valide.

Test-Parameters: trivial
Change-Id: Ib5fa14f4a9d2b89efe5f453e0f243699894f3aeb
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/33408
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Amir Shehata <ashehata@whamcloud.com>
Reviewed-by: Sonia Sharma <sharmaso@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/klnds/o2iblnd/o2iblnd.c
lnet/klnds/o2iblnd/o2iblnd.h

index 98818ed..e28d596 100644 (file)
@@ -1459,8 +1459,9 @@ kiblnd_destroy_fmr_pool(struct kib_fmr_pool *fpo)
 {
        LASSERT(fpo->fpo_map_count == 0);
 
-       if (fpo->fpo_is_fmr && fpo->fmr.fpo_fmr_pool) {
+       if (!IS_ERR_OR_NULL(fpo->fmr.fpo_fmr_pool)) {
                ib_destroy_fmr_pool(fpo->fmr.fpo_fmr_pool);
+               fpo->fmr.fpo_fmr_pool = NULL;
        } else {
                struct kib_fast_reg_descriptor *frd, *tmp;
                int i = 0;
@@ -1539,7 +1540,6 @@ static int kiblnd_alloc_fmr_pool(struct kib_fmr_poolset *fps,
                else
                        CERROR("FMRs are not supported\n");
        }
-       fpo->fpo_is_fmr = true;
 
        return rc;
 }
@@ -1551,8 +1551,6 @@ static int kiblnd_alloc_freg_pool(struct kib_fmr_poolset *fps,
        struct kib_fast_reg_descriptor *frd, *tmp;
        int i, rc;
 
-       fpo->fpo_is_fmr = false;
-
        INIT_LIST_HEAD(&fpo->fast_reg.fpo_pool_list);
        fpo->fast_reg.fpo_pool_size = 0;
        for (i = 0; i < fps->fps_pool_size; i++) {
@@ -1784,7 +1782,7 @@ kiblnd_fmr_pool_unmap(struct kib_fmr *fmr, int status)
                return;
 
        fps = fpo->fpo_owner;
-       if (fpo->fpo_is_fmr) {
+       if (!IS_ERR_OR_NULL(fpo->fmr.fpo_fmr_pool)) {
                if (fmr->fmr_pfmr) {
                        rc = ib_fmr_pool_unmap(fmr->fmr_pfmr);
                        LASSERT(!rc);
@@ -1846,7 +1844,7 @@ again:
                fpo->fpo_deadline = ktime_get_seconds() + IBLND_POOL_DEADLINE;
                fpo->fpo_map_count++;
 
-               if (fpo->fpo_is_fmr) {
+               if (!IS_ERR_OR_NULL(fpo->fmr.fpo_fmr_pool)) {
                        struct ib_pool_fmr *pfmr;
 
                        spin_unlock(&fps->fps_lock);
index ddee13d..747c670 100644 (file)
@@ -349,7 +349,6 @@ struct kib_fmr_pool {
        time64_t                fpo_deadline;   /* deadline of this pool */
        int                     fpo_failed;     /* fmr pool is failed */
        int                     fpo_map_count;  /* # of mapped FMR */
-       bool                    fpo_is_fmr; /* True if FMR pools allocated */
 };
 
 struct kib_fmr {