]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-linux-new-aop-20081108 openafs-stable-1_4_8
authorMarc Dionne <marc.c.dionne@gmail.com>
Sat, 8 Nov 2008 16:49:57 +0000 (16:49 +0000)
committerDerrick Brashear <shadow@dementia.org>
Sat, 8 Nov 2008 16:49:57 +0000 (16:49 +0000)
LICENSE IPL10
FIXES 123580

support for 2.6.28

(cherry picked from commit 041f09e17b7e1760a968c0e38f52d7feac2862ba)

acinclude.m4
src/afs/LINUX/osi_vnodeops.c
src/cf/linux-test4.m4

index 4775aee433bbe03f7d75645ca254ed003b7f1bbb..40205442be0eb293d964c988af81f8cc047abd24 100644 (file)
@@ -693,6 +693,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_EXPORTS_FIND_TASK_BY_PID
                 LINUX_EXPORTS_PROC_ROOT_FS
                  LINUX_HAVE_CURRENT_KERNEL_TIME
+                 LINUX_HAVE_WRITE_BEGIN_AOP
                  LINUX_KMEM_CACHE_INIT
                 LINUX_HAVE_KMEM_CACHE_T
                 LINUX_KMEM_CACHE_CREATE_TAKES_DTOR
index 0350e09c455a13b6baf16356e40985a202fea331..926fa5dc6aa1656ac02b04d2268dddd9c5ebf956 100644 (file)
@@ -50,6 +50,7 @@ RCSID
 #endif
 
 extern struct vcache *afs_globalVp;
+extern int afs_notify_change(struct dentry *dp, struct iattr *iattrp);
 
 
 static ssize_t
@@ -1737,7 +1738,7 @@ afs_linux_permission(struct inode *ip, int mode)
     return -code;
 }
 
-#if defined(AFS_LINUX24_ENV)
+#if defined(AFS_LINUX24_ENV) && !(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) && defined(HAVE_WRITE_BEGIN))
 static int
 afs_linux_commit_write(struct file *file, struct page *page, unsigned offset,
                       unsigned to)
@@ -1764,8 +1765,37 @@ afs_linux_prepare_write(struct file *file, struct page *page, unsigned from,
 #endif
     return 0;
 }
+#endif
 
-extern int afs_notify_change(struct dentry *dp, struct iattr *iattrp);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) && defined(HAVE_WRITE_BEGIN)
+static int
+afs_linux_write_end(struct file *file, struct address_space *mapping,
+                                loff_t pos, unsigned len, unsigned copied,
+                                struct page *page, void *fsdata)
+{
+    int code;
+    pgoff_t index = pos >> PAGE_CACHE_SHIFT;
+    unsigned from = pos & (PAGE_CACHE_SIZE - 1);
+
+    code = afs_linux_writepage_sync(file->f_dentry->d_inode, page,
+                                    from, copied);
+    unlock_page(page);
+    page_cache_release(page);
+    return code;
+}
+
+static int
+afs_linux_write_begin(struct file *file, struct address_space *mapping,
+                                loff_t pos, unsigned len, unsigned flags,
+                                struct page **pagep, void **fsdata)
+{
+    struct page *page;
+    pgoff_t index = pos >> PAGE_CACHE_SHIFT;
+    page = __grab_cache_page(mapping, index);
+    *pagep = page;
+
+    return 0;
+}
 #endif
 
 static struct inode_operations afs_file_iops = {
@@ -1789,8 +1819,13 @@ static struct inode_operations afs_file_iops = {
 static struct address_space_operations afs_file_aops = {
   .readpage =          afs_linux_readpage,
   .writepage =         afs_linux_writepage,
-  .commit_write =      afs_linux_commit_write,
-  .prepare_write =     afs_linux_prepare_write,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) && defined(HAVE_WRITE_BEGIN)
+  .write_begin =        afs_linux_write_begin,
+  .write_end =          afs_linux_write_end,
+#else
+  .commit_write =       afs_linux_commit_write,
+  .prepare_write =      afs_linux_prepare_write,
+#endif
 };
 #endif
 
index ed4ce92007fdbecbb2cbd8d2f9b05cc698be7c5d..801f6d59ae9bb2eccac0fa022e6a95ed3b4db060 100644 (file)
@@ -1045,3 +1045,15 @@ AC_DEFUN([LINUX_SEMAPHORE_H_EXISTS], [
     AC_DEFINE([LINUX_SEMAPHORE_H], 1, [define if linux/semaphore.h exists])
   fi])
 
+AC_DEFUN([LINUX_HAVE_WRITE_BEGIN_AOP], [
+  AC_MSG_CHECKING([for linux write_begin() address space op])
+  AC_CACHE_VAL([ac_cv_linux_write_begin], [
+    AC_TRY_KBUILD(
+[#include <linux/fs.h>],
+[simple_write_begin(NULL, NULL, 0, 0, 0, NULL, NULL);],
+      ac_cv_linux_write_begin=yes,
+      ac_cv_linux_write_begin=no)])
+  AC_MSG_RESULT($ac_cv_linux_write_begin)
+  if test "x$ac_cv_linux_write_begin" = "xyes"; then
+    AC_DEFINE([HAVE_WRITE_BEGIN], 1, [define if your kernel has a write_begin() address space op])
+  fi])