Lines Matching refs:sip

581 static void sdebug_erase_store(int idx, struct sdeb_store_info *sip);
1234 static void *lba2fake_store(struct sdeb_store_info *sip, in lba2fake_store() argument
1237 struct sdeb_store_info *lsip = sip; in lba2fake_store()
1240 if (!sip || !sip->storep) { in lba2fake_store()
1247 static struct t10_pi_tuple *dif_store(struct sdeb_store_info *sip, in dif_store() argument
1252 return sip->dif_storep + sector; in dif_store()
3467 sdeb_data_read_lock(struct sdeb_store_info *sip) in sdeb_data_read_lock() argument
3469 BUG_ON(!sip); in sdeb_data_read_lock()
3471 sdeb_read_lock(&sip->macc_data_lck); in sdeb_data_read_lock()
3475 sdeb_data_read_unlock(struct sdeb_store_info *sip) in sdeb_data_read_unlock() argument
3477 BUG_ON(!sip); in sdeb_data_read_unlock()
3479 sdeb_read_unlock(&sip->macc_data_lck); in sdeb_data_read_unlock()
3483 sdeb_data_write_lock(struct sdeb_store_info *sip) in sdeb_data_write_lock() argument
3485 BUG_ON(!sip); in sdeb_data_write_lock()
3487 sdeb_write_lock(&sip->macc_data_lck); in sdeb_data_write_lock()
3491 sdeb_data_write_unlock(struct sdeb_store_info *sip) in sdeb_data_write_unlock() argument
3493 BUG_ON(!sip); in sdeb_data_write_unlock()
3495 sdeb_write_unlock(&sip->macc_data_lck); in sdeb_data_write_unlock()
3499 sdeb_data_sector_read_lock(struct sdeb_store_info *sip) in sdeb_data_sector_read_lock() argument
3501 BUG_ON(!sip); in sdeb_data_sector_read_lock()
3503 sdeb_read_lock(&sip->macc_sector_lck); in sdeb_data_sector_read_lock()
3507 sdeb_data_sector_read_unlock(struct sdeb_store_info *sip) in sdeb_data_sector_read_unlock() argument
3509 BUG_ON(!sip); in sdeb_data_sector_read_unlock()
3511 sdeb_read_unlock(&sip->macc_sector_lck); in sdeb_data_sector_read_unlock()
3515 sdeb_data_sector_write_lock(struct sdeb_store_info *sip) in sdeb_data_sector_write_lock() argument
3517 BUG_ON(!sip); in sdeb_data_sector_write_lock()
3519 sdeb_write_lock(&sip->macc_sector_lck); in sdeb_data_sector_write_lock()
3523 sdeb_data_sector_write_unlock(struct sdeb_store_info *sip) in sdeb_data_sector_write_unlock() argument
3525 BUG_ON(!sip); in sdeb_data_sector_write_unlock()
3527 sdeb_write_unlock(&sip->macc_sector_lck); in sdeb_data_sector_write_unlock()
3544 sdeb_data_lock(struct sdeb_store_info *sip, bool atomic) in sdeb_data_lock() argument
3547 sdeb_data_write_lock(sip); in sdeb_data_lock()
3549 sdeb_data_read_lock(sip); in sdeb_data_lock()
3553 sdeb_data_unlock(struct sdeb_store_info *sip, bool atomic) in sdeb_data_unlock() argument
3556 sdeb_data_write_unlock(sip); in sdeb_data_unlock()
3558 sdeb_data_read_unlock(sip); in sdeb_data_unlock()
3563 sdeb_data_sector_lock(struct sdeb_store_info *sip, bool do_write) in sdeb_data_sector_lock() argument
3566 sdeb_data_sector_write_lock(sip); in sdeb_data_sector_lock()
3568 sdeb_data_sector_read_lock(sip); in sdeb_data_sector_lock()
3572 sdeb_data_sector_unlock(struct sdeb_store_info *sip, bool do_write) in sdeb_data_sector_unlock() argument
3575 sdeb_data_sector_write_unlock(sip); in sdeb_data_sector_unlock()
3577 sdeb_data_sector_read_unlock(sip); in sdeb_data_sector_unlock()
3581 sdeb_meta_read_lock(struct sdeb_store_info *sip) in sdeb_meta_read_lock() argument
3584 if (sip) in sdeb_meta_read_lock()
3585 __acquire(&sip->macc_meta_lck); in sdeb_meta_read_lock()
3589 if (sip) in sdeb_meta_read_lock()
3590 read_lock(&sip->macc_meta_lck); in sdeb_meta_read_lock()
3597 sdeb_meta_read_unlock(struct sdeb_store_info *sip) in sdeb_meta_read_unlock() argument
3600 if (sip) in sdeb_meta_read_unlock()
3601 __release(&sip->macc_meta_lck); in sdeb_meta_read_unlock()
3605 if (sip) in sdeb_meta_read_unlock()
3606 read_unlock(&sip->macc_meta_lck); in sdeb_meta_read_unlock()
3613 sdeb_meta_write_lock(struct sdeb_store_info *sip) in sdeb_meta_write_lock() argument
3616 if (sip) in sdeb_meta_write_lock()
3617 __acquire(&sip->macc_meta_lck); in sdeb_meta_write_lock()
3621 if (sip) in sdeb_meta_write_lock()
3622 write_lock(&sip->macc_meta_lck); in sdeb_meta_write_lock()
3629 sdeb_meta_write_unlock(struct sdeb_store_info *sip) in sdeb_meta_write_unlock() argument
3632 if (sip) in sdeb_meta_write_unlock()
3633 __release(&sip->macc_meta_lck); in sdeb_meta_write_unlock()
3637 if (sip) in sdeb_meta_write_unlock()
3638 write_unlock(&sip->macc_meta_lck); in sdeb_meta_write_unlock()
3645 static int do_device_access(struct sdeb_store_info *sip, struct scsi_cmnd *scp, in do_device_access() argument
3670 if (!sdb->length || !sip) in do_device_access()
3678 fsp = sip->storep; in do_device_access()
3683 sdeb_data_lock(sip, atomic); in do_device_access()
3686 sdeb_data_sector_lock(sip, do_write); in do_device_access()
3690 sdeb_data_sector_unlock(sip, do_write); in do_device_access()
3698 sdeb_data_unlock(sip, atomic); in do_device_access()
3719 static bool comp_write_worker(struct sdeb_store_info *sip, u64 lba, u32 num, in comp_write_worker() argument
3726 u8 *fsp = sip->storep; in comp_write_worker()
3793 struct sdeb_store_info *sip = devip2sip((struct sdebug_dev_info *) in dif_copy_prot() local
3795 struct t10_pi_tuple *dif_storep = sip->dif_storep; in dif_copy_prot()
3808 void *start = dif_store(sip, sector); in dif_copy_prot()
3840 struct sdeb_store_info *sip = devip2sip((struct sdebug_dev_info *) in prot_verify_read() local
3846 sdt = dif_store(sip, sector); in prot_verify_read()
3859 ret = dif_verify(sdt, lba2fake_store(sip, sector), in prot_verify_read()
3881 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_read_dt0() local
3967 sdeb_meta_read_lock(sip); in resp_read_dt0()
3976 sdeb_meta_read_unlock(sip); in resp_read_dt0()
3980 sdeb_meta_read_unlock(sip); in resp_read_dt0()
3987 sdeb_meta_read_unlock(sip); in resp_read_dt0()
3991 sdeb_meta_read_unlock(sip); in resp_read_dt0()
3999 ret = do_device_access(sip, scp, 0, lba, num, 0, false, false); in resp_read_dt0()
4001 sdeb_meta_read_unlock(sip); in resp_read_dt0()
4116 static unsigned int map_state(struct sdeb_store_info *sip, sector_t lba, in map_state() argument
4125 mapped = test_bit(index, sip->map_storep); in map_state()
4128 next = find_next_zero_bit(sip->map_storep, map_size, index); in map_state()
4130 next = find_next_bit(sip->map_storep, map_size, index); in map_state()
4137 static void map_region(struct sdeb_store_info *sip, sector_t lba, in map_region() argument
4146 set_bit(index, sip->map_storep); in map_region()
4152 static void unmap_region(struct sdeb_store_info *sip, sector_t lba, in unmap_region() argument
4156 u8 *fsp = sip->storep; in unmap_region()
4164 clear_bit(index, sip->map_storep); in unmap_region()
4171 if (sip->dif_storep) { in unmap_region()
4172 memset(sip->dif_storep + lba, 0xff, in unmap_region()
4173 sizeof(*sip->dif_storep) * in unmap_region()
4189 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_write_dt0() local
4253 sdeb_meta_write_lock(sip); in resp_write_dt0()
4260 sdeb_meta_write_unlock(sip); in resp_write_dt0()
4269 sdeb_meta_write_unlock(sip); in resp_write_dt0()
4273 sdeb_meta_write_unlock(sip); in resp_write_dt0()
4280 sdeb_meta_write_unlock(sip); in resp_write_dt0()
4284 sdeb_meta_write_unlock(sip); in resp_write_dt0()
4292 ret = do_device_access(sip, scp, 0, lba, num, group, true, false); in resp_write_dt0()
4294 map_region(sip, lba, num); in resp_write_dt0()
4300 sdeb_meta_write_unlock(sip); in resp_write_dt0()
4340 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_write_scat() local
4412 sdeb_meta_write_lock(sip); in resp_write_scat()
4459 ret = do_device_access(sip, scp, sg_off, lba, num, group, true, true); in resp_write_scat()
4464 map_region(sip, lba, num); in resp_write_scat()
4498 sdeb_meta_write_unlock(sip); in resp_write_scat()
4513 struct sdeb_store_info *sip = devip2sip((struct sdebug_dev_info *) in resp_write_same() local
4520 sdeb_meta_write_lock(sip); in resp_write_same()
4529 unmap_region(sip, lba, num); in resp_write_same()
4535 fsp = sip->storep; in resp_write_same()
4537 sdeb_data_write_lock(sip); in resp_write_same()
4559 map_region(sip, lba, num); in resp_write_same()
4563 sdeb_data_write_unlock(sip); in resp_write_same()
4567 sdeb_meta_write_unlock(sip); in resp_write_same()
4678 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_comp_write() local
4720 sdeb_data_write_lock(sip); in resp_comp_write()
4721 sdeb_meta_write_lock(sip); in resp_comp_write()
4722 if (!comp_write_worker(sip, lba, num, arr, false)) { in resp_comp_write()
4730 map_region(sip, lba, num); in resp_comp_write()
4732 sdeb_meta_write_unlock(sip); in resp_comp_write()
4733 sdeb_data_write_unlock(sip); in resp_comp_write()
4749 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_unmap() local
4778 sdeb_meta_write_lock(sip); in resp_unmap()
4788 unmap_region(sip, lba, num); in resp_unmap()
4794 sdeb_meta_write_unlock(sip); in resp_unmap()
4822 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_get_lba_status() local
4824 mapped = map_state(sip, lba, &num); in resp_get_lba_status()
4930 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_pre_fetch() local
4931 u8 *fsp = sip->storep; in resp_pre_fetch()
4952 sdeb_data_read_lock(sip); in resp_pre_fetch()
4958 sdeb_data_read_unlock(sip); in resp_pre_fetch()
5078 struct sdeb_store_info *sip = devip2sip(devip, true); in resp_verify() local
5117 sdeb_data_read_lock(sip); in resp_verify()
5133 if (!comp_write_worker(sip, lba, vnum, arr, true)) { in resp_verify()
5139 sdeb_data_read_unlock(sip); in resp_verify()
5158 struct sdeb_store_info *sip = devip2sip(devip, false); in resp_report_zones() local
5185 sdeb_meta_read_lock(sip); in resp_report_zones()
5283 sdeb_meta_read_unlock(sip); in resp_report_zones()
5291 struct sdeb_store_info *sip; in resp_atomic_write() local
5302 sip = devip2sip(devip, true); in resp_atomic_write()
5339 ret = do_device_access(sip, scp, 0, lba, len, 0, true, true); in resp_atomic_write()
5367 struct sdeb_store_info *sip = devip2sip(devip, false); in resp_open_zone() local
5373 sdeb_meta_write_lock(sip); in resp_open_zone()
5422 sdeb_meta_write_unlock(sip); in resp_open_zone()
5442 struct sdeb_store_info *sip = devip2sip(devip, false); in resp_close_zone() local
5449 sdeb_meta_write_lock(sip); in resp_close_zone()
5478 sdeb_meta_write_unlock(sip); in resp_close_zone()
5514 struct sdeb_store_info *sip = devip2sip(devip, false); in resp_finish_zone() local
5521 sdeb_meta_write_lock(sip); in resp_finish_zone()
5550 sdeb_meta_write_unlock(sip); in resp_finish_zone()
5558 struct sdeb_store_info *sip = devip2sip(devip, false); in zbc_rwp_zone() local
5571 memset(sip->storep + zsp->z_start * sdebug_sector_size, 0, in zbc_rwp_zone()
5594 struct sdeb_store_info *sip = devip2sip(devip, false); in resp_rwp_zone() local
5601 sdeb_meta_write_lock(sip); in resp_rwp_zone()
5629 sdeb_meta_write_unlock(sip); in resp_rwp_zone()
6847 struct sdeb_store_info *sip; in scsi_debug_show_info() local
6860 xa_for_each(per_store_ap, l_idx, sip) { in scsi_debug_show_info()
7365 struct sdeb_store_info *sip; in add_host_store() local
7375 xa_for_each_marked(per_store_ap, idx, sip, in add_host_store()
7482 struct sdeb_store_info *sip = xa_load(per_store_ap, 0); in map_show() local
7484 if (sip) in map_show()
7486 (int)map_size, sip->map_storep); in map_show()
7983 static void sdebug_erase_store(int idx, struct sdeb_store_info *sip) in sdebug_erase_store() argument
7987 if (!sip) { in sdebug_erase_store()
7990 sip = xa_load(per_store_ap, idx); in sdebug_erase_store()
7991 if (!sip) in sdebug_erase_store()
7994 vfree(sip->map_storep); in sdebug_erase_store()
7995 vfree(sip->dif_storep); in sdebug_erase_store()
7996 vfree(sip->storep); in sdebug_erase_store()
7998 kfree(sip); in sdebug_erase_store()
8005 struct sdeb_store_info *sip = NULL; in sdebug_erase_all_stores() local
8007 xa_for_each(per_store_ap, idx, sip) { in sdebug_erase_all_stores()
8011 sdebug_erase_store(idx, sip); in sdebug_erase_all_stores()
8027 struct sdeb_store_info *sip = NULL; in sdebug_add_store() local
8030 sip = kzalloc(sizeof(*sip), GFP_KERNEL); in sdebug_add_store()
8031 if (!sip) in sdebug_add_store()
8035 res = __xa_alloc(per_store_ap, &n_idx, sip, xal, GFP_ATOMIC); in sdebug_add_store()
8038 kfree(sip); in sdebug_add_store()
8048 sip->storep = vzalloc(sz); in sdebug_add_store()
8049 if (!sip->storep) { in sdebug_add_store()
8054 sdebug_build_parts(sip->storep, sz); in sdebug_add_store()
8061 sip->dif_storep = vmalloc(dif_size); in sdebug_add_store()
8064 sip->dif_storep); in sdebug_add_store()
8066 if (!sip->dif_storep) { in sdebug_add_store()
8070 memset(sip->dif_storep, 0xff, dif_size); in sdebug_add_store()
8075 sip->map_storep = vmalloc(array_size(sizeof(long), in sdebug_add_store()
8080 if (!sip->map_storep) { in sdebug_add_store()
8085 bitmap_zero(sip->map_storep, map_size); in sdebug_add_store()
8089 map_region(sip, 0, 2); in sdebug_add_store()
8092 rwlock_init(&sip->macc_data_lck); in sdebug_add_store()
8093 rwlock_init(&sip->macc_meta_lck); in sdebug_add_store()
8094 rwlock_init(&sip->macc_sector_lck); in sdebug_add_store()
8097 sdebug_erase_store((int)n_idx, sip); in sdebug_add_store()