Lines Matching refs:boffset
192 static loff_t sm_mkoffset(struct sm_ftl *ftl, int zone, int block, int boffset) in sm_mkoffset() argument
194 WARN_ON(boffset & (SM_SECTOR_SIZE - 1)); in sm_mkoffset()
197 WARN_ON(boffset >= ftl->block_size); in sm_mkoffset()
202 return (zone * SM_MAX_ZONE_SIZE + block) * ftl->block_size + boffset; in sm_mkoffset()
207 int *zone, int *block, int *boffset) in sm_break_offset() argument
210 *boffset = do_div(offset, ftl->block_size); in sm_break_offset()
238 int zone, int block, int boffset, in sm_read_sector() argument
270 if (zone == 0 && block == ftl->cis_block && boffset == in sm_read_sector()
282 ret = mtd_read_oob(mtd, sm_mkoffset(ftl, zone, block, boffset), &ops); in sm_read_sector()
323 int zone, int block, int boffset, in sm_write_sector() argument
347 ret = mtd_write_oob(mtd, sm_mkoffset(ftl, zone, block, boffset), &ops); in sm_write_sector()
375 int boffset; in sm_write_block() local
385 for (boffset = 0; boffset < ftl->block_size; in sm_write_block()
386 boffset += SM_SECTOR_SIZE) { in sm_write_block()
390 if (test_bit(boffset / SM_SECTOR_SIZE, &invalid_bitmap)) { in sm_write_block()
394 boffset / SM_SECTOR_SIZE, lba, zone); in sm_write_block()
400 ecc_sw_hamming_calculate(buf + boffset, in sm_write_block()
404 ecc_sw_hamming_calculate(buf + boffset + SM_SMALL_PAGE, in sm_write_block()
408 if (!sm_write_sector(ftl, zone, block, boffset, in sm_write_block()
409 buf + boffset, &oob)) in sm_write_block()
439 int boffset; in sm_mark_block_bad() local
456 for (boffset = 0; boffset < ftl->block_size; boffset += SM_SECTOR_SIZE) in sm_mark_block_bad()
457 sm_write_sector(ftl, zone, block, boffset, NULL, &oob); in sm_mark_block_bad()
503 int boffset; in sm_check_block() local
514 for (boffset = 0; boffset < ftl->block_size; in sm_check_block()
515 boffset += SM_SECTOR_SIZE) { in sm_check_block()
518 if (sm_read_sector(ftl, zone, block, boffset, NULL, &oob)) in sm_check_block()
683 int block, boffset; in sm_find_cis() local
703 for (boffset = 0 ; boffset < ftl->block_size; in sm_find_cis()
704 boffset += SM_SECTOR_SIZE) { in sm_find_cis()
706 if (sm_read_sector(ftl, 0, block, boffset, NULL, &oob)) in sm_find_cis()
714 if (boffset == ftl->block_size) in sm_find_cis()
718 ftl->cis_boffset = boffset; in sm_find_cis()
731 boffset + ftl->cis_page_offset); in sm_find_cis()
911 static void sm_cache_put(struct sm_ftl *ftl, char *buffer, int boffset) in sm_cache_put() argument
913 memcpy(ftl->cache_data + boffset, buffer, SM_SECTOR_SIZE); in sm_cache_put()
914 clear_bit(boffset / SM_SECTOR_SIZE, &ftl->cache_data_invalid_bitmap); in sm_cache_put()
919 static int sm_cache_get(struct sm_ftl *ftl, char *buffer, int boffset) in sm_cache_get() argument
921 if (test_bit(boffset / SM_SECTOR_SIZE, in sm_cache_get()
925 memcpy(buffer, ftl->cache_data + boffset, SM_SECTOR_SIZE); in sm_cache_get()
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()
1034 if (!sm_cache_get(ftl, buf, boffset)) in sm_read()
1046 if (sm_read_sector(ftl, zone_num, block, boffset, buf, NULL)) { in sm_read()
1052 sm_cache_put(ftl, buf, boffset); 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()
1090 sm_cache_put(ftl, buf, boffset); in sm_write()