Whamcloud - gitweb
LU-11961 nodemap: nodemap_create() handles default nodemap
[fs/lustre-release.git] / lustre / ptlrpc / nodemap_storage.c
index 1b522a1..0a7602e 100644 (file)
@@ -87,7 +87,7 @@ static void nodemap_cluster_key_init(struct nodemap_key *nk, unsigned int nm_id)
 static void nodemap_cluster_rec_init(union nodemap_rec *nr,
                                     const struct lu_nodemap *nodemap)
 {
-       CLASSERT(sizeof(nr->ncr.ncr_name) == sizeof(nodemap->nm_name));
+       BUILD_BUG_ON(sizeof(nr->ncr.ncr_name) != sizeof(nodemap->nm_name));
 
        strncpy(nr->ncr.ncr_name, nodemap->nm_name, sizeof(nr->ncr.ncr_name));
        nr->ncr.ncr_squash_uid = cpu_to_le32(nodemap->nm_squash_uid);
@@ -249,7 +249,7 @@ static int nodemap_idx_insert(const struct lu_env *env,
        struct dt_device *dev = lu2dt_dev(idx->do_lu.lo_dev);
        int rc;
 
-       CLASSERT(sizeof(union nodemap_rec) == 32);
+       BUILD_BUG_ON(sizeof(union nodemap_rec) != 32);
 
        th = dt_trans_create(env, dev);
 
@@ -671,7 +671,7 @@ static int nodemap_process_keyrec(struct nodemap_config *config,
 
        ENTRY;
 
-       CLASSERT(sizeof(union nodemap_rec) == 32);
+       BUILD_BUG_ON(sizeof(union nodemap_rec) != 32);
 
        nodemap_id = le32_to_cpu(key->nk_nodemap_id);
        type = nodemap_get_key_type(key);
@@ -722,7 +722,6 @@ static int nodemap_process_keyrec(struct nodemap_config *config,
                        if (nodemap_id == LUSTRE_NODEMAP_DEFAULT_ID) {
                                nodemap = nodemap_create(rec->ncr.ncr_name,
                                                         config, 1);
-                               config->nmc_default_nodemap = nodemap;
                        } else {
                                nodemap = nodemap_create(rec->ncr.ncr_name,
                                                         config, 0);
@@ -937,10 +936,10 @@ out:
 
        if (new_config->nmc_default_nodemap == NULL) {
                /* new MGS won't have a default nm on disk, so create it here */
-               new_config->nmc_default_nodemap =
+               struct lu_nodemap *nodemap =
                        nodemap_create(DEFAULT_NODEMAP, new_config, 1);
-               if (IS_ERR(new_config->nmc_default_nodemap)) {
-                       rc = PTR_ERR(new_config->nmc_default_nodemap);
+               if (IS_ERR(nodemap)) {
+                       rc = PTR_ERR(nodemap);
                } else {
                        rc = nodemap_idx_nodemap_add_update(
                                        new_config->nmc_default_nodemap,