Lines Matching defs:fmi
235 struct fstrans_mount_info *fmi, *fmi_lower;
240 SLIST_FOREACH(fmi, &fstrans_mount_hashtab[indx], fmi_hash) {
241 if (fmi->fmi_mount == mp) {
243 fmi->fmi_lower_info == NULL)) {
248 KASSERT(fmi->fmi_ref_cnt == 1);
255 fmi->fmi_lower_info = fmi_lower;
256 fmi->fmi_lower_info->fmi_ref_cnt += 1;
258 return fmi;
269 fstrans_mount_dtor(struct fstrans_mount_info *fmi)
274 KASSERT(fmi != NULL);
275 fmi->fmi_ref_cnt -= 1;
276 if (__predict_true(fmi->fmi_ref_cnt > 0)) {
280 KASSERT(fmi->fmi_state == FSTRANS_NORMAL);
281 KASSERT(LIST_FIRST(&fmi->fmi_cow_handler) == NULL);
282 KASSERT(fmi->fmi_owner == NULL);
284 if (fmi->fmi_lower_info)
285 fstrans_mount_dtor(fmi->fmi_lower_info);
290 KASSERT(fmi->fmi_mount->mnt_lower == NULL);
292 kmem_free(fmi->fmi_mount, sizeof(*fmi->fmi_mount));
293 kmem_free(fmi, sizeof(*fmi));
331 struct fstrans_mount_info *fmi;
336 fmi = fstrans_mount_get(mp);
337 KASSERT(fmi != NULL);
338 fmi->fmi_gone = true;
340 fmi, fstrans_mount_info, fmi_hash);
342 fstrans_mount_dtor(fmi);
403 struct fstrans_mount_info *fmi;
414 fmi = fstrans_mount_get(mp);
415 if (fmi == NULL) {
419 fmi->fmi_ref_cnt += 1;
422 if (fmi->fmi_lower_info) {
424 fstrans_alloc_lwp_info(fmi->fmi_lower_info->fmi_mount);
427 fstrans_mount_dtor(fmi);
454 fli->fli_mountinfo = fmi;
501 grant_lock(const struct fstrans_mount_info *fmi,
505 if (__predict_true(fmi->fmi_state == FSTRANS_NORMAL))
507 if (fmi->fmi_owner == curlwp)
509 if (fmi->fmi_state == FSTRANS_SUSPENDING && type == FSTRANS_LAZY)
524 struct fstrans_mount_info *fmi;
531 fmi = fli->fli_mountinfo;
540 if (__predict_true(grant_lock(fmi, lock_type))) {
553 while (! grant_lock(fmi, lock_type))
595 struct fstrans_mount_info *fmi;
600 fmi = fli->fli_mountinfo;
613 if (__predict_true(fmi->fmi_state == FSTRANS_NORMAL)) {
634 struct fstrans_mount_info *fmi;
641 fmi = fli->fli_mountinfo;
643 return (fli->fli_trans_cnt > 0 || fmi->fmi_owner == curlwp);
653 struct fstrans_mount_info *fmi;
660 fmi = fli->fli_mountinfo;
662 return (fmi->fmi_owner == curlwp);
669 state_change_done(const struct fstrans_mount_info *fmi)
676 if (fli->fli_mountinfo != fmi)
682 if (grant_lock(fmi, fli->fli_lock_type))
700 struct fstrans_mount_info *fmi;
707 fmi = fli->fli_mountinfo;
708 old_state = fmi->fmi_state;
713 fmi->fmi_state = new_state;
721 while (! state_change_done(fmi)) {
724 new_state = fmi->fmi_state = FSTRANS_NORMAL;
730 KASSERT(fmi->fmi_owner == NULL);
731 fmi->fmi_owner = curlwp;
734 KASSERT(fmi->fmi_owner == curlwp);
735 fmi->fmi_owner = NULL;
751 struct fstrans_mount_info *fmi;
757 fmi = fli->fli_mountinfo;
759 return fmi->fmi_state;
818 cow_state_change_done(const struct fstrans_mount_info *fmi)
823 KASSERT(fmi->fmi_cow_change);
826 if (fli->fli_mount != fmi->fmi_mount)
842 cow_change_enter(struct fstrans_mount_info *fmi)
850 while (fmi->fmi_cow_change)
856 fmi->fmi_cow_change = true;
859 while (! cow_state_change_done(fmi))
867 cow_change_done(struct fstrans_mount_info *fmi)
872 fmi->fmi_cow_change = false;
887 struct fstrans_mount_info *fmi;
893 fmi = fstrans_mount_get(mp);
894 KASSERT(fmi != NULL);
895 fmi->fmi_ref_cnt += 1;
902 cow_change_enter(fmi);
903 LIST_INSERT_HEAD(&fmi->fmi_cow_handler, newch, ch_list);
904 cow_change_done(fmi);
916 struct fstrans_mount_info *fmi;
922 fmi = fstrans_mount_get(mp);
923 KASSERT(fmi != NULL);
926 cow_change_enter(fmi);
927 LIST_FOREACH(hp, &fmi->fmi_cow_handler, ch_list)
934 fstrans_mount_dtor(fmi);
935 cow_change_done(fmi);
949 struct fstrans_mount_info *fmi;
972 fmi = fli->fli_mountinfo;
980 if (__predict_false(fmi->fmi_cow_change)) {
983 while (fmi->fmi_cow_change)
998 LIST_FOREACH(hp, &fmi->fmi_cow_handler, ch_list)
1011 if (__predict_false(fmi->fmi_cow_change)) {
1090 struct fstrans_mount_info *fmi;
1093 SLIST_FOREACH(fmi, &fstrans_mount_hashtab[indx], fmi_hash)
1094 if (fmi->fmi_mount == mp)
1097 if (!verbose && (fmi == NULL || fmi->fmi_state == FSTRANS_NORMAL))
1101 if (fmi == NULL) {
1105 printf("owner %p ", fmi->fmi_owner);
1106 switch (fmi->fmi_state) {
1117 printf("state %#x\n", fmi->fmi_state);