Lines Matching defs:vs
91 vstruct_t vs)
94 queue_enter(&vstruct_list.vsl_queue, vs, vstruct_t, vs_links);
102 vstruct_t vs)
104 queue_remove(&vstruct_list.vsl_queue, vs, vstruct_t, vs_links);
125 vstruct_t vs)
128 ASSERT(vs->vs_async_pending >= 0);
129 while (vs->vs_async_pending > 0) {
130 vs->vs_waiting_async = TRUE;
131 assert_wait(&vs->vs_async_pending, THREAD_UNINT);
132 VS_UNLOCK(vs);
134 VS_LOCK(vs);
136 ASSERT(vs->vs_async_pending == 0);
156 vstruct_t vs)
161 VS_LOCK(vs);
163 seqno = vs->vs_next_seqno++;
165 while (vs->vs_seqno != seqno) {
167 vs->vs_waiting_seqno = TRUE;
168 assert_wait(&vs->vs_seqno, THREAD_UNINT);
169 VS_UNLOCK(vs);
171 VS_LOCK(vs);
179 vs_unlock(vstruct_t vs)
181 vs->vs_seqno++;
182 if (vs->vs_waiting_seqno) {
183 vs->vs_waiting_seqno = FALSE;
184 VS_UNLOCK(vs);
185 thread_wakeup(&vs->vs_seqno);
188 VS_UNLOCK(vs);
196 vstruct_t vs)
198 vs->vs_readers++;
206 vstruct_t vs)
208 while (vs->vs_readers != 0) {
210 vs->vs_waiting_read = TRUE;
211 assert_wait(&vs->vs_readers, THREAD_UNINT);
212 VS_UNLOCK(vs);
214 VS_LOCK(vs);
223 vstruct_t vs)
225 VS_LOCK(vs);
226 if (--vs->vs_readers == 0 && vs->vs_waiting_read) {
227 vs->vs_waiting_read = FALSE;
228 VS_UNLOCK(vs);
229 thread_wakeup(&vs->vs_readers);
232 VS_UNLOCK(vs);
240 vstruct_t vs)
242 vs->vs_writers++;
250 vstruct_t vs)
252 while (vs->vs_writers != 0) {
254 vs->vs_waiting_write = TRUE;
255 assert_wait(&vs->vs_writers, THREAD_UNINT);
256 VS_UNLOCK(vs);
258 VS_LOCK(vs);
260 vs_async_wait(vs);
264 /* The transfer code holds off vs destruction by keeping the */
271 vstruct_t vs)
273 while (vs->vs_writers != 0) {
275 vs->vs_waiting_write = TRUE;
276 assert_wait(&vs->vs_writers, THREAD_UNINT);
277 VS_UNLOCK(vs);
279 VS_LOCK(vs);
289 vstruct_t vs)
291 VS_LOCK(vs);
292 if (--vs->vs_writers == 0 && vs->vs_waiting_write) {
293 vs->vs_waiting_write = FALSE;
294 VS_UNLOCK(vs);
295 thread_wakeup(&vs->vs_writers);
298 VS_UNLOCK(vs);
306 vstruct_t vs;
312 vs = ps_vstruct_create(size);
313 if (vs == VSTRUCT_NULL) {
319 return vs;
327 vstruct_t vs,
330 memory_object_t mem_obj = vs->vs_mem_obj;
381 vstruct_t vs;
387 vs_lookup(mem_obj, vs);
388 vs_lock(vs);
390 if (vs->vs_control != MEMORY_OBJECT_CONTROL_NULL)
393 vs->vs_control = control;
394 vs_unlock(vs);
406 vstruct_t vs;
408 vs_lookup(mem_obj, vs);
409 vs_lock(vs);
410 vs_unlock(vs);
412 memory_object_synchronize_completed(vs->vs_control, offset, length);
439 vstruct_t vs;
445 vs_lookup(mem_obj, vs);
446 vs_lock(vs);
452 vs_wait_for_readers(vs);
453 vs_wait_for_writers(vs);
462 control = vs->vs_control;
463 vs->vs_control = MEMORY_OBJECT_CONTROL_NULL;
472 thread_wakeup(&vs->vs_writers);
473 thread_wakeup(&vs->vs_async_pending);
475 vs_unlock(vs);
488 vstruct_t vs;
490 vs_lookup_safe(mem_obj, vs);
491 if (vs == VSTRUCT_NULL)
494 VS_LOCK(vs);
495 assert(vs->vs_references > 0);
496 vs->vs_references++;
497 VS_UNLOCK(vs);
504 vstruct_t vs;
514 vs_lookup_safe(mem_obj, vs);
515 if (vs == VSTRUCT_NULL)
518 VS_LOCK(vs);
519 if (--vs->vs_references > 0) {
520 VS_UNLOCK(vs);
524 seqno = vs->vs_next_seqno++;
525 while (vs->vs_seqno != seqno) {
527 vs->vs_waiting_seqno = TRUE;
528 assert_wait(&vs->vs_seqno, THREAD_UNINT);
529 VS_UNLOCK(vs);
531 VS_LOCK(vs);
534 vs_async_wait(vs); /* wait for pending async IO */
536 /* do not delete the vs structure until the referencing pointers */
541 VS_UNLOCK(vs);
544 VS_LOCK(vs);
545 vs_async_wait(vs); /* wait for pending async IO */
553 if (vs->vs_control != MEMORY_OBJECT_CONTROL_NULL)
560 VS_UNLOCK(vs);
576 vstruct_list_delete(vs);
579 ps_vstruct_dealloc(vs);
597 vstruct_t vs;
605 vs_lookup(mem_obj, vs);
606 vs_lock(vs);
615 if (vs->vs_writers != 0) {
618 vs_unlock(vs); /* bump internal count of seqno */
619 VS_LOCK(vs);
620 while (vs->vs_writers != 0) {
622 vs->vs_waiting_write = TRUE;
623 assert_wait(&vs->vs_writers, THREAD_UNINT);
624 VS_UNLOCK(vs);
626 VS_LOCK(vs);
627 vs_async_wait(vs);
629 if(vs->vs_control == MEMORY_OBJECT_CONTROL_NULL) {
630 VS_UNLOCK(vs);
633 vs_start_read(vs);
634 VS_UNLOCK(vs);
636 vs_start_read(vs);
637 vs_unlock(vs);
646 pvs_cluster_read(vs, (vm_offset_t)offset, length, fault_info);
648 vs_finish_read(vs);
671 vstruct_t vs;
678 vs_lookup(mem_obj, vs);
679 vs_lock(vs);
680 vs_start_write(vs);
681 vs_unlock(vs);
688 vs_cluster_write(vs, 0, (vm_offset_t)offset, size, FALSE, 0);
690 vs_finish_write(vs);
719 vstruct_t vs;
728 /* Therefore the grant of vs lock must be done on a try versus a */
734 vs_lookup(mem_obj, vs);
737 if(!VS_TRY_LOCK(vs)) {
743 memory_object_super_upl_request(vs->vs_control,
754 if ((vs->vs_seqno != vs->vs_next_seqno++)
755 || (vs->vs_readers)
756 || (vs->vs_xfer_pending)) {
760 vs->vs_next_seqno--;
761 VS_UNLOCK(vs);
766 memory_object_super_upl_request(vs->vs_control,
780 vs_start_write(vs);
783 vs->vs_async_pending += 1; /* protect from backing store contraction */
784 vs_unlock(vs);
791 vs_cluster_write(vs, 0, (vm_offset_t)offset, size, FALSE, 0);
793 vs_finish_write(vs);
797 VS_LOCK(vs);
798 vs->vs_async_pending -= 1; /* release vs_async_wait */
799 if (vs->vs_async_pending == 0 && vs->vs_waiting_async) {
800 vs->vs_waiting_async = FALSE;
801 VS_UNLOCK(vs);
802 thread_wakeup(&vs->vs_async_pending);
804 VS_UNLOCK(vs);
827 vstruct_t vs;
831 vs = vs_object_create(new_size);
832 if (vs == VSTRUCT_NULL)
835 vs->vs_next_seqno = 0;
842 vs->vs_pager_ops = &default_pager_ops;
843 vs->vs_mem_obj_ikot = IKOT_MEMORY_OBJECT;
850 vstruct_list_insert(vs);
851 *new_mem_obj = vs_to_mem_obj(vs);
864 vstruct_t vs;
869 vs = vs_object_create(size);
870 if (vs == VSTRUCT_NULL)
877 vs->vs_pager_ops = &default_pager_ops;
878 vstruct_list_insert(vs);
879 *mem_objp = vs_to_mem_obj(vs);