Whamcloud - gitweb
LU-12477 llite: remove unused ll_teardown_mmaps()
[fs/lustre-release.git] / lustre / mdt / mdt_hsm_cdt_agent.c
index 2bce139..1767e11 100644 (file)
@@ -135,8 +135,7 @@ int mdt_hsm_agent_register(struct mdt_thread_info *mti,
 out_free:
 
        if (ha != NULL && ha->ha_archive_id != NULL)
-               OBD_FREE(ha->ha_archive_id,
-                        ha->ha_archive_cnt * sizeof(*ha->ha_archive_id));
+               OBD_FREE_PTR_ARRAY(ha->ha_archive_id, ha->ha_archive_cnt);
        if (ha != NULL)
                OBD_FREE_PTR(ha);
 out:
@@ -165,13 +164,13 @@ int mdt_hsm_agent_register_mask(struct mdt_thread_info *mti,
        nr_archives = hweight32(archive_mask);
 
        if (nr_archives != 0) {
-               OBD_ALLOC(archive_id, nr_archives * sizeof(*archive_id));
+               OBD_ALLOC_PTR_ARRAY(archive_id, nr_archives);
                if (!archive_id)
                        RETURN(-ENOMEM);
 
                nr_archives = 0;
                for (i = 0; i < sizeof(archive_mask) * 8; i++) {
-                       if ((1 << i) & archive_mask) {
+                       if (BIT(i) & archive_mask) {
                                archive_id[nr_archives] = i + 1;
                                nr_archives++;
                        }
@@ -181,7 +180,7 @@ int mdt_hsm_agent_register_mask(struct mdt_thread_info *mti,
        rc = mdt_hsm_agent_register(mti, uuid, nr_archives, archive_id);
 
        if (archive_id != NULL)
-               OBD_FREE(archive_id, nr_archives * sizeof(*archive_id));
+               OBD_FREE_PTR_ARRAY(archive_id, nr_archives);
 
        RETURN(rc);
 }
@@ -217,8 +216,7 @@ int mdt_hsm_agent_unregister(struct mdt_thread_info *mti,
                GOTO(out, rc = -ENOENT);
 
        if (ha->ha_archive_cnt != 0)
-               OBD_FREE(ha->ha_archive_id,
-                        ha->ha_archive_cnt * sizeof(*ha->ha_archive_id));
+               OBD_FREE_PTR_ARRAY(ha->ha_archive_id, ha->ha_archive_cnt);
        OBD_FREE_PTR(ha);
 
        GOTO(out, rc = 0);
@@ -327,9 +325,9 @@ int mdt_hsm_send_action_to_each_archive(struct mdt_thread_info *mti,
        list_for_each_entry(ha, &cdt->cdt_agents, ha_list) {
                for (i = 0; (i < ha->ha_archive_cnt); i++) {
                        /* only send once for each archive_id */
-                       if ((1 << ha->ha_archive_id[i]) & archive_mask)
+                       if (BIT(ha->ha_archive_id[i]) & archive_mask)
                                continue;
-                       archive_mask |= (1 << ha->ha_archive_id[i]);
+                       archive_mask |= BIT(ha->ha_archive_id[i]);
 
                        /* XXX: it could make sense to gather all
                         * actions for the same archive_id like in