Whamcloud - gitweb
LU-6215 llite: filldir_t api changed for 3.18 kernels 81/14681/3
authorJames Simmons <uja.ornl@yahoo.com>
Thu, 21 May 2015 18:09:36 +0000 (14:09 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 19 Jun 2015 07:06:17 +0000 (07:06 +0000)
The filldir_t callback went from passing in a void *cookie
to struct dir_context instead. Here we enable handling this
api change in newer kernels. This functionality is used for
nfs over lustre support.

Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Change-Id: I5de025306ace61b8defdce227fe12b854caf1b3b
Reviewed-on: http://review.whamcloud.com/14681
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/autoconf/lustre-core.m4
lustre/llite/llite_nfs.c

index 79a01c8..601da01 100644 (file)
@@ -1629,6 +1629,36 @@ direct_io_iter, [
 ]) # LC_DIRECTIO_USE_ITER
 
 #
 ]) # LC_DIRECTIO_USE_ITER
 
 #
+# LC_NFS_FILLDIR_USE_CTX
+#
+# 3.18 kernel moved from void cookie to struct dir_context
+#
+AC_DEFUN([LC_NFS_FILLDIR_USE_CTX], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if filldir_t uses struct dir_context],
+filldir_ctx, [
+       #include <linux/fs.h>
+],[
+       int filldir(struct dir_context *ctx, const char* name,
+                   int i, loff_t off, u64 tmp, unsigned temp)
+       {
+               return 0;
+       }
+
+       struct dir_context ctx = {
+               .actor = filldir,
+       };
+
+       ctx.actor(NULL, "test", 0, (loff_t) 0, 0, 0);
+],[
+       AC_DEFINE(HAVE_FILLDIR_USE_CTX, 1,
+               [filldir_t needs struct dir_context as argument])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LC_NFS_FILLDIR_USE_CTX
+
+#
 # LC_KIOCB_HAS_NBYTES
 #
 # 3.19 kernel removed ki_nbytes from struct kiocb
 # LC_KIOCB_HAS_NBYTES
 #
 # 3.19 kernel removed ki_nbytes from struct kiocb
@@ -1815,6 +1845,9 @@ AC_DEFUN([LC_PROG_LINUX], [
        # 3.16
        LC_DIRECTIO_USE_ITER
 
        # 3.16
        LC_DIRECTIO_USE_ITER
 
+       # 3.18
+       LC_NFS_FILLDIR_USE_CTX
+
        # 3.19
        LC_KIOCB_HAS_NBYTES
 
        # 3.19
        LC_KIOCB_HAS_NBYTES
 
index c2cf74c..38e2726 100644 (file)
@@ -194,13 +194,22 @@ static int ll_encode_fh(struct inode *inode, __u32 *fh, int *plen,
        RETURN(FILEID_LUSTRE);
 }
 
        RETURN(FILEID_LUSTRE);
 }
 
-static int ll_nfs_get_name_filldir(void *cookie, const char *name, int namelen,
-                                   loff_t hash, u64 ino, unsigned type)
+static int
+#ifndef HAVE_FILLDIR_USE_CTX
+ll_nfs_get_name_filldir(void *cookie, const char *name, int namelen,
+                       loff_t hash, u64 ino, unsigned type)
 {
 {
+       struct ll_getname_data *lgd = cookie;
+#else
+ll_nfs_get_name_filldir(struct dir_context *ctx, const char *name, int namelen,
+                       loff_t hash, u64 ino, unsigned type)
+{
+       struct ll_getname_data *lgd =
+               container_of(ctx, struct ll_getname_data, ctx);
+#endif /* HAVE_FILLDIR_USE_CTX */
         /* It is hack to access lde_fid for comparison with lgd_fid.
          * So the input 'name' must be part of the 'lu_dirent'. */
         struct lu_dirent *lde = container_of0(name, struct lu_dirent, lde_name);
         /* It is hack to access lde_fid for comparison with lgd_fid.
          * So the input 'name' must be part of the 'lu_dirent'. */
         struct lu_dirent *lde = container_of0(name, struct lu_dirent, lde_name);
-        struct ll_getname_data *lgd = cookie;
         struct lu_fid fid;
 
         fid_le_to_cpu(&fid, &lde->lde_fid);
         struct lu_fid fid;
 
         fid_le_to_cpu(&fid, &lde->lde_fid);