Lines Matching refs:sip

498 static void sdebug_erase_store(int idx, struct sdeb_store_info *sip);
871 static void *lba2fake_store(struct sdeb_store_info *sip, in lba2fake_store() argument
874 struct sdeb_store_info *lsip = sip; in lba2fake_store()
877 if (!sip || !sip->storep) { in lba2fake_store()
884 static struct t10_pi_tuple *dif_store(struct sdeb_store_info *sip, in dif_store() argument
889 return sip->dif_storep + sector; in dif_store()
2902 static int do_device_access(struct sdeb_store_info *sip, struct scsi_cmnd *scp, in do_device_access() argument
2918 if (!sdb->length || !sip) in do_device_access()
2922 fsp = sip->storep; in do_device_access()
2960 static bool comp_write_worker(struct sdeb_store_info *sip, u64 lba, u32 num, in comp_write_worker() argument
2967 u8 *fsp = sip->storep; in comp_write_worker()
3034 struct sdeb_store_info *sip = devip2sip((struct sdebug_dev_info *) in dif_copy_prot() local
3036 struct t10_pi_tuple *dif_storep = sip->dif_storep; in dif_copy_prot()
3049 void *start = dif_store(sip, sector); in dif_copy_prot()
3080 struct sdeb_store_info *sip = devip2sip((struct sdebug_dev_info *) in prot_verify_read() local
3088 sdt = dif_store(sip, sector); in prot_verify_read()
3093 ret = dif_verify(sdt, lba2fake_store(sip, sector), sector, in prot_verify_read()
3114 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_read_dt0() local
3115 rwlock_t *macc_lckp = sip ? &sip->macc_lck : &sdeb_fake_rw_lck; in resp_read_dt0()
3207 ret = do_device_access(sip, scp, 0, lba, num, false); in resp_read_dt0()
3345 static unsigned int map_state(struct sdeb_store_info *sip, sector_t lba, in map_state() argument
3354 mapped = test_bit(index, sip->map_storep); in map_state()
3357 next = find_next_zero_bit(sip->map_storep, map_size, index); in map_state()
3359 next = find_next_bit(sip->map_storep, map_size, index); in map_state()
3366 static void map_region(struct sdeb_store_info *sip, sector_t lba, in map_region() argument
3375 set_bit(index, sip->map_storep); in map_region()
3381 static void unmap_region(struct sdeb_store_info *sip, sector_t lba, in unmap_region() argument
3385 u8 *fsp = sip->storep; in unmap_region()
3393 clear_bit(index, sip->map_storep); in unmap_region()
3400 if (sip->dif_storep) { in unmap_region()
3401 memset(sip->dif_storep + lba, 0xff, in unmap_region()
3402 sizeof(*sip->dif_storep) * in unmap_region()
3417 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_write_dt0() local
3418 rwlock_t *macc_lckp = &sip->macc_lck; in resp_write_dt0()
3491 ret = do_device_access(sip, scp, 0, lba, num, true); in resp_write_dt0()
3493 map_region(sip, lba, num); in resp_write_dt0()
3536 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_write_scat() local
3537 rwlock_t *macc_lckp = &sip->macc_lck; in resp_write_scat()
3648 ret = do_device_access(sip, scp, sg_off, lba, num, true); in resp_write_scat()
3653 map_region(sip, lba, num); in resp_write_scat()
3702 struct sdeb_store_info *sip = devip2sip((struct sdebug_dev_info *) in resp_write_same() local
3704 rwlock_t *macc_lckp = &sip->macc_lck; in resp_write_same()
3717 unmap_region(sip, lba, num); in resp_write_same()
3723 fsp = sip->storep; in resp_write_same()
3732 write_unlock(&sip->macc_lck); in resp_write_same()
3746 map_region(sip, lba, num); in resp_write_same()
3863 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_comp_write() local
3864 rwlock_t *macc_lckp = &sip->macc_lck; in resp_comp_write()
3907 if (!comp_write_worker(sip, lba, num, arr, false)) { in resp_comp_write()
3913 map_region(sip, lba, num); in resp_comp_write()
3930 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_unmap() local
3931 rwlock_t *macc_lckp = &sip->macc_lck; in resp_unmap()
3970 unmap_region(sip, lba, num); in resp_unmap()
4004 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_get_lba_status() local
4006 mapped = map_state(sip, lba, &num); in resp_get_lba_status()
4067 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_pre_fetch() local
4068 rwlock_t *macc_lckp = &sip->macc_lck; in resp_pre_fetch()
4069 u8 *fsp = sip->storep; in resp_pre_fetch()
4215 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_verify() local
4216 rwlock_t *macc_lckp = &sip->macc_lck; in resp_verify()
4269 if (!comp_write_worker(sip, lba, vnum, arr, true)) { in resp_verify()
4294 struct sdeb_store_info *sip = devip2sip(devip, false); in resp_report_zones() local
4295 rwlock_t *macc_lckp = sip ? &sip->macc_lck : &sdeb_fake_rw_lck; in resp_report_zones()
4435 struct sdeb_store_info *sip = devip2sip(devip, false); in resp_open_zone() local
4436 rwlock_t *macc_lckp = sip ? &sip->macc_lck : &sdeb_fake_rw_lck; in resp_open_zone()
4512 struct sdeb_store_info *sip = devip2sip(devip, false); in resp_close_zone() local
4513 rwlock_t *macc_lckp = sip ? &sip->macc_lck : &sdeb_fake_rw_lck; in resp_close_zone()
4585 struct sdeb_store_info *sip = devip2sip(devip, false); in resp_finish_zone() local
4586 rwlock_t *macc_lckp = sip ? &sip->macc_lck : &sdeb_fake_rw_lck; in resp_finish_zone()
4661 struct sdeb_store_info *sip = devip2sip(devip, false); in resp_rwp_zone() local
4662 rwlock_t *macc_lckp = sip ? &sip->macc_lck : &sdeb_fake_rw_lck; in resp_rwp_zone()
5793 struct sdeb_store_info *sip; in scsi_debug_show_info() local
5806 xa_for_each(per_store_ap, l_idx, sip) { in scsi_debug_show_info()
6300 struct sdeb_store_info *sip; in add_host_store() local
6310 xa_for_each_marked(per_store_ap, idx, sip, in add_host_store()
6417 struct sdeb_store_info *sip = xa_load(per_store_ap, 0); in map_show() local
6419 if (sip) in map_show()
6421 (int)map_size, sip->map_storep); in map_show()
6897 static void sdebug_erase_store(int idx, struct sdeb_store_info *sip) in sdebug_erase_store() argument
6901 if (!sip) { in sdebug_erase_store()
6904 sip = xa_load(per_store_ap, idx); in sdebug_erase_store()
6905 if (!sip) in sdebug_erase_store()
6908 vfree(sip->map_storep); in sdebug_erase_store()
6909 vfree(sip->dif_storep); in sdebug_erase_store()
6910 vfree(sip->storep); in sdebug_erase_store()
6912 kfree(sip); in sdebug_erase_store()
6919 struct sdeb_store_info *sip = NULL; in sdebug_erase_all_stores() local
6921 xa_for_each(per_store_ap, idx, sip) { in sdebug_erase_all_stores()
6925 sdebug_erase_store(idx, sip); in sdebug_erase_all_stores()
6941 struct sdeb_store_info *sip = NULL; in sdebug_add_store() local
6944 sip = kzalloc(sizeof(*sip), GFP_KERNEL); in sdebug_add_store()
6945 if (!sip) in sdebug_add_store()
6949 res = __xa_alloc(per_store_ap, &n_idx, sip, xal, GFP_ATOMIC); in sdebug_add_store()
6952 kfree(sip); in sdebug_add_store()
6962 sip->storep = vzalloc(sz); in sdebug_add_store()
6963 if (!sip->storep) { in sdebug_add_store()
6968 sdebug_build_parts(sip->storep, sz); in sdebug_add_store()
6975 sip->dif_storep = vmalloc(dif_size); in sdebug_add_store()
6978 sip->dif_storep); in sdebug_add_store()
6980 if (!sip->dif_storep) { in sdebug_add_store()
6984 memset(sip->dif_storep, 0xff, dif_size); in sdebug_add_store()
6989 sip->map_storep = vmalloc(array_size(sizeof(long), in sdebug_add_store()
6994 if (!sip->map_storep) { in sdebug_add_store()
6999 bitmap_zero(sip->map_storep, map_size); in sdebug_add_store()
7003 map_region(sip, 0, 2); in sdebug_add_store()
7006 rwlock_init(&sip->macc_lck); in sdebug_add_store()
7009 sdebug_erase_store((int)n_idx, sip); in sdebug_add_store()