-/* 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 */
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;
}
*/
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
*/
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.
*/
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
}