Lines Matching defs:zone_num
443 static int sm_erase_block(struct sm_ftl *ftl, int zone_num, uint16_t block,
446 struct ftl_zone *zone = &ftl->zones[zone_num];
452 erase.addr = sm_mkoffset(ftl, zone_num, block, 0);
461 if (zone_num == 0 && (block == ftl->cis_block || block == 0)) {
468 block, zone_num);
477 block, zone_num);
487 sm_mark_block_bad(ftl, zone_num, block);
746 static int sm_init_zone(struct sm_ftl *ftl, int zone_num)
748 struct ftl_zone *zone = &ftl->zones[zone_num];
755 dbg("initializing zone %d", zone_num);
775 if (zone_num == 0 && block <= ftl->cis_block)
779 if (sm_read_sector(ftl, zone_num, block, 0, NULL, &oob))
821 lba, zone->lba_to_phys_table[lba], block, zone_num);
824 if (sm_check_block(ftl, zone_num, block))
828 if (sm_check_block(ftl, zone_num,
839 sm_erase_block(ftl, zone_num, block, 1);
848 sm_printk("no free blocks in zone %d", zone_num);
866 struct ftl_zone *sm_get_zone(struct sm_ftl *ftl, int zone_num)
871 BUG_ON(zone_num >= ftl->zone_count);
872 zone = &ftl->zones[zone_num];
875 error = sm_init_zone(ftl, zone_num);
922 int zone_num = ftl->cache_zone;
931 BUG_ON(zone_num < 0);
932 zone = &ftl->zones[zone_num];
941 zone_num, block_num, sector_num * SM_SECTOR_SIZE,
962 if (sm_write_block(ftl, ftl->cache_data, zone_num, write_sector,
971 sm_erase_block(ftl, zone_num, block_num, 1);
1004 int zone_num, block, boffset;
1006 sm_break_offset(ftl, sect_no << 9, &zone_num, &block, &boffset);
1010 zone = sm_get_zone(ftl, zone_num);
1017 if (ftl->cache_zone == zone_num && ftl->cache_block == block) {
1031 if (sm_read_sector(ftl, zone_num, block, boffset, buf, NULL)) {
1049 int error, zone_num, block, boffset;
1052 sm_break_offset(ftl, sec_no << 9, &zone_num, &block, &boffset);
1058 zone = sm_get_zone(ftl, zone_num);
1065 if (ftl->cache_block != block || ftl->cache_zone != zone_num) {
1072 ftl->cache_zone = zone_num;