Whamcloud - gitweb
LU-8130 lov: convert lo[v|d]_pool to use rhashtable
[fs/lustre-release.git] / lustre / lod / lod_lov.c
index e449db6..37f2b2c 100644 (file)
@@ -76,13 +76,11 @@ void lod_putref(struct lod_device *lod, struct lod_tgt_descs *ltd)
        ltd->ltd_refcount--;
        if (ltd->ltd_refcount == 0 && ltd->ltd_death_row) {
                struct lod_tgt_desc *tgt_desc, *tmp;
-               struct list_head kill;
+               LIST_HEAD(kill);
 
                CDEBUG(D_CONFIG, "destroying %d ltd desc\n",
                       ltd->ltd_death_row);
 
-               INIT_LIST_HEAD(&kill);
-
                ltd_foreach_tgt_safe(ltd, tgt_desc, tmp) {
                        LASSERT(tgt_desc);
                        if (!tgt_desc->ltd_reap)
@@ -1913,6 +1911,24 @@ recheck:
                                        RETURN(rc);
                                }
                        }
+                       /* Any stripe count is forbidden on DoM component */
+                       if (lum->lmm_stripe_count) {
+                               CDEBUG(D_LAYOUT,
+                                      "invalid DoM layout stripe count %u, must be 0\n",
+                                      le16_to_cpu(lum->lmm_stripe_count));
+                               RETURN(-EINVAL);
+                       }
+
+                       /* Any pool is forbidden on DoM component */
+                       if (lum->lmm_magic == LOV_USER_MAGIC_V3) {
+                               struct lov_user_md_v3 *v3 = (void *)lum;
+
+                               if (v3->lmm_pool_name[0] != '\0') {
+                                       CDEBUG(D_LAYOUT,
+                                              "DoM component cannot have pool assigned\n");
+                                       RETURN(-EINVAL);
+                               }
+                       }
                }
 
                prev_end = le64_to_cpu(ext->e_end);
@@ -2093,14 +2109,9 @@ int lod_pools_init(struct lod_device *lod, struct lustre_cfg *lcfg)
        lod->lod_sp_me = LUSTRE_SP_CLI;
 
        /* Set up OST pool environment */
-       lod->lod_pools_hash_body = cfs_hash_create("POOLS", HASH_POOLS_CUR_BITS,
-                                                  HASH_POOLS_MAX_BITS,
-                                                  HASH_POOLS_BKT_BITS, 0,
-                                                  CFS_HASH_MIN_THETA,
-                                                  CFS_HASH_MAX_THETA,
-                                                  &pool_hash_operations,
-                                                  CFS_HASH_DEFAULT);
-       if (lod->lod_pools_hash_body == NULL)
+       lod->lod_pool_count = 0;
+       rc = lod_pool_hash_init(&lod->lod_pools_hash_body);
+       if (rc)
                RETURN(-ENOMEM);
 
        INIT_LIST_HEAD(&lod->lod_pool_list);
@@ -2130,7 +2141,7 @@ out_mdt_rr_pool:
 out_mdt_pool:
        lod_tgt_pool_free(&lod->lod_mdt_descs.ltd_tgt_pool);
 out_hash:
-       cfs_hash_putref(lod->lod_pools_hash_body);
+       lod_pool_hash_destroy(&lod->lod_pools_hash_body);
 
        return rc;
 }
@@ -2157,7 +2168,7 @@ int lod_pools_fini(struct lod_device *lod)
                lod_pool_del(obd, pool->pool_name);
        }
 
-       cfs_hash_putref(lod->lod_pools_hash_body);
+       lod_pool_hash_destroy(&lod->lod_pools_hash_body);
        lod_tgt_pool_free(&lod->lod_ost_descs.ltd_qos.lq_rr.lqr_pool);
        lod_tgt_pool_free(&lod->lod_ost_descs.ltd_tgt_pool);
        lod_tgt_pool_free(&lod->lod_mdt_descs.ltd_qos.lq_rr.lqr_pool);