Lines Matching refs:zone_num

464 static int sm_erase_block(struct sm_ftl *ftl, int zone_num, uint16_t block,  in sm_erase_block()  argument
467 struct ftl_zone *zone = &ftl->zones[zone_num]; in sm_erase_block()
471 erase.addr = sm_mkoffset(ftl, zone_num, block, 0); in sm_erase_block()
479 if (zone_num == 0 && (block == ftl->cis_block || block == 0)) { in sm_erase_block()
486 block, zone_num); in sm_erase_block()
496 sm_mark_block_bad(ftl, zone_num, block); in sm_erase_block()
752 static int sm_init_zone(struct sm_ftl *ftl, int zone_num) in sm_init_zone() argument
754 struct ftl_zone *zone = &ftl->zones[zone_num]; in sm_init_zone()
761 dbg("initializing zone %d", zone_num); in sm_init_zone()
781 if (zone_num == 0 && block <= ftl->cis_block) in sm_init_zone()
785 if (sm_read_sector(ftl, zone_num, block, 0, NULL, &oob)) { in sm_init_zone()
834 lba, zone->lba_to_phys_table[lba], block, zone_num); in sm_init_zone()
837 if (sm_check_block(ftl, zone_num, block)) in sm_init_zone()
841 if (sm_check_block(ftl, zone_num, in sm_init_zone()
852 sm_erase_block(ftl, zone_num, block, 1); in sm_init_zone()
862 sm_printk("no free blocks in zone %d", zone_num); in sm_init_zone()
880 static struct ftl_zone *sm_get_zone(struct sm_ftl *ftl, int zone_num) in sm_get_zone() argument
885 BUG_ON(zone_num >= ftl->zone_count); in sm_get_zone()
886 zone = &ftl->zones[zone_num]; in sm_get_zone()
889 error = sm_init_zone(ftl, zone_num); in sm_get_zone()
936 int zone_num = ftl->cache_zone; in sm_cache_flush() local
945 BUG_ON(zone_num < 0); in sm_cache_flush()
946 zone = &ftl->zones[zone_num]; in sm_cache_flush()
955 zone_num, block_num, sector_num * SM_SECTOR_SIZE, in sm_cache_flush()
977 if (sm_write_block(ftl, ftl->cache_data, zone_num, write_sector, in sm_cache_flush()
986 sm_erase_block(ftl, zone_num, block_num, 1); in sm_cache_flush()
1019 int zone_num, block, boffset; in sm_read() local
1021 sm_break_offset(ftl, sect_no << 9, &zone_num, &block, &boffset); in sm_read()
1025 zone = sm_get_zone(ftl, zone_num); in sm_read()
1032 if (ftl->cache_zone == zone_num && ftl->cache_block == block) { in sm_read()
1046 if (sm_read_sector(ftl, zone_num, block, boffset, buf, NULL)) { in sm_read()
1064 int error = 0, zone_num, block, boffset; in sm_write() local
1067 sm_break_offset(ftl, sec_no << 9, &zone_num, &block, &boffset); in sm_write()
1073 zone = sm_get_zone(ftl, zone_num); in sm_write()
1080 if (ftl->cache_block != block || ftl->cache_zone != zone_num) { in sm_write()
1087 ftl->cache_zone = zone_num; in sm_write()