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:
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++;
}
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);
}
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);
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
* the ldlm_callback_handler. Note this sends a request RPC
* from a server (MDT) to a client (MDC), backwards of normal comms.
*/
- exp = cfs_hash_lookup(mdt2obd_dev(mdt)->obd_uuid_hash, &uuid);
+ exp = obd_uuid_lookup(mdt2obd_dev(mdt), &uuid);
if (exp == NULL || exp->exp_disconnected) {
if (exp != NULL)
class_export_put(exp);