Lines Matching refs:centry

366 static void _sd_ins_queue(_sd_queue_t *, _sd_cctl_t *centry);
823 _sd_cctl_t *centry;
870 centry = _sd_cctl[(blk/_sd_cctl_groupsz)] +
872 centry->cc_sync = &_sd_ccent_sync[blk % _sd_ccsync_cnt];
873 centry->cc_next = centry->cc_prev = NULL;
874 centry->cc_dirty_next = centry->cc_dirty_link = NULL;
875 centry->cc_await_use = centry->cc_await_page = 0;
876 centry->cc_inuse = centry->cc_pageio = 0;
877 centry->cc_flag = 0;
878 centry->cc_iocount = 0;
879 centry->cc_valid = 0;
882 first_entry_dm = centry;
884 prev_entry_dm->cc_link_list_dm = centry;
885 prev_entry_dm = centry;
886 centry->cc_link_list_dm = first_entry_dm;
887 centry->cc_data = 0;
888 centry->cc_write = NULL;
889 centry->cc_dirty = 0;
895 centry->cc_cblocks = 0;
899 _sd_ins_queue(q, centry);
1061 * synchronize the centry info area with safe store
1213 * _sd_ins_queue - insert centry into LRU queue
1217 _sd_ins_queue(_sd_queue_t *q, _sd_cctl_t *centry)
1221 ASSERT(_sd_cctl_valid(centry));
1224 centry->cc_prev = q_head;
1225 centry->cc_next = q_head->cc_next;
1226 q_head->cc_next->cc_prev = centry;
1227 q_head->cc_next = centry;
1236 _sd_requeue(_sd_cctl_t *centry)
1245 cp = centry->cc_prev;
1246 cn = centry->cc_next;
1248 if (!_sd_cctl_valid(centry) ||
1254 centry, cp, cn, qp);
1257 centry->cc_prev->cc_next = centry->cc_next;
1258 centry->cc_next->cc_prev = centry->cc_prev;
1259 centry->cc_next = &(q->sq_qhead);
1260 centry->cc_prev = q->sq_qhead.cc_prev;
1261 q->sq_qhead.cc_prev->cc_next = centry;
1262 q->sq_qhead.cc_prev = centry;
1263 centry->cc_seq = q->sq_seq++;
1271 _sd_requeue_head(_sd_cctl_t *centry)
1280 cp = centry->cc_prev;
1281 cn = centry->cc_next;
1283 if (!_sd_cctl_valid(centry) ||
1289 centry, cp, cn, qn);
1292 centry->cc_prev->cc_next = centry->cc_next;
1293 centry->cc_next->cc_prev = centry->cc_prev;
1294 centry->cc_prev = &(q->sq_qhead);
1295 centry->cc_next = q->sq_qhead.cc_next;
1296 q->sq_qhead.cc_next->cc_prev = centry;
1297 q->sq_qhead.cc_next = centry;
1298 centry->cc_seq = q->sq_seq++;
1299 centry->cc_flag &= ~CC_QHEAD;
2099 _sd_cctl_t *centry = NULL;
2155 if (centry = (_sd_cctl_t *)
2160 SDBC_VALID_BITS(st_cblk_off, st_cblk_len, centry)) {
2164 lentry = centry;
2165 centry = NULL;
2175 if (SET_CENTRY_INUSE(centry)) {
2185 centry = lentry; /* backup */
2191 * now that we own the centry make sure that
2197 _sd_hash_search(cd, cblk, _sd_htable) != centry) {
2201 "!prefetch centry %p cd %d cblk %" NSC_SZFMT
2204 (void *)centry, cd, cblk, fba_orig_len,
2205 (void *)centry->cc_data);
2208 CLEAR_CENTRY_INUSE(centry);
2212 if (CC_CD_BLK_MATCH(cd, cblk, centry)) {
2215 * before messing with the centry.
2217 if (pageio && SET_CENTRY_PAGEIO(centry)) {
2223 CLEAR_CENTRY_INUSE(centry);
2229 centry = lentry; /* backup */
2237 centry->cc_toflush = 0;
2239 centry->cc_hits++;
2242 sdbc_centry_init_dm(centry);
2245 _sd_cctl_t *, centry);
2250 CLEAR_CENTRY_INUSE(centry);
2254 centry = sdbc_centry_alloc(cd, cblk, request_blocks,
2257 if (centry == NULL) {
2266 * if we have a chain of centry's
2267 * then back up (set centry to lentry).
2269 * then centry remains NULL. this can occur
2275 centry = lentry; /* backup */
2281 * if centry was obtained from the dmchain
2283 * centry already has cc_pageio set.
2285 if (CENTRY_PAGEIO(centry))
2288 DTRACE_PROBE1(_sd_alloc_buf, _sd_cctl_t *, centry);
2291 if (centry->cc_aging_dm & FOUND_IN_HASH_DM)
2294 if (centry->cc_aging_dm & FOUND_HOLD_OVER_DM)
2299 centry->cc_chain = NULL;
2301 centry->cc_aging_dm &= ~(FOUND_IN_HASH_DM|FOUND_HOLD_OVER_DM);
2308 if (pageio && SET_CENTRY_PAGEIO(centry)) {
2316 CLEAR_CENTRY_INUSE(centry);
2322 centry = lentry; /* backup */
2332 centry)) {
2334 ioent = last_ioent = centry;
2336 DATA_LOG(SDF_ALLOC, centry, st_cblk_off,
2341 char *, *(int64_t *)(centry->cc_data +
2343 *(int64_t *)(centry->cc_data +
2347 handle->bh_centry = centry;
2353 if (!SDBC_VALID_BITS(st_cblk_off, st_cblk_len, centry))
2354 last_ioent = centry;
2359 char *, *(int64_t *)(centry->cc_data +
2361 *(int64_t *)(centry->cc_data +
2365 lentry->cc_chain = centry;
2369 lentry = centry;
2374 centry->cc_aging_dm &=
2377 centry->cc_aging_dm &= ~(ENTRY_FIELD_DM);
2378 centry->cc_aging_dm |= this_entry_type | PREFETCH_BUF_E;
2380 centry->cc_aging_dm |= STICKY_METADATA_DM;
2393 if (centry) {
2394 centry->cc_chain = NULL;
2406 if ((centry != last_ioent)) {
2407 centry = last_ioent->cc_chain;
2409 while (centry) {
2410 lentry = centry->cc_chain;
2411 centry->cc_aging_dm &= ~PREFETCH_BUF_E;
2412 _sd_centry_release(centry);
2413 centry = lentry;
2445 * if (SET_CENTRY_INUSE(centry)) {
2446 * _sd_cc_wait(cd, blk, centry, CC_INUSE);
2450 * if (SET_CENTRY_PAGEIO(centry)) {
2451 * _sd_cc_wait(cd, blk, centry, CC_PAGEIO);
2456 _sd_cc_wait(int cd, nsc_off_t cblk, _sd_cctl_t *centry, int flag)
2462 waiters = &(centry->cc_await_use);
2463 uflag = &(CENTRY_INUSE(centry));
2465 waiters = &(centry->cc_await_page);
2466 uflag = &(CENTRY_PAGEIO(centry));
2475 mutex_enter(&centry->cc_lock);
2476 if (CC_CD_BLK_MATCH(cd, cblk, centry) && (*uflag) != 0) {
2481 cv_wait(&centry->cc_blkcv, &centry->cc_lock);
2483 mutex_exit(&centry->cc_lock);
2488 mutex_exit(&centry->cc_lock);
2491 mutex_exit(&centry->cc_lock);
2536 _sd_cctl_t *centry, *lentry, *ioent = NULL;
2739 if ((centry = (_sd_cctl_t *)
2742 if (SET_CENTRY_INUSE(centry)) {
2747 _sd_cc_wait(cd, cblk, centry, CC_INUSE);
2755 * now that we own the centry make sure that
2761 _sd_hash_search(cd, cblk, _sd_htable) != centry) {
2765 "!centry %p cd %d cblk %" NSC_SZFMT
2767 "cc_data %p", (void *)centry, cd, cblk,
2768 fba_orig_len, (void *)centry->cc_data);
2771 CLEAR_CENTRY_INUSE(centry);
2775 if (CC_CD_BLK_MATCH(cd, cblk, centry)) {
2778 * before messing with the centry.
2780 if (pageio && SET_CENTRY_PAGEIO(centry)) {
2784 CLEAR_CENTRY_INUSE(centry);
2787 _sd_cc_wait(cd, cblk, centry,
2798 centry->cc_toflush = 0;
2800 centry->cc_hits++;
2803 sdbc_centry_init_dm(centry);
2806 _sd_cctl_t *, centry);
2811 CLEAR_CENTRY_INUSE(centry);
2817 centry = sdbc_centry_alloc(cd, cblk,
2823 * if centry was obtained from the dmchain
2825 * centry already has cc_pageio set.
2827 if (CENTRY_PAGEIO(centry))
2830 DTRACE_PROBE1(_sd_alloc_buf2, _sd_cctl_t *, centry);
2833 if (centry->cc_aging_dm & FOUND_IN_HASH_DM)
2836 if (centry->cc_aging_dm & FOUND_HOLD_OVER_DM)
2841 centry->cc_aging_dm &= ~(FOUND_IN_HASH_DM|FOUND_HOLD_OVER_DM);
2848 if (pageio && SET_CENTRY_PAGEIO(centry)) {
2853 CLEAR_CENTRY_INUSE(centry);
2856 _sd_cc_wait(cd, cblk, centry, CC_PAGEIO);
2864 if (CENTRY_DIRTY(centry)) {
2869 if (centry->cc_flag != (centry->cc_flag | cc_flag)) {
2871 mutex_enter(&centry->cc_lock);
2872 centry->cc_flag |= cc_flag;
2874 mutex_exit(&centry->cc_lock);
2877 centry->cc_flag |= cc_flag;
2879 centry->cc_chain = NULL;
2887 handle->bh_centry = centry;
2889 lentry = centry;
2892 centry)) {
2894 ioent = centry;
2896 DATA_LOG(SDF_ALLOC, centry, st_cblk_off,
2904 (centry->cc_data +
2907 (centry->cc_data +
2914 lentry->cc_chain = centry;
2919 centry)) {
2921 ioent = centry;
2923 DATA_LOG(SDF_ALLOC, centry, 0,
2931 (centry->cc_data),
2933 (centry->cc_data +
2940 lentry->cc_chain = centry;
2941 lentry = centry;
2945 if (!FULLY_VALID(centry)) {
2947 ioent = centry;
2949 DATA_LOG(SDF_ALLOC, centry, 0,
2957 (centry->cc_data),
2959 (centry->cc_data +
2969 centry->cc_aging_dm &=
2972 centry->cc_aging_dm &= ~(ENTRY_FIELD_DM);
2973 centry->cc_aging_dm |= this_entry_type;
2975 centry->cc_aging_dm |= STICKY_METADATA_DM;
2993 centry->cc_chain = NULL;
2997 * between the centry ele in the list and calc the alloc size
3023 centry = handle->bh_centry;
3026 while (centry) {
3027 DTRACE_PROBE3(_sd_alloc_buf_centrys, _sd_cctl_t *, centry,
3029 (uint64_t)BLK_TO_FBA_NUM(CENTRY_BLK(centry)));
3032 bufvec->bufaddr = (centry->cc_data +
3042 centry->cc_data) {
3047 bufvec->bufaddr = centry->cc_data;
3058 centry->cc_data) {
3063 bufvec->bufaddr = centry->cc_data;
3072 centry = centry->cc_chain;
3110 for (centry = handle->bh_centry;
3111 centry; centry = centry->cc_chain) {
3113 CENTRY_SET_FTPOS(centry);
3115 centry->cc_write);
3175 sdbc_check_cctl_cot(_sd_cctl_t *centry)
3184 age = centry->cc_aging_dm;
3185 size = centry->cc_alloc_size_dm;
3186 data = centry->cc_data;
3239 "age %x size %d data %p", (void *)centry, age, size,
3256 sdbc_mark_cctl_cot(_sd_cctl_t *header, _sd_cctl_t *centry)
3271 centry->cc_aging_dm |= BAD_ENTRY_DM; /* this is the problem child */
3275 * _sd_setup_category_on_type(_sd_cctl_t *) - Setup the centry CATEGORY based on
3276 * centry TYPE and immediate neighbors. Identify each eligible (ie not HASH)
3277 * centry as a host/parasite. host actually have memory allocated to
3282 * 0 on success, EINTR if inconsistency detected in centry
3290 _sd_cctl_t *prev_ent, *next_ent, *centry;
3306 centry = header;
3307 next_ent = centry->cc_chain;
3312 if (sdbc_check_cot && !sdbc_check_cctl_cot(centry))
3318 prev_ent = centry;
3319 centry = next_ent;
3322 if (centry) {
3325 !sdbc_check_cctl_cot(centry)) {
3330 next_ent = centry->cc_chain;
3336 if (!(centry->cc_aging_dm & ELIGIBLE_ENTRY_DM))
3346 if (!(centry->cc_aging_dm &
3351 if (centry->cc_alloc_size_dm ||
3352 centry->cc_data) {
3356 (void *)centry);
3362 centry->cc_aging_dm &=
3364 centry->cc_alloc_size_dm = BLK_SIZE(1);
3366 _sd_cctl_t *, centry);
3381 if (centry->cc_alloc_size_dm ||
3382 centry->cc_data) {
3385 (void *)centry);
3396 centry->cc_aging_dm |= HOST_ENTRY_DM;
3398 centry->cc_alloc_size_dm = BLK_SIZE(1);
3399 anchor = centry;
3410 centry->cc_aging_dm &=
3418 if (centry->cc_alloc_size_dm ||
3419 centry->cc_data) {
3422 (void *)centry);
3431 centry->cc_aging_dm |=
3438 centry->cc_alloc_size_dm =
3445 _sd_cctl_t *, centry);
3465 sdbc_mark_cctl_cot(header, centry);
3485 _sd_cctl_t *prev_ent, *next_ent, *centry;
3495 centry = header;
3496 next_ent = centry->cc_chain;
3501 centry->cc_aging_dm &= ~ELIGIBLE_ENTRY_DM;
3502 prev_ent = centry;
3503 centry = next_ent;
3506 if (centry) {
3507 next_ent = centry->cc_chain;
3513 if (centry->cc_aging_dm & HOST_ENTRY_DM)
3515 else if (centry->cc_aging_dm &
3523 if (rc = sdbc_centry_memalloc_dm(centry,
3524 centry->cc_alloc_size_dm, flag))
3536 anchor = centry;
3537 if (rc = sdbc_centry_memalloc_dm(centry,
3538 centry->cc_alloc_size_dm, flag))
3554 if (!(centry->cc_aging_dm &
3556 centry->cc_head_dm = anchor;
3559 prev_ent->cc_next_dm = centry;
3565 centry->cc_data = anchor->cc_data +
3566 centry->cc_alloc_size_dm;
3567 centry->cc_alloc_size_dm = 0;
3670 _sd_cctl_t *centry, *cc_chain;
3688 centry = handle->bh_centry;
3689 while (centry) {
3690 centry->cc_valid = 0;
3691 centry = centry->cc_chain;
3702 centry = handle->bh_centry;
3703 while (centry) {
3704 cc_chain = centry->cc_chain;
3705 _sd_centry_release(centry);
3706 centry = cc_chain;
3731 * sdbc_get_dmchain -- get a candidate centry chain pointing to
3788 "centry inuse on 0 q! %p",
3794 "centry pageio on 0 q! %p",
4149 _sd_cctl_t *centry = NULL;
4157 centry = sdbc_centry_alloc(cd, cblk, reqblks, &stall,
4160 if (!centry)
4163 centry->cc_chain = NULL;
4166 anchor = centry;
4168 lentry->cc_chain = centry;
4170 lentry = centry;
4172 centry->cc_aging_dm &= ~(ENTRY_FIELD_DM);
4174 if (centry->cc_aging_dm & FOUND_IN_HASH_DM)
4175 centry->cc_aging_dm |= HASH_ENTRY_DM;
4177 if (centry->cc_aging_dm & FOUND_HOLD_OVER_DM)
4178 centry->cc_aging_dm |= HOLD_ENTRY_DM;
4180 centry->cc_aging_dm |= ELIGIBLE_ENTRY_DM;
4182 centry->cc_aging_dm &= ~(FOUND_IN_HASH_DM|FOUND_HOLD_OVER_DM);
4189 centry = anchor;
4190 while (centry) {
4191 next_centry = centry->cc_chain;
4192 _sd_centry_release(centry);
4193 centry = next_centry;
4235 _sd_cctl_t *centry;
4238 centry = sdbc_alloc_dmc(cd, cblk, req_blocks, stall, alloc_tok,
4241 centry = sdbc_alloc_lru(cd, cblk, stall, flag);
4243 return (centry);
4247 * sdbc_alloc_dmc -- allocate a centry from a dmchain
4267 _sd_cctl_t *centry = NULL;
4288 centry = sdbc_alloc_from_dmchain(cd, cblk, alloc_tok, flag);
4290 return (centry);
4294 * sdbc_alloc_from_dmchain -- allocate centry from a dmchain of centrys
4359 * now that we own the centry make sure that
4483 * since this centry is not on any queue
4667 * now that we own the centry make sure that
4743 * centry - Cache block.
4752 sdbc_centry_init_dm(_sd_cctl_t *centry)
4756 if (centry->cc_data) {
4757 centry->cc_aging_dm &= ~(FINAL_AGING_DM);
4760 char *, centry->cc_data);
4764 centry->cc_aging_dm &= ~(FINAL_AGING_DM | CATAGORY_ENTRY_DM);
4766 if (centry->cc_head_dm || centry->cc_next_dm)
4768 "non-zero mem chain in ccent %p", (void *)centry);
4770 centry->cc_head_dm = 0;
4773 centry->cc_next_dm = 0;
4775 centry->cc_data = 0;
4786 * centry: cache control block for which to allocate the memory
4795 sdbc_centry_memalloc_dm(_sd_cctl_t *centry, int alloc_request, int flag)
4802 if (!centry->cc_data && (alloc_request > 0)) {
4805 centry->cc_data = (unsigned char *)
4806 kmem_alloc((size_t)centry->cc_alloc_size_dm, sleep);
4810 cblocks = centry->cc_alloc_size_dm >> _sd_cblock_shift;
4814 centry->cc_cblocks = cblocks;
4817 sdbc_ins_dmqueue_back(newq, centry);
4823 if (!centry->cc_data)
4825 centry->cc_head_dm = centry;
4826 centry->cc_alloc_ct_dm++;
4836 * centry - Cache block.
4847 _sd_centry_release(_sd_cctl_t *centry)
4851 SDTRACE(ST_ENTER|SDF_ENT_FREE, CENTRY_CD(centry), 0,
4852 BLK_TO_FBA_NUM(CENTRY_BLK(centry)), 0, 0);
4854 CLEAR_CENTRY_PAGEIO(centry);
4856 if ((wctl = centry->cc_write) != 0) {
4858 mutex_enter(&centry->cc_lock);
4859 if (CENTRY_DIRTY(centry))
4862 centry->cc_write = NULL;
4863 centry->cc_flag &= ~(CC_PINNABLE);
4866 mutex_exit(&centry->cc_lock);
4874 if (!(centry->cc_aging_dm & BAD_CHAIN_DM)) {
4876 if (centry->cc_alloc_size_dm) {
4879 if (CENTRY_QHEAD(centry)) {
4880 sdbc_requeue_head_dm_try(centry);
4885 qidx = centry->cc_cblocks;
4888 if (_sd_lru_reinsert(q, centry)) {
4890 centry, 1, 1);
4911 centry->cc_flag &= ~CC_QHEAD;
4914 if (CENTRY_QHEAD(centry)) {
4915 if (!CENTRY_DIRTY(centry))
4916 _sd_requeue_head(centry);
4917 } else if (_sd_lru_reinsert(_SD_LRU_Q, centry))
4918 _sd_requeue(centry);
4922 SDTRACE(ST_EXIT|SDF_ENT_FREE, CENTRY_CD(centry), 0,
4923 BLK_TO_FBA_NUM(CENTRY_BLK(centry)), 0, 0);
4925 /* only clear inuse after final reference to centry */
4927 CLEAR_CENTRY_INUSE(centry);
4932 * lookup to centry info associated with safestore resource
4933 * return pointer to the centry info structure
4965 * and set centry->cc_write
4968 * centry - Head of Cache chain
4977 _sd_alloc_write(_sd_cctl_t *centry, int *stall)
4990 for (ce = centry; ce; ce = ce->cc_chain) {
5001 for (ce = centry; ce; ce = ce->cc_chain) {