Lines Matching refs:lba
872 unsigned long long lba) in lba2fake_store() argument
876 lba = do_div(lba, sdebug_store_sectors); in lba2fake_store()
881 return lsip->storep + lba * sdebug_sector_size; in lba2fake_store()
2677 unsigned long long lba) in zbc_zone() argument
2679 return &devip->zstate[lba >> devip->zsize_shift]; in zbc_zone()
2775 unsigned long long lba, unsigned int num) in zbc_inc_wp() argument
2777 struct sdeb_zone_state *zsp = zbc_zone(devip, lba); in zbc_inc_wp()
2791 if (lba != zsp->z_wp) in zbc_inc_wp()
2794 end = lba + num; in zbc_inc_wp()
2796 n = zend - lba; in zbc_inc_wp()
2808 lba += n; in zbc_inc_wp()
2817 unsigned long long lba, unsigned int num, bool write) in check_zbc_access_params() argument
2821 struct sdeb_zone_state *zsp = zbc_zone(devip, lba); in check_zbc_access_params()
2822 struct sdeb_zone_state *zsp_end = zbc_zone(devip, lba + num - 1); in check_zbc_access_params()
2865 if (lba != zsp->z_wp) { in check_zbc_access_params()
2889 (struct scsi_cmnd *scp, unsigned long long lba, in check_device_access_params() argument
2895 if (lba + num > sdebug_capacity) { in check_device_access_params()
2910 return check_zbc_access_params(scp, lba, num, write); in check_device_access_params()
2933 u32 sg_skip, u64 lba, u32 num, bool do_write) in do_device_access() argument
2954 block = do_div(lba, sdebug_store_sectors); in do_device_access()
2990 static bool comp_write_worker(struct sdeb_store_info *sip, u64 lba, u32 num, in comp_write_worker() argument
2999 block = do_div(lba, store_blks); in comp_write_worker()
3143 u64 lba; in resp_read_dt0() local
3151 lba = get_unaligned_be64(cmd + 2); in resp_read_dt0()
3157 lba = get_unaligned_be32(cmd + 2); in resp_read_dt0()
3163 lba = (u32)cmd[3] | (u32)cmd[2] << 8 | in resp_read_dt0()
3170 lba = get_unaligned_be32(cmd + 2); in resp_read_dt0()
3176 lba = get_unaligned_be32(cmd + 2); in resp_read_dt0()
3181 lba = get_unaligned_be64(cmd + 12); in resp_read_dt0()
3205 ret = check_device_access_params(scp, lba, num, false); in resp_read_dt0()
3209 (lba <= (sdebug_medium_error_start + sdebug_medium_error_count - 1)) && in resp_read_dt0()
3210 ((lba + num) > sdebug_medium_error_start))) { in resp_read_dt0()
3216 ret = (lba < OPT_MEDIUM_ERR_ADDR) in resp_read_dt0()
3217 ? OPT_MEDIUM_ERR_ADDR : (int)lba; in resp_read_dt0()
3228 int prot_ret = prot_verify_read(scp, lba, num, ei_lba); in resp_read_dt0()
3237 ret = do_device_access(sip, scp, 0, lba, num, false); in resp_read_dt0()
3358 static unsigned long lba_to_map_index(sector_t lba) in lba_to_map_index() argument
3361 lba += sdebug_unmap_granularity - sdebug_unmap_alignment; in lba_to_map_index()
3362 sector_div(lba, sdebug_unmap_granularity); in lba_to_map_index()
3363 return lba; in lba_to_map_index()
3368 sector_t lba = index * sdebug_unmap_granularity; in map_index_to_lba() local
3371 lba -= sdebug_unmap_granularity - sdebug_unmap_alignment; in map_index_to_lba()
3372 return lba; in map_index_to_lba()
3375 static unsigned int map_state(struct sdeb_store_info *sip, sector_t lba, in map_state() argument
3383 index = lba_to_map_index(lba); in map_state()
3392 *num = end - lba; in map_state()
3396 static void map_region(struct sdeb_store_info *sip, sector_t lba, in map_region() argument
3399 sector_t end = lba + len; in map_region()
3401 while (lba < end) { in map_region()
3402 unsigned long index = lba_to_map_index(lba); in map_region()
3407 lba = map_index_to_lba(index + 1); in map_region()
3411 static void unmap_region(struct sdeb_store_info *sip, sector_t lba, in unmap_region() argument
3414 sector_t end = lba + len; in unmap_region()
3417 while (lba < end) { in unmap_region()
3418 unsigned long index = lba_to_map_index(lba); in unmap_region()
3420 if (lba == map_index_to_lba(index) && in unmap_region()
3421 lba + sdebug_unmap_granularity <= end && in unmap_region()
3425 memset(fsp + lba * sdebug_sector_size, in unmap_region()
3431 memset(sip->dif_storep + lba, 0xff, in unmap_region()
3436 lba = map_index_to_lba(index + 1); in unmap_region()
3446 u64 lba; in resp_write_dt0() local
3454 lba = get_unaligned_be64(cmd + 2); in resp_write_dt0()
3460 lba = get_unaligned_be32(cmd + 2); in resp_write_dt0()
3466 lba = (u32)cmd[3] | (u32)cmd[2] << 8 | in resp_write_dt0()
3473 lba = get_unaligned_be32(cmd + 2); in resp_write_dt0()
3479 lba = get_unaligned_be32(cmd + 2); in resp_write_dt0()
3484 lba = get_unaligned_be64(cmd + 12); in resp_write_dt0()
3504 ret = check_device_access_params(scp, lba, num, true); in resp_write_dt0()
3512 int prot_ret = prot_verify_write(scp, lba, num, ei_lba); in resp_write_dt0()
3521 ret = do_device_access(sip, scp, 0, lba, num, true); in resp_write_dt0()
3523 map_region(sip, lba, num); in resp_write_dt0()
3526 zbc_inc_wp(devip, lba, num); in resp_write_dt0()
3573 u64 lba; in resp_write_scat() local
3640 lba = get_unaligned_be64(up + 0); in resp_write_scat()
3645 my_name, __func__, k, lba, num, sg_off); in resp_write_scat()
3648 ret = check_device_access_params(scp, lba, num, true); in resp_write_scat()
3667 int prot_ret = prot_verify_write(scp, lba, num, in resp_write_scat()
3678 ret = do_device_access(sip, scp, sg_off, lba, num, true); in resp_write_scat()
3681 zbc_inc_wp(devip, lba, num); in resp_write_scat()
3683 map_region(sip, lba, num); in resp_write_scat()
3723 static int resp_write_same(struct scsi_cmnd *scp, u64 lba, u32 num, in resp_write_same() argument
3740 ret = check_device_access_params(scp, lba, num, true); in resp_write_same()
3747 unmap_region(sip, lba, num); in resp_write_same()
3750 lbaa = lba; in resp_write_same()
3771 lbaa = lba + i; in resp_write_same()
3776 map_region(sip, lba, num); in resp_write_same()
3779 zbc_inc_wp(devip, lba, num); in resp_write_same()
3790 u32 lba; in resp_write_same_10() local
3802 lba = get_unaligned_be32(cmd + 2); in resp_write_same_10()
3808 return resp_write_same(scp, lba, num, ei_lba, unmap, false); in resp_write_same_10()
3815 u64 lba; in resp_write_same_16() local
3830 lba = get_unaligned_be64(cmd + 2); in resp_write_same_16()
3836 return resp_write_same(scp, lba, num, ei_lba, unmap, ndob); in resp_write_same_16()
3895 u64 lba; in resp_comp_write() local
3902 lba = get_unaligned_be64(cmd + 2); in resp_comp_write()
3916 ret = check_device_access_params(scp, lba, num, false); in resp_comp_write()
3937 if (!comp_write_worker(sip, lba, num, arr, false)) { in resp_comp_write()
3943 map_region(sip, lba, num); in resp_comp_write()
3951 __be64 lba; member
3993 unsigned long long lba = get_unaligned_be64(&desc[i].lba); in resp_unmap() local
3996 ret = check_device_access_params(scp, lba, num, true); in resp_unmap()
4000 unmap_region(sip, lba, num); in resp_unmap()
4018 u64 lba; in resp_get_lba_status() local
4023 lba = get_unaligned_be64(cmd + 2); in resp_get_lba_status()
4029 ret = check_device_access_params(scp, lba, 1, false); in resp_get_lba_status()
4036 mapped = map_state(sip, lba, &num); in resp_get_lba_status()
4041 if (sdebug_capacity - lba <= 0xffffffff) in resp_get_lba_status()
4042 num = sdebug_capacity - lba; in resp_get_lba_status()
4049 put_unaligned_be64(lba, arr + 8); /* LBA */ in resp_get_lba_status()
4060 u64 lba; in resp_sync_cache() local
4065 lba = get_unaligned_be32(cmd + 2); in resp_sync_cache()
4068 lba = get_unaligned_be64(cmd + 2); in resp_sync_cache()
4071 if (lba + num_blocks > sdebug_capacity) { in resp_sync_cache()
4093 u64 lba; in resp_pre_fetch() local
4102 lba = get_unaligned_be32(cmd + 2); in resp_pre_fetch()
4105 lba = get_unaligned_be64(cmd + 2); in resp_pre_fetch()
4108 if (lba + nblks > sdebug_capacity) { in resp_pre_fetch()
4115 block = do_div(lba, sdebug_store_sectors); in resp_pre_fetch()
4242 u64 lba; in resp_verify() local
4259 lba = get_unaligned_be64(cmd + 2); in resp_verify()
4263 lba = get_unaligned_be32(cmd + 2); in resp_verify()
4274 ret = check_device_access_params(scp, lba, a_num, false); in resp_verify()
4301 if (!comp_write_worker(sip, lba, vnum, arr, true)) { in resp_verify()
4322 u64 lba, zs_lba; in resp_report_zones() local
4360 lba = zs_lba + devip->zsize * i; in resp_report_zones()
4361 if (lba > sdebug_capacity) in resp_report_zones()
4363 zsp = zbc_zone(devip, lba); in resp_report_zones()