7a764df5e9
This reverts commit e267e9ec30.
81 lines
2.6 KiB
Diff
81 lines
2.6 KiB
Diff
From e18d900f585d2fe319d3c0f6d10c11dc0acefed4 Mon Sep 17 00:00:00 2001
|
|
From: Marc Dionne <marc.c.dionne@gmail.com>
|
|
Date: Wed, 9 Jan 2013 21:22:27 -0500
|
|
Subject: [PATCH] Linux 3.8: vmtruncate removal
|
|
|
|
vmtruncate had been deprecated for a while and has now been
|
|
removed. Do things the new way based on truncate_setsize.
|
|
|
|
Reviewed-on: http://gerrit.openafs.org/8906
|
|
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
|
|
Tested-by: BuildBot <buildbot@rampaginggeek.com>
|
|
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
|
|
(cherry picked from commit d0479bbaf43900d6733c3f7517926ee9813c9610)
|
|
|
|
Change-Id: Ie0065cb0ca817c1af5ed51418a0474012050f34d
|
|
---
|
|
acinclude.m4 | 1 +
|
|
src/afs/LINUX/osi_compat.h | 14 ++++++++++++++
|
|
src/afs/LINUX/osi_vm.c | 5 ++---
|
|
3 files changed, 17 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/acinclude.m4 b/acinclude.m4
|
|
index 0a05caa..4223bb1 100644
|
|
--- a/acinclude.m4
|
|
+++ b/acinclude.m4
|
|
@@ -824,6 +824,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
|
|
AC_CHECK_LINUX_STRUCT([file_operations], [sendfile], [fs.h])
|
|
AC_CHECK_LINUX_STRUCT([file_system_type], [mount], [fs.h])
|
|
AC_CHECK_LINUX_STRUCT([filename], [name], [fs.h])
|
|
+ AC_CHECK_LINUX_STRUCT([inode_operations], [truncate], [fs.h])
|
|
AC_CHECK_LINUX_STRUCT([key_type], [preparse], [key-type.h])
|
|
AC_CHECK_LINUX_STRUCT([nameidata], [path], [namei.h])
|
|
AC_CHECK_LINUX_STRUCT([proc_dir_entry], [owner], [proc_fs.h])
|
|
diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h
|
|
index a777542..e8bf003 100644
|
|
--- a/src/afs/LINUX/osi_compat.h
|
|
+++ b/src/afs/LINUX/osi_compat.h
|
|
@@ -537,4 +537,18 @@ afs_set_session_keyring(struct key *keyring)
|
|
return old;
|
|
}
|
|
|
|
+static inline int
|
|
+afs_truncate(struct inode *inode, int len)
|
|
+{
|
|
+ int code;
|
|
+#if defined(STRUCT_INODE_OPERATIONS_HAS_TRUNCATE)
|
|
+ code = vmtruncate(inode, len);
|
|
+#else
|
|
+ code = inode_newsize_ok(inode, len);
|
|
+ if (!code)
|
|
+ truncate_setsize(inode, len);
|
|
+#endif
|
|
+ return code;
|
|
+}
|
|
+
|
|
#endif /* AFS_LINUX_OSI_COMPAT_H */
|
|
diff --git a/src/afs/LINUX/osi_vm.c b/src/afs/LINUX/osi_vm.c
|
|
index 2cd34f9..8bc792e 100644
|
|
--- a/src/afs/LINUX/osi_vm.c
|
|
+++ b/src/afs/LINUX/osi_vm.c
|
|
@@ -51,8 +51,7 @@ osi_VM_FlushVCache(struct vcache *avc, int *slept)
|
|
if (avc->opens != 0)
|
|
return EBUSY;
|
|
|
|
- return vmtruncate(ip, 0);
|
|
- return 0;
|
|
+ return afs_truncate(ip, 0);
|
|
}
|
|
|
|
/* Try to invalidate pages, for "fs flush" or "fs flushv"; or
|
|
@@ -132,5 +131,5 @@ osi_VM_FlushPages(struct vcache *avc, afs_ucred_t *credp)
|
|
void
|
|
osi_VM_Truncate(struct vcache *avc, int alen, afs_ucred_t *acred)
|
|
{
|
|
- vmtruncate(AFSTOV(avc), alen);
|
|
+ afs_truncate(AFSTOV(avc), alen);
|
|
}
|
|
--
|
|
1.7.2.5
|
|
|