/** * @brief get the first on bit * @param bm - the bitmap * @return int * @retval the bit number of the first on bit * @retval -1 on error */ int pbs_bitmap_first_on_bit(pbs_bitmap *bm) { if(pbs_bitmap_get_bit(bm, 0)) return 0; return pbs_bitmap_next_on_bit(bm, 0); }
/** * @brief update the node buckets associated with a node partition on * job/resv run/end * * @param[in] bkts - the buckets to update * @param[in] ninfo_arr - the nodes of the job/resv */ void update_buckets_for_node_array(node_bucket **bkts, node_info **ninfo_arr) { int i, j; if (bkts == NULL || ninfo_arr == NULL) return; for (i = 0; ninfo_arr[i] != NULL; i++) { for (j = 0; bkts[j] != NULL; j++) { int node_ind = ninfo_arr[i]->node_ind; /* Is this node in the bucket? */ if (pbs_bitmap_get_bit(bkts[j]->bkt_nodes, node_ind)) { /* First turn off the current bit */ if (pbs_bitmap_get_bit(bkts[j]->free_pool->truth, node_ind)) { pbs_bitmap_bit_off(bkts[j]->free_pool->truth, node_ind); bkts[j]->free_pool->truth_ct--; } else if (pbs_bitmap_get_bit(bkts[j]->busy_later_pool->truth, node_ind)) { pbs_bitmap_bit_off(bkts[j]->busy_later_pool->truth, node_ind); bkts[j]->busy_later_pool->truth_ct--; } else if (pbs_bitmap_get_bit(bkts[j]->busy_pool->truth, node_ind)) { pbs_bitmap_bit_off(bkts[j]->busy_pool->truth, node_ind); bkts[j]->busy_pool->truth_ct--; } /* Next, turn on the correct bit */ if (ninfo_arr[i]->num_jobs > 0 || ninfo_arr[i]->num_run_resv > 0) { pbs_bitmap_bit_on(bkts[j]->busy_pool->truth, node_ind); bkts[j]->busy_pool->truth_ct++; } else { if (ninfo_arr[i]->node_events != NULL) { pbs_bitmap_bit_on(bkts[j]->busy_later_pool->truth, node_ind); bkts[j]->busy_later_pool->truth_ct++; } else { pbs_bitmap_bit_on(bkts[j]->free_pool->truth, node_ind); bkts[j]->free_pool->truth_ct++; } } } } } }