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;
382 vstruct_t vs;
388 vs_lookup(mem_obj, vs);
389 vs_lock(vs);
391 if (vs->vs_control != MEMORY_OBJECT_CONTROL_NULL)
394 vs->vs_control = control;
395 vs_unlock(vs);
407 vstruct_t vs;
409 vs_lookup(mem_obj, vs);
410 vs_lock(vs);
411 vs_unlock(vs);
413 memory_object_synchronize_completed(vs->vs_control, offset, length);
440 vstruct_t vs;
442 vs_lookup(mem_obj, vs);
444 vs_lock(vs);
445 vs_async_wait(vs);
446 if (!vs->vs_xfer_pending) {
450 vs->vs_xfer_pending = TRUE;
451 vs_unlock(vs);
453 ps_vstruct_reclaim(vs, TRUE, reclaim_backing_store);
455 vs_lock(vs);
456 vs->vs_xfer_pending = FALSE;
457 vs_unlock(vs);
467 vstruct_t vs;
473 vs_lookup(mem_obj, vs);
474 vs_lock(vs);
480 vs_wait_for_readers(vs);
481 vs_wait_for_writers(vs);
490 control = vs->vs_control;
491 vs->vs_control = MEMORY_OBJECT_CONTROL_NULL;
500 thread_wakeup(&vs->vs_writers);
501 thread_wakeup(&vs->vs_async_pending);
503 vs_unlock(vs);
516 vstruct_t vs;
518 vs_lookup_safe(mem_obj, vs);
519 if (vs == VSTRUCT_NULL)
522 VS_LOCK(vs);
523 assert(vs->vs_references > 0);
524 vs->vs_references++;
525 VS_UNLOCK(vs);
532 vstruct_t vs;
542 vs_lookup_safe(mem_obj, vs);
543 if (vs == VSTRUCT_NULL)
546 VS_LOCK(vs);
547 if (--vs->vs_references > 0) {
548 VS_UNLOCK(vs);
552 seqno = vs->vs_next_seqno++;
553 while (vs->vs_seqno != seqno) {
555 vs->vs_waiting_seqno = TRUE;
556 assert_wait(&vs->vs_seqno, THREAD_UNINT);
557 VS_UNLOCK(vs);
559 VS_LOCK(vs);
562 vs_async_wait(vs); /* wait for pending async IO */
564 /* do not delete the vs structure until the referencing pointers */
569 VS_UNLOCK(vs);
572 VS_LOCK(vs);
573 vs_async_wait(vs); /* wait for pending async IO */
581 if (vs->vs_control != MEMORY_OBJECT_CONTROL_NULL)
588 VS_UNLOCK(vs);
604 vstruct_list_delete(vs);
607 ps_vstruct_dealloc(vs);
625 vstruct_t vs;
634 vs_lookup(mem_obj, vs);
635 vs_lock(vs);
644 if (vs->vs_writers != 0) {
647 vs_unlock(vs); /* bump internal count of seqno */
648 VS_LOCK(vs);
649 while (vs->vs_writers != 0) {
651 vs->vs_waiting_write = TRUE;
652 assert_wait(&vs->vs_writers, THREAD_UNINT);
653 VS_UNLOCK(vs);
655 VS_LOCK(vs);
656 vs_async_wait(vs);
658 if(vs->vs_control == MEMORY_OBJECT_CONTROL_NULL) {
659 VS_UNLOCK(vs);
662 vs_start_read(vs);
663 VS_UNLOCK(vs);
665 vs_start_read(vs);
666 vs_unlock(vs);
676 kr = pvs_cluster_read(vs, (dp_offset_t) offset, length, fault_info);
689 vs_finish_read(vs);
712 vstruct_t vs;
719 vs_lookup(mem_obj, vs);
720 vs_lock(vs);
721 vs_start_write(vs);
722 vs_unlock(vs);
730 vs_cluster_write(vs, 0, (upl_offset_t)offset, size, FALSE, 0);
732 vs_finish_write(vs);
761 vstruct_t vs;
770 /* Therefore the grant of vs lock must be done on a try versus a */
776 vs_lookup(mem_obj, vs);
779 if(!VS_TRY_LOCK(vs)) {
785 memory_object_super_upl_request(vs->vs_control,
796 if ((vs->vs_seqno != vs->vs_next_seqno++)
797 || (vs->vs_readers)
798 || (vs->vs_xfer_pending)) {
802 vs->vs_next_seqno--;
803 VS_UNLOCK(vs);
808 memory_object_super_upl_request(vs->vs_control,
822 vs_start_write(vs);
825 vs->vs_async_pending += 1; /* protect from backing store contraction */
826 vs_unlock(vs);
834 vs_cluster_write(vs, 0, (upl_offset_t) offset, size, FALSE, 0);
836 vs_finish_write(vs);
840 VS_LOCK(vs);
841 vs->vs_async_pending -= 1; /* release vs_async_wait */
842 if (vs->vs_async_pending == 0 && vs->vs_waiting_async) {
843 vs->vs_waiting_async = FALSE;
844 VS_UNLOCK(vs);
845 thread_wakeup(&vs->vs_async_pending);
847 VS_UNLOCK(vs);
870 vstruct_t vs;
879 vs = vs_object_create((dp_size_t) new_size);
880 if (vs == VSTRUCT_NULL)
883 vs->vs_next_seqno = 0;
890 vs->vs_pager_ops = &default_pager_ops;
891 vs->vs_pager_header.io_bits = IKOT_MEMORY_OBJECT;
898 vstruct_list_insert(vs);
899 *new_mem_obj = vs_to_mem_obj(vs);
912 vstruct_t vs;
922 vs = vs_object_create((dp_size_t) size);
923 if (vs == VSTRUCT_NULL)
930 vs->vs_pager_ops = &default_pager_ops;
931 vstruct_list_insert(vs);
932 *mem_objp = vs_to_mem_obj(vs);