Print this page
patch lower-case-segops


5608         vnode_t *vp;
5609         int allow = 1;
5610 
5611         ASSERT(pp->p_as != &kas);
5612         AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
5613         for (seg = AS_SEGFIRST(as); seg != NULL; seg = AS_SEGNEXT(as, seg)) {
5614 
5615                 /*
5616                  * Cannot enter zone with shared anon memory which
5617                  * reserves swap.  See comment above.
5618                  */
5619                 if (seg_can_change_zones(seg) == B_FALSE) {
5620                         allow = 0;
5621                         break;
5622                 }
5623                 /*
5624                  * if we can't get a backing vnode for this segment then skip
5625                  * it.
5626                  */
5627                 vp = NULL;
5628                 if (SEGOP_GETVP(seg, seg->s_base, &vp) != 0 || vp == NULL)
5629                         continue;
5630                 if (!vn_can_change_zones(vp)) { /* bail on first match */
5631                         allow = 0;
5632                         break;
5633                 }
5634         }
5635         AS_LOCK_EXIT(as, &as->a_lock);
5636         return (allow);
5637 }
5638 
5639 /*
5640  * Count swap reserved by curproc's address space
5641  */
5642 static size_t
5643 as_swresv(void)
5644 {
5645         proc_t *pp = curproc;
5646         struct seg *seg;
5647         struct as *as = pp->p_as;
5648         size_t swap = 0;




5608         vnode_t *vp;
5609         int allow = 1;
5610 
5611         ASSERT(pp->p_as != &kas);
5612         AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
5613         for (seg = AS_SEGFIRST(as); seg != NULL; seg = AS_SEGNEXT(as, seg)) {
5614 
5615                 /*
5616                  * Cannot enter zone with shared anon memory which
5617                  * reserves swap.  See comment above.
5618                  */
5619                 if (seg_can_change_zones(seg) == B_FALSE) {
5620                         allow = 0;
5621                         break;
5622                 }
5623                 /*
5624                  * if we can't get a backing vnode for this segment then skip
5625                  * it.
5626                  */
5627                 vp = NULL;
5628                 if (segop_getvp(seg, seg->s_base, &vp) != 0 || vp == NULL)
5629                         continue;
5630                 if (!vn_can_change_zones(vp)) { /* bail on first match */
5631                         allow = 0;
5632                         break;
5633                 }
5634         }
5635         AS_LOCK_EXIT(as, &as->a_lock);
5636         return (allow);
5637 }
5638 
5639 /*
5640  * Count swap reserved by curproc's address space
5641  */
5642 static size_t
5643 as_swresv(void)
5644 {
5645         proc_t *pp = curproc;
5646         struct seg *seg;
5647         struct as *as = pp->p_as;
5648         size_t swap = 0;