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,
874 struct sdeb_store_info *lsip = sip;
877 if (!sip || !sip->storep) {
884 static struct t10_pi_tuple *dif_store(struct sdeb_store_info *sip,
889 return sip->dif_storep + sector;
2932 static int do_device_access(struct sdeb_store_info *sip, struct scsi_cmnd *scp,
2948 if (!sdb->length || !sip)
2952 fsp = sip->storep;
2987 /* If sip->storep+lba compares equal to arr(num), then copy top half of
2988 * arr into sip->storep+lba and return true. If comparison fails then
2990 static bool comp_write_worker(struct sdeb_store_info *sip, u64 lba, u32 num,
2997 u8 *fsp = sip->storep;
3064 struct sdeb_store_info *sip = devip2sip((struct sdebug_dev_info *)
3066 struct t10_pi_tuple *dif_storep = sip->dif_storep;
3079 void *start = dif_store(sip, sector);
3110 struct sdeb_store_info *sip = devip2sip((struct sdebug_dev_info *)
3118 sdt = dif_store(sip, sector);
3123 ret = dif_verify(sdt, lba2fake_store(sip, sector), sector,
3144 struct sdeb_store_info *sip = devip2sip(devip, true);
3145 rwlock_t *macc_lckp = sip ? &sip->macc_lck : &sdeb_fake_rw_lck;
3237 ret = do_device_access(sip, scp, 0, lba, num, false);
3375 static unsigned int map_state(struct sdeb_store_info *sip, sector_t lba,
3384 mapped = test_bit(index, sip->map_storep);
3387 next = find_next_zero_bit(sip->map_storep, map_size, index);
3389 next = find_next_bit(sip->map_storep, map_size, index);
3396 static void map_region(struct sdeb_store_info *sip, sector_t lba,
3405 set_bit(index, sip->map_storep);
3411 static void unmap_region(struct sdeb_store_info *sip, sector_t lba,
3415 u8 *fsp = sip->storep;
3423 clear_bit(index, sip->map_storep);
3430 if (sip->dif_storep) {
3431 memset(sip->dif_storep + lba, 0xff,
3432 sizeof(*sip->dif_storep) *
3447 struct sdeb_store_info *sip = devip2sip(devip, true);
3448 rwlock_t *macc_lckp = &sip->macc_lck;
3521 ret = do_device_access(sip, scp, 0, lba, num, true);
3523 map_region(sip, lba, num);
3566 struct sdeb_store_info *sip = devip2sip(devip, true);
3567 rwlock_t *macc_lckp = &sip->macc_lck;
3678 ret = do_device_access(sip, scp, sg_off, lba, num, true);
3683 map_region(sip, lba, num);
3732 struct sdeb_store_info *sip = devip2sip((struct sdebug_dev_info *)
3734 rwlock_t *macc_lckp = &sip->macc_lck;
3747 unmap_region(sip, lba, num);
3753 fsp = sip->storep;
3762 write_unlock(&sip->macc_lck);
3776 map_region(sip, lba, num);
3893 struct sdeb_store_info *sip = devip2sip(devip, true);
3894 rwlock_t *macc_lckp = &sip->macc_lck;
3937 if (!comp_write_worker(sip, lba, num, arr, false)) {
3943 map_region(sip, lba, num);
3960 struct sdeb_store_info *sip = devip2sip(devip, true);
3961 rwlock_t *macc_lckp = &sip->macc_lck;
4000 unmap_region(sip, lba, num);
4034 struct sdeb_store_info *sip = devip2sip(devip, true);
4036 mapped = map_state(sip, lba, &num);
4097 struct sdeb_store_info *sip = devip2sip(devip, true);
4098 rwlock_t *macc_lckp = &sip->macc_lck;
4099 u8 *fsp = sip->storep;
4245 struct sdeb_store_info *sip = devip2sip(devip, true);
4246 rwlock_t *macc_lckp = &sip->macc_lck;
4301 if (!comp_write_worker(sip, lba, vnum, arr, true)) {
4326 struct sdeb_store_info *sip = devip2sip(devip, false);
4327 rwlock_t *macc_lckp = sip ? &sip->macc_lck : &sdeb_fake_rw_lck;
4469 struct sdeb_store_info *sip = devip2sip(devip, false);
4470 rwlock_t *macc_lckp = sip ? &sip->macc_lck : &sdeb_fake_rw_lck;
4546 struct sdeb_store_info *sip = devip2sip(devip, false);
4547 rwlock_t *macc_lckp = sip ? &sip->macc_lck : &sdeb_fake_rw_lck;
4619 struct sdeb_store_info *sip = devip2sip(devip, false);
4620 rwlock_t *macc_lckp = sip ? &sip->macc_lck : &sdeb_fake_rw_lck;
4664 struct sdeb_store_info *sip = devip2sip(devip, false);
4677 memset(sip->storep + zsp->z_start * sdebug_sector_size, 0,
4700 struct sdeb_store_info *sip = devip2sip(devip, false);
4701 rwlock_t *macc_lckp = sip ? &sip->macc_lck : &sdeb_fake_rw_lck;
5832 struct sdeb_store_info *sip;
5845 xa_for_each(per_store_ap, l_idx, sip) {
6339 struct sdeb_store_info *sip;
6349 xa_for_each_marked(per_store_ap, idx, sip,
6456 struct sdeb_store_info *sip = xa_load(per_store_ap, 0);
6458 if (sip)
6460 (int)map_size, sip->map_storep);
6937 /* idx must be valid, if sip is NULL then it will be obtained using idx */
6938 static void sdebug_erase_store(int idx, struct sdeb_store_info *sip)
6942 if (!sip) {
6945 sip = xa_load(per_store_ap, idx);
6946 if (!sip)
6949 vfree(sip->map_storep);
6950 vfree(sip->dif_storep);
6951 vfree(sip->storep);
6953 kfree(sip);
6960 struct sdeb_store_info *sip = NULL;
6962 xa_for_each(per_store_ap, idx, sip) {
6966 sdebug_erase_store(idx, sip);
6982 struct sdeb_store_info *sip = NULL;
6985 sip = kzalloc(sizeof(*sip), GFP_KERNEL);
6986 if (!sip)
6990 res = __xa_alloc(per_store_ap, &n_idx, sip, xal, GFP_ATOMIC);
6993 kfree(sip);
7003 sip->storep = vzalloc(sz);
7004 if (!sip->storep) {
7009 sdebug_build_parts(sip->storep, sz);
7016 sip->dif_storep = vmalloc(dif_size);
7019 sip->dif_storep);
7021 if (!sip->dif_storep) {
7025 memset(sip->dif_storep, 0xff, dif_size);
7030 sip->map_storep = vmalloc(array_size(sizeof(long),
7035 if (!sip->map_storep) {
7040 bitmap_zero(sip->map_storep, map_size);
7044 map_region(sip, 0, 2);
7047 rwlock_init(&sip->macc_lck);
7050 sdebug_erase_store((int)n_idx, sip);