struct buf * blk_read(blk_nr_t blk_nr) { struct buf *bufp; bufp = blk_get(blk_nr); if (!bufp) kpanic("blk_read(): Null buffer block pointer"); if (!bufp->valid) ramfs_read(bufp); return bufp; }
void solve2() { // we need to manage concurrency at CPU level here to call multiple blocks for (unsigned bi=0;bi<M_H/B_H;++bi) { for (unsigned bj=0;bj<M_W/B_W;++bj) { blk_t blk = blk_get(bi,bj); // --------- Solving non-serial dependencies #if NONSERIAL>0 TC** c_list[2]={NULL,NULL}; // previous blocks list (0=vert,1=horz,2=diag) #if (NONSERIAL)&DIR_VERT c_list[0]=(TC**)malloc(bi*sizeof(TC**)); for (unsigned k=0;k<bi;++k) c_list[0][k]=(TC*)mm_alloc(bi-k-1,bj); #endif #if (NONSERIAL)&DIR_HORZ c_list[1]=(TC**)malloc(bj*sizeof(TC**)); for (unsigned k=0;k<bj;++k) c_list[1][k]=(TC*)mm_alloc(bi,bj-k-1); #endif blk_precompute2(&blk,c_list[0],c_list[1]); #if (NONSERIAL)&DIR_VERT for (unsigned k=0;k<bi;++k) mm_free(c_list[0][k]); free(c_list[0]); #endif #if (NONSERIAL)&DIR_HORZ for (unsigned k=0;k<bj;++k) mm_free(c_list[1][k]); free(c_list[1]); #endif #endif // --------- Block processing TC* c_prev[3]={NULL,NULL,NULL}; #if (POLYADIC)&(DIR_VERT|DIR_DIAG) if (bi>0) c_prev[0]=(TC*)mm_alloc(bi-1,bj); #endif #if (POLYADIC)&(DIR_HORZ|DIR_DIAG) if (bj>0) c_prev[1]=(TC*)mm_alloc(bi,bj-1); #endif #if (POLYADIC)&DIR_DIAG if (bi>0 && bj>0) c_prev[2]=(TC*)mm_alloc(bi-1,bj-1); #endif blk_solve2(&blk,c_prev[0],c_prev[1],c_prev[2]); #if (POLYADIC)&(DIR_VERT|DIR_DIAG) if (bi>0) mm_free(c_prev[0]); #endif #if (POLYADIC)&(DIR_HORZ|DIR_DIAG) if (bj>0) mm_free(c_prev[1]); #endif #if (POLYADIC)&DIR_DIAG if (bi>0 && bj>0) mm_free(c_prev[2]); #endif } } }