/* Try to invalidate pages, for "fs flush" or "fs flushv"; or * try to free pages, when deleting a file. * * Locking: the vcache entry's lock is held. It may be dropped and * re-obtained. * * Since we drop and re-obtain the lock, we can't guarantee that there won't * be some pages around when we return, newly created by concurrent activity. */ void osi_VM_TryToSmush(struct vcache *avc, afs_ucred_t *acred, int sync) { ReleaseWriteLock(&avc->lock); osi_VM_FlushVCache(avc, NULL); ObtainWriteLock(&avc->lock, 59); }
int osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { /* * essentially all we want to do here is check that the * vcache is not in use, then call vgone() (which will call * inactive and reclaim as needed). This requires some * kind of complicated locking, which we already need to implement * for FlushVCache, so just call that routine here and check * its return value for whether the vcache was evict-able. */ if (osi_VM_FlushVCache(avc, slept) != 0) return 0; else return 1; }
int osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { int code; /* Perhaps this function should use vgone() or vrecycle() instead. */ if ((afs_debug & AFSDEB_GENERAL) != 0) { printf("%s enter\n", __func__); } if (osi_VM_FlushVCache(avc) != 0) { code = 0; } else { code = 1; } if ((afs_debug & AFSDEB_GENERAL) != 0) { printf("%s exit %d\n", __func__, code); } return code; }