75 lines
2.4 KiB
Diff
75 lines
2.4 KiB
Diff
From da4c30a986de62dd092ec7b5c76417930fd56223 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.
|
|
|
|
Change-Id: If584329f7330f44be3909e4c8b935e4fe5e2b536
|
|
---
|
|
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 7a7cfcf..36211b6 100644
|
|
--- a/acinclude.m4
|
|
+++ b/acinclude.m4
|
|
@@ -839,6 +839,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 c840482..f729db5 100644
|
|
--- a/src/afs/LINUX/osi_compat.h
|
|
+++ b/src/afs/LINUX/osi_compat.h
|
|
@@ -580,4 +580,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
|
|
|