Lines Matching refs:blk

197 	u32                       blk;  member
257 #define bat_entry(s, blk) ((s)->bat.bat.bat[(blk)]) argument
316 set_batmap(struct vhd_state *s, uint32_t blk) in set_batmap() argument
319 vhd_batmap_set(&s->vhd, &s->bat.batmap, blk); in set_batmap()
320 DBG(TLOG_DBG, "block 0x%x completely full\n", blk); in set_batmap()
325 test_batmap(struct vhd_state *s, uint32_t blk) in test_batmap() argument
329 return vhd_batmap_test(&s->vhd, &s->bat.batmap, blk); in test_batmap()
960 bm->blk = 0; in init_vhd_bitmap()
979 if (bm && bm->blk == block) in get_bitmap()
1029 DBG(TLOG_DBG, "bitmap 0x%04x full\n", bm->blk); in bitmap_full()
1058 alloc_vhd_bitmap(struct vhd_state *s, struct vhd_bitmap **bitmap, uint32_t blk) in alloc_vhd_bitmap() argument
1073 bm->blk = blk; in alloc_vhd_bitmap()
1141 u32 blk, sec; in read_bitmap_cache() local
1148 blk = sector / s->spb; in read_bitmap_cache()
1151 if (blk > s->vhd.header.max_bat_size) { in read_bitmap_cache()
1157 if (bat_entry(s, blk) == DD_BLK_UNUSED) { in read_bitmap_cache()
1159 s->bat.pbw_blk != blk && bat_locked(s)) in read_bitmap_cache()
1165 if (test_batmap(s, blk)) { in read_bitmap_cache()
1166 DBG(TLOG_DBG, "batmap set for 0x%04x\n", blk); in read_bitmap_cache()
1170 bm = get_bitmap(s, blk); in read_bitmap_cache()
1189 u32 blk, sec; in read_bitmap_cache_span() local
1197 blk = sector / s->spb; in read_bitmap_cache_span()
1199 if (test_batmap(s, blk)) in read_bitmap_cache_span()
1202 bm = get_bitmap(s, blk); in read_bitmap_cache_span()
1268 reserve_new_block(struct vhd_state *s, uint32_t blk) in reserve_new_block() argument
1278 s->bat.pbw_blk = blk; in reserve_new_block()
1288 u32 blk; in schedule_bat_write() local
1297 blk = s->bat.pbw_blk; in schedule_bat_write()
1300 memcpy(buf, &bat_entry(s, blk - (blk % 128)), 512); in schedule_bat_write()
1302 ((u32 *)buf)[blk % 128] = s->bat.pbw_offset; in schedule_bat_write()
1307 offset = s->vhd.header.table_offset + (blk - (blk % 128)) * 4; in schedule_bat_write()
1317 "table_offset: 0x%08"PRIx64"\n", blk, s->bat.pbw_offset, offset); in schedule_bat_write()
1347 update_bat(struct vhd_state *s, uint32_t blk) in update_bat() argument
1353 ASSERT(bat_entry(s, blk) == DD_BLK_UNUSED); in update_bat()
1356 ASSERT(s->bat.pbw_blk == blk); in update_bat()
1362 bm = get_bitmap(s, blk); in update_bat()
1365 err = alloc_vhd_bitmap(s, &bm, blk); in update_bat()
1373 lb_end = reserve_new_block(s, blk); in update_bat()
1381 allocate_block(struct vhd_state *s, uint32_t blk) in allocate_block() argument
1388 ASSERT(bat_entry(s, blk) == DD_BLK_UNUSED); in allocate_block()
1391 ASSERT(s->bat.pbw_blk == blk); in allocate_block()
1398 s->bat.pbw_blk = blk; in allocate_block()
1410 blk, s->bat.pbw_offset); in allocate_block()
1427 bm = get_bitmap(s, blk); in allocate_block()
1430 err = alloc_vhd_bitmap(s, &bm, blk); in allocate_block()
1449 u32 blk = 0, sec = 0; in schedule_data_read() local
1458 blk = treq.sec / s->spb; in schedule_data_read()
1460 bm = get_bitmap(s, blk); in schedule_data_read()
1461 offset = bat_entry(s, blk); in schedule_data_read()
1464 ASSERT(test_batmap(s, blk) || (bm && bitmap_valid(bm))); in schedule_data_read()
1483 s->vhd.file, treq.sec, blk, sec, treq.secs, offset, req->flags, in schedule_data_read()
1494 u32 blk = 0, sec = 0; in schedule_data_write() local
1503 blk = treq.sec / s->spb; in schedule_data_write()
1505 offset = bat_entry(s, blk); in schedule_data_write()
1509 err = allocate_block(s, blk); in schedule_data_write()
1511 err = update_bat(s, blk); in schedule_data_write()
1533 bm = get_bitmap(s, blk); in schedule_data_write()
1548 s->vhd.file, treq.sec, blk, sec, treq.secs, offset, req->flags); in schedule_data_write()
1554 schedule_bitmap_read(struct vhd_state *s, uint32_t blk) in schedule_bitmap_read() argument
1563 offset = bat_entry(s, blk); in schedule_bitmap_read()
1566 ASSERT(!get_bitmap(s, blk)); in schedule_bitmap_read()
1570 err = alloc_vhd_bitmap(s, &bm, blk); in schedule_bitmap_read()
1577 req->treq.sec = blk * s->spb; in schedule_bitmap_read()
1590 "offset: 0x%08"PRIx64"\n", s->vhd.file, req->treq.sec, blk, in schedule_bitmap_read()
1597 schedule_bitmap_write(struct vhd_state *s, uint32_t blk) in schedule_bitmap_write() argument
1603 bm = get_bitmap(s, blk); in schedule_bitmap_write()
1604 offset = bat_entry(s, blk); in schedule_bitmap_write()
1611 ASSERT(bat_locked(s) && s->bat.pbw_blk == blk); in schedule_bitmap_write()
1620 req->treq.sec = blk * s->spb; in schedule_bitmap_write()
1633 "offset: 0x%"PRIx64"\n", s->vhd.file, blk, req->treq.sec, in schedule_bitmap_write()
1644 u32 blk; in __vhd_queue_request() local
1650 blk = treq.sec / s->spb; in __vhd_queue_request()
1651 bm = get_bitmap(s, blk); in __vhd_queue_request()
1667 "op: %u\n", s->vhd.file, treq.sec, blk, treq.secs, op); in __vhd_queue_request()
1870 DBG(TLOG_DBG, "blk: 0x%04x\n", bm->blk); in start_new_bitmap_transaction()
1876 if (r && bat_entry(s, bm->blk) == DD_BLK_UNUSED) in start_new_bitmap_transaction()
1910 if (s->bat.pbw_blk != bm->blk) in finish_bat_transaction()
1923 DBG(TLOG_DBG, "blk: 0x%04x\n", bm->blk); in finish_bat_transaction()
1935 DBG(TLOG_DBG, "blk: 0x%04x, err: %d\n", bm->blk, error); in finish_bitmap_transaction()
1942 ASSERT(bm->blk == s->bat.pbw_blk); in finish_bitmap_transaction()
1956 if (!test_batmap(s, bm->blk) && bitmap_full(s, bm)) in finish_bitmap_transaction()
1957 set_batmap(s, bm->blk); in finish_bitmap_transaction()
1976 DBG(TLOG_DBG, "blk: 0x%04x\n", bm->blk); in finish_data_transaction()
1981 return schedule_bitmap_write(s, bm->blk); in finish_data_transaction()
2030 u32 blk; in finish_zero_bm_write() local
2038 blk = req->treq.sec / s->spb; in finish_zero_bm_write()
2039 bm = get_bitmap(s, blk); in finish_zero_bm_write()
2041 DBG(TLOG_DBG, "blk: 0x%04x\n", blk); in finish_zero_bm_write()
2043 ASSERT(s->bat.pbw_blk == blk); in finish_zero_bm_write()
2064 u32 blk; in finish_bitmap_read() local
2072 blk = req->treq.sec / s->spb; in finish_bitmap_read()
2073 bm = get_bitmap(s, blk); in finish_bitmap_read()
2075 DBG(TLOG_DBG, "blk: 0x%04x\n", blk); in finish_bitmap_read()
2116 u32 blk; in finish_bitmap_write() local
2124 blk = req->treq.sec / s->spb; in finish_bitmap_write()
2125 bm = get_bitmap(s, blk); in finish_bitmap_write()
2129 blk, tx->started, tx->finished); in finish_bitmap_write()
2159 u32 blk, sec; in finish_data_write() local
2162 blk = req->treq.sec / s->spb; in finish_data_write()
2164 bm = get_bitmap(s, blk); in finish_data_write()
2296 i, bm->blk, bm->status, bm->queue.head, qnum, bm->waiting.head, in vhd_debug()