X-Git-Url: https://git.openafs.org/?p=openafs.git;a=blobdiff_plain;f=src%2Fafs%2FLINUX%2Fosi_vm.c;h=675c48eb2680d9c3f82ca372c90d41660861f527;hp=0c5f5eba1533257651aeeea95933037104babf50;hb=cb169b7b125167def267d0199e85b0b0af91f597;hpb=87c10e8d7f05dbbdf12ee9e8651dcec07e08af3f diff --git a/src/afs/LINUX/osi_vm.c b/src/afs/LINUX/osi_vm.c index 0c5f5eb..675c48e 100644 --- a/src/afs/LINUX/osi_vm.c +++ b/src/afs/LINUX/osi_vm.c @@ -1,7 +1,10 @@ -/* Copyright (C) 1998 Transarc Corporation - All rights reserved. */ /* - * (C) COPYRIGHT IBM CORPORATION 1987, 1988 - * LICENSED MATERIALS - PROPERTY OF IBM + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html */ #include "../afs/param.h" /* Should be always first */ @@ -42,7 +45,13 @@ int osi_VM_FlushVCache(struct vcache *avc, int *slept) if (avc->opens != 0) return EBUSY; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) + truncate_inode_pages(&ip->i_data, 0); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15) + truncate_inode_pages(ip, 0); +#else invalidate_inode_pages(ip); +#endif return 0; } @@ -57,7 +66,17 @@ int osi_VM_FlushVCache(struct vcache *avc, int *slept) */ void osi_VM_TryToSmush(struct vcache *avc, struct AFS_UCRED *acred, int sync) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) + struct inode *ip = (struct inode*)avc; + + truncate_inode_pages(&ip->i_data, 0); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15) + struct inode *ip = (struct inode*)avc; + + truncate_inode_pages(ip, 0); +#else invalidate_inode_pages((struct inode *)avc); +#endif } /* Flush and invalidate pages, for fsync() with INVAL flag @@ -85,7 +104,17 @@ void osi_VM_StoreAllSegments(struct vcache *avc) */ void osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) + struct inode *ip = (struct inode*)avc; + + truncate_inode_pages(&ip->i_data, 0); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15) + struct inode *ip = (struct inode*)avc; + + truncate_inode_pages(ip, 0); +#else invalidate_inode_pages((struct inode*)avc); +#endif } /* Purge pages beyond end-of-file, when truncating a file. @@ -96,5 +125,15 @@ void osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp) */ void osi_VM_Truncate(struct vcache *avc, int alen, struct AFS_UCRED *acred) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) + struct inode *ip = (struct inode*)avc; + + truncate_inode_pages(&ip->i_data, alen); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15) + struct inode *ip = (struct inode*)avc; + + truncate_inode_pages(ip, alen); +#else invalidate_inode_pages((struct inode*)avc); +#endif }