Lines Matching refs:sip
501 static void sdebug_erase_store(int idx, struct sdeb_store_info *sip);
875 static void *lba2fake_store(struct sdeb_store_info *sip, in lba2fake_store() argument
878 struct sdeb_store_info *lsip = sip; in lba2fake_store()
881 if (!sip || !sip->storep) { in lba2fake_store()
888 static struct t10_pi_tuple *dif_store(struct sdeb_store_info *sip, in dif_store() argument
893 return sip->dif_storep + sector; in dif_store()
2903 static int do_device_access(struct sdeb_store_info *sip, struct scsi_cmnd *scp, in do_device_access() argument
2919 if (!sdb->length || !sip) in do_device_access()
2923 fsp = sip->storep; in do_device_access()
2961 static bool comp_write_worker(struct sdeb_store_info *sip, u64 lba, u32 num, in comp_write_worker() argument
2968 u8 *fsp = sip->storep; in comp_write_worker()
3035 struct sdeb_store_info *sip = devip2sip((struct sdebug_dev_info *) in dif_copy_prot() local
3037 struct t10_pi_tuple *dif_storep = sip->dif_storep; in dif_copy_prot()
3050 void *start = dif_store(sip, sector); in dif_copy_prot()
3082 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()
3101 ret = dif_verify(sdt, lba2fake_store(sip, sector), in prot_verify_read()
3123 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_read_dt0() local
3124 rwlock_t *macc_lckp = sip ? &sip->macc_lck : &sdeb_fake_rw_lck; in resp_read_dt0()
3233 ret = do_device_access(sip, scp, 0, lba, num, false); in resp_read_dt0()
3349 static unsigned int map_state(struct sdeb_store_info *sip, sector_t lba, in map_state() argument
3358 mapped = test_bit(index, sip->map_storep); in map_state()
3361 next = find_next_zero_bit(sip->map_storep, map_size, index); in map_state()
3363 next = find_next_bit(sip->map_storep, map_size, index); in map_state()
3370 static void map_region(struct sdeb_store_info *sip, sector_t lba, in map_region() argument
3379 set_bit(index, sip->map_storep); in map_region()
3385 static void unmap_region(struct sdeb_store_info *sip, sector_t lba, in unmap_region() argument
3389 u8 *fsp = sip->storep; in unmap_region()
3397 clear_bit(index, sip->map_storep); in unmap_region()
3404 if (sip->dif_storep) { in unmap_region()
3405 memset(sip->dif_storep + lba, 0xff, in unmap_region()
3406 sizeof(*sip->dif_storep) * in unmap_region()
3421 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_write_dt0() local
3422 rwlock_t *macc_lckp = &sip->macc_lck; in resp_write_dt0()
3512 ret = do_device_access(sip, scp, 0, lba, num, true); in resp_write_dt0()
3514 map_region(sip, lba, num); in resp_write_dt0()
3557 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_write_scat() local
3558 rwlock_t *macc_lckp = &sip->macc_lck; in resp_write_scat()
3669 ret = do_device_access(sip, scp, sg_off, lba, num, true); in resp_write_scat()
3674 map_region(sip, lba, num); in resp_write_scat()
3723 struct sdeb_store_info *sip = devip2sip((struct sdebug_dev_info *) in resp_write_same() local
3725 rwlock_t *macc_lckp = &sip->macc_lck; in resp_write_same()
3738 unmap_region(sip, lba, num); in resp_write_same()
3744 fsp = sip->storep; in resp_write_same()
3753 write_unlock(&sip->macc_lck); in resp_write_same()
3767 map_region(sip, lba, num); in resp_write_same()
3884 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_comp_write() local
3885 rwlock_t *macc_lckp = &sip->macc_lck; in resp_comp_write()
3928 if (!comp_write_worker(sip, lba, num, arr, false)) { in resp_comp_write()
3934 map_region(sip, lba, num); in resp_comp_write()
3951 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_unmap() local
3952 rwlock_t *macc_lckp = &sip->macc_lck; in resp_unmap()
3991 unmap_region(sip, lba, num); in resp_unmap()
4025 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_get_lba_status() local
4027 mapped = map_state(sip, lba, &num); in resp_get_lba_status()
4088 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_pre_fetch() local
4089 rwlock_t *macc_lckp = &sip->macc_lck; in resp_pre_fetch()
4090 u8 *fsp = sip->storep; in resp_pre_fetch()
4236 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_verify() local
4237 rwlock_t *macc_lckp = &sip->macc_lck; in resp_verify()
4290 if (!comp_write_worker(sip, lba, vnum, arr, true)) { in resp_verify()
4315 struct sdeb_store_info *sip = devip2sip(devip, false); in resp_report_zones() local
4316 rwlock_t *macc_lckp = sip ? &sip->macc_lck : &sdeb_fake_rw_lck; in resp_report_zones()
4456 struct sdeb_store_info *sip = devip2sip(devip, false); in resp_open_zone() local
4457 rwlock_t *macc_lckp = sip ? &sip->macc_lck : &sdeb_fake_rw_lck; in resp_open_zone()
4533 struct sdeb_store_info *sip = devip2sip(devip, false); in resp_close_zone() local
4534 rwlock_t *macc_lckp = sip ? &sip->macc_lck : &sdeb_fake_rw_lck; in resp_close_zone()
4606 struct sdeb_store_info *sip = devip2sip(devip, false); in resp_finish_zone() local
4607 rwlock_t *macc_lckp = sip ? &sip->macc_lck : &sdeb_fake_rw_lck; in resp_finish_zone()
4682 struct sdeb_store_info *sip = devip2sip(devip, false); in resp_rwp_zone() local
4683 rwlock_t *macc_lckp = sip ? &sip->macc_lck : &sdeb_fake_rw_lck; in resp_rwp_zone()
5846 struct sdeb_store_info *sip; in scsi_debug_show_info() local
5859 xa_for_each(per_store_ap, l_idx, sip) { in scsi_debug_show_info()
6353 struct sdeb_store_info *sip; in add_host_store() local
6363 xa_for_each_marked(per_store_ap, idx, sip, in add_host_store()
6470 struct sdeb_store_info *sip = xa_load(per_store_ap, 0); in map_show() local
6472 if (sip) in map_show()
6474 (int)map_size, sip->map_storep); in map_show()
6952 static void sdebug_erase_store(int idx, struct sdeb_store_info *sip) in sdebug_erase_store() argument
6956 if (!sip) { in sdebug_erase_store()
6959 sip = xa_load(per_store_ap, idx); in sdebug_erase_store()
6960 if (!sip) in sdebug_erase_store()
6963 vfree(sip->map_storep); in sdebug_erase_store()
6964 vfree(sip->dif_storep); in sdebug_erase_store()
6965 vfree(sip->storep); in sdebug_erase_store()
6967 kfree(sip); in sdebug_erase_store()
6974 struct sdeb_store_info *sip = NULL; in sdebug_erase_all_stores() local
6976 xa_for_each(per_store_ap, idx, sip) { in sdebug_erase_all_stores()
6980 sdebug_erase_store(idx, sip); in sdebug_erase_all_stores()
6996 struct sdeb_store_info *sip = NULL; in sdebug_add_store() local
6999 sip = kzalloc(sizeof(*sip), GFP_KERNEL); in sdebug_add_store()
7000 if (!sip) in sdebug_add_store()
7004 res = __xa_alloc(per_store_ap, &n_idx, sip, xal, GFP_ATOMIC); in sdebug_add_store()
7007 kfree(sip); in sdebug_add_store()
7017 sip->storep = vzalloc(sz); in sdebug_add_store()
7018 if (!sip->storep) { in sdebug_add_store()
7023 sdebug_build_parts(sip->storep, sz); in sdebug_add_store()
7030 sip->dif_storep = vmalloc(dif_size); in sdebug_add_store()
7033 sip->dif_storep); in sdebug_add_store()
7035 if (!sip->dif_storep) { in sdebug_add_store()
7039 memset(sip->dif_storep, 0xff, dif_size); in sdebug_add_store()
7044 sip->map_storep = vmalloc(array_size(sizeof(long), in sdebug_add_store()
7049 if (!sip->map_storep) { in sdebug_add_store()
7054 bitmap_zero(sip->map_storep, map_size); in sdebug_add_store()
7058 map_region(sip, 0, 2); in sdebug_add_store()
7061 rwlock_init(&sip->macc_lck); in sdebug_add_store()
7064 sdebug_erase_store((int)n_idx, sip); in sdebug_add_store()