[Pkg-lustre-svn-commit] updated: [23bbb1e] Fix yet another compiling error in llite_nfs.c

Patrick Winnertz winnie at debian.org
Fri Jun 5 13:57:56 UTC 2009


The following commit has been merged in the master branch:
commit 23bbb1ef70ff28c0d49fd1a4221f2b0862abefeb
Author: Patrick Winnertz <winnie at debian.org>
Date:   Fri Jun 5 11:56:03 2009 +0200

    Fix yet another compiling error in llite_nfs.c
    
    /usr/src/modules/lustre/lustre/llite/llite_nfs.c:241: error: variable ‘lustre_export_operations’ has initializer but incomplete type
    /usr/src/modules/lustre/lustre/llite/llite_nfs.c:242: error: unknown field ‘get_parent’ specified in initializer
    /usr/src/modules/lustre/lustre/llite/llite_nfs.c:242: warning: excess elements in struct initializer
    /usr/src/modules/lustre/lustre/llite/llite_nfs.c:242: warning: (near initialization for ‘lustre_export_operations’)
    /usr/src/modules/lustre/lustre/llite/llite_nfs.c:243: error: unknown field ‘get_dentry’ specified in initializer
    /usr/src/modules/lustre/lustre/llite/llite_nfs.c:243: warning: excess elements in struct initializer
    /usr/src/modules/lustre/lustre/llite/llite_nfs.c:243: warning: (near initialization for ‘lustre_export_operations’)
    
    Signed-off-by: Patrick Winnertz <winnie at debian.org>

diff --git a/debian/patches/bio_errors.dpatch b/debian/patches/bio_errors.dpatch
index 86e0a31..7bd0000 100755
--- a/debian/patches/bio_errors.dpatch
+++ b/debian/patches/bio_errors.dpatch
@@ -6,8 +6,8 @@
 
 @DPATCH@
 diff -urNad lustre~/lustre/autoconf/lustre-core.m4 lustre/lustre/autoconf/lustre-core.m4
---- lustre~/lustre/autoconf/lustre-core.m4	2009-06-05 10:43:07.000000000 +0200
-+++ lustre/lustre/autoconf/lustre-core.m4	2009-06-05 10:43:08.000000000 +0200
+--- lustre~/lustre/autoconf/lustre-core.m4	2009-06-05 10:57:07.000000000 +0200
++++ lustre/lustre/autoconf/lustre-core.m4	2009-06-05 10:57:07.000000000 +0200
 @@ -1390,6 +1390,41 @@
  ])
  ])
@@ -61,8 +61,8 @@ diff -urNad lustre~/lustre/autoconf/lustre-core.m4 lustre/lustre/autoconf/lustre
  
  #
 diff -urNad lustre~/lustre/include/linux/lustre_compat25.h lustre/lustre/include/linux/lustre_compat25.h
---- lustre~/lustre/include/linux/lustre_compat25.h	2009-06-05 10:43:07.000000000 +0200
-+++ lustre/lustre/include/linux/lustre_compat25.h	2009-06-05 10:43:08.000000000 +0200
+--- lustre~/lustre/include/linux/lustre_compat25.h	2009-06-05 10:57:07.000000000 +0200
++++ lustre/lustre/include/linux/lustre_compat25.h	2009-06-05 10:57:07.000000000 +0200
 @@ -472,5 +472,13 @@
  #define	sysctl_vfs_cache_pressure	100
  #endif
@@ -78,8 +78,8 @@ diff -urNad lustre~/lustre/include/linux/lustre_compat25.h lustre/lustre/include
  #endif /* __KERNEL__ */
  #endif /* _COMPAT25_H */
 diff -urNad lustre~/lustre/llite/file.c lustre/lustre/llite/file.c
---- lustre~/lustre/llite/file.c	2009-06-05 10:43:07.000000000 +0200
-+++ lustre/lustre/llite/file.c	2009-06-05 10:43:08.000000000 +0200
+--- lustre~/lustre/llite/file.c	2009-06-05 10:57:07.000000000 +0200
++++ lustre/lustre/llite/file.c	2009-06-05 10:57:07.000000000 +0200
 @@ -1858,6 +1858,9 @@
  #endif
  }
@@ -128,9 +128,424 @@ diff -urNad lustre~/lustre/llite/file.c lustre/lustre/llite/file.c
          .fsync          = ll_fsync,
  #ifdef HAVE_F_OP_FLOCK
          .flock          = ll_file_noflock,
+diff -urNad lustre~/lustre/llite/llite_nfs.c lustre/lustre/llite/llite_nfs.c
+--- lustre~/lustre/llite/llite_nfs.c	2009-06-02 11:38:20.000000000 +0200
++++ lustre/lustre/llite/llite_nfs.c	2009-06-05 11:55:37.000000000 +0200
+@@ -146,57 +146,90 @@
+         RETURN(result);
+ }
+ 
+-struct dentry *ll_fh_to_dentry(struct super_block *sb, __u32 *data, int len,
+-                               int fhtype, int parent)
++#define LUSTRE_NFS_FID 0x94
++
++struct lustre_nfs_fid {
++	struct ll_fid child;
++	struct ll_fid parent;
++	umode_t       mode;
++};
++
++static int ll_encode_fh(struct dentry *de, __u32 *fh, int *plen, int connectable)
+ {
+-        switch (fhtype) {
+-                case 2:
+-                        if (len < 5)
+-                                break;
+-                        if (parent)
+-                                return ll_iget_for_nfs(sb, data[3], 0, data[4]);
+-                case 1:
+-                        if (len < 3)
+-                                break;
+-                        if (parent)
+-                                break;
+-                        return ll_iget_for_nfs(sb, data[0], data[1], data[2]);
+-                default: break;
+-        }
+-        return ERR_PTR(-EINVAL);
++	struct inode *inode = de->d_inode;
++	struct inode *parent = de->d_parent->d_inode;
++	struct lustre_nfs_fid *nfs_fid = (void *)fh;
++	ENTRY;
++
++	CDEBUG(D_INFO, "encoding for (%lu) maxlen=%d minlen=%u\n",
++			inode->i_ino, *plen, (int)sizeof(struct lustre_nfs_fid));
++
++	if (*plen < sizeof(struct lustre_nfs_fid))
++		RETURN(255);
++
++	ll_inode2fid(&nfs_fid->child, inode);
++	ll_inode2fid(&nfs_fild->parent, inode);
++
++	nfs_fid->mode = (S_IFMT  & inode->i_mode);
++	*plen = sizeof(struct lustre_nfs_fid);
++
++	RETURN(LUSTRE_NFS_FID);
+ }
+ 
+-int ll_dentry_to_fh(struct dentry *dentry, __u32 *datap, int *lenp,
+-                    int need_parent)
++#ifdef HAVE_FH_TO_DENTRY
++struct dentry *ll_fh_to_dentry(struct super_block *sb, struct fid *fid,
++                               int fh_len int fh_type)
+ {
+-        if (*lenp < 3)
+-                return 255;
+-        *datap++ = dentry->d_inode->i_ino;
+-        *datap++ = dentry->d_inode->i_generation;
+-        *datap++ = (__u32)(S_IFMT & dentry->d_inode->i_mode);
++	struct lustre_nfs_fid *nfs_fid = (struct lustre_nfs_fid*)fid;
+ 
+-        if (*lenp == 3 || S_ISDIR(dentry->d_inode->i_mode)) {
+-                *lenp = 3;
+-                return 1;
+-        }
+-        if (dentry->d_parent) {
+-                *datap++ = dentry->d_parent->d_inode->i_ino;
+-                *datap++ = (__u32)(S_IFMT & dentry->d_parent->d_inode->i_mode);
++	if (fh_type != LUSTRE_NFS_FID)
++		RETURN(ERR_PTR(-EINVAL));
++	RETURN(ll_iget_for_nfs(sb, &nfs_fid->child));
++}
+ 
+-                *lenp = 5;
+-                return 2;
+-        }
+-        *lenp = 3;
+-        return 1;
++static struct dentry *ll_fh_to_parent(struct super_block *sb, struct fid *fid,
++					int fh_len, int fh_type)
++{
++	struct lustre_nfs_fid *nfs_fid = (struct lustre_nfs_fid*)fid;
++
++	if (fh_type != LUSTRE_NFS_FID)
++		RETURN(ERR_PTR(-EINVAL));
++	RETURN(ll_iget_for_nfs(sb, &nfs_fid->parent));
++}
++
++#else
++
++static struct dentry *ll_decode_fh(struct super_block *sb, __u32 *fh, int fh_len,
++					int fh_type,
++					int (*acceptable)(void *, struct dentry *),
++					void *context)
++{
++	struct lustre_nfs_fid *nfs_fid = (void *)fh;
++	struct dentry *entry;
++	ENTRY;
++
++	CDEBUG(D_INFO, "decoding for "LPU64" fh_len=%d fh_type=%x\n",
++		nfs_fid->child.id,fh_len,fh_type);
++
++	if (fh_type != LUSTRE_NFS_FID)
++		RETURN(ERR_PTR(-ESTALE));
++
++	entry = sb->s_export_op->find_exported_dentry(sb, &nfs_fid->child,
++							&nfs_fid->parent,
++							acceptable, context);
++	RETURN(entry);
+ }
+ 
+-#if THREAD_SIZE >= 8192
+ struct dentry *ll_get_dentry(struct super_block *sb, void *data)
+ {
+-        __u32 *inump = (__u32*)data;
+-        return ll_iget_for_nfs(sb, inump[0], inump[1], S_IFREG);
++	struct lustre_nfs_fid *fid = data;
++	ENTRY;
++	
++	RETURN(ll_iget_for_nfs(sb, &fid->child));
+ }
+ 
++#endif
++
+ struct dentry *ll_get_parent(struct dentry *dchild)
+ {
+         struct ptlrpc_request *req = NULL;
+@@ -224,10 +257,11 @@
+                 return ERR_PTR(rc);
+         }
+         body = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF, sizeof (*body)); 
+-       
++
+         LASSERT((body->valid & OBD_MD_FLGENER) && (body->valid & OBD_MD_FLID));
+-        
+-        result = ll_iget_for_nfs(dir->i_sb, body->ino, body->generation, S_IFDIR);
++	fid.id = body->ino;
++	fid.generation = body->generation;
++	result = ll_iget_for_nfs(dir->i_sb, &fid);
+ 
+         if (IS_ERR(result))
+                 rc = PTR_ERR(result);
+@@ -238,8 +272,15 @@
+         RETURN(result);
+ } 
+ 
++#if THREAD_SIZE >= 8192
+ struct export_operations lustre_export_operations = {
+-       .get_parent = ll_get_parent,
+-       .get_dentry = ll_get_dentry, 
++	.encode_fh = ll_encode_fh,
++#ifdef HAVE_FH_TO_DENTRY
++       .fh_to_dentry = ll_fh_to_dentry,
++       .fh_to_parent = ll_fh_to_parent,
++#else
++	.decode_fh  = ll_decode_fh,
++	.get_dentry = ll_get_dentry,
++#endif
+ };
+ #endif
+diff -urNad lustre~/lustre/llite/llite_nfs.c~ lustre/lustre/llite/llite_nfs.c~
+--- lustre~/lustre/llite/llite_nfs.c~	1970-01-01 01:00:00.000000000 +0100
++++ lustre/lustre/llite/llite_nfs.c~	2009-06-02 11:38:20.000000000 +0200
+@@ -0,0 +1,245 @@
++/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
++ * vim:expandtab:shiftwidth=8:tabstop=8:
++ *
++ * GPL HEADER START
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 only,
++ * as published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ * General Public License version 2 for more details (a copy is included
++ * in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License
++ * version 2 along with this program; If not, see
++ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ *
++ * GPL HEADER END
++ */
++/*
++ * Copyright  2008 Sun Microsystems, Inc. All rights reserved
++ * Use is subject to license terms.
++ */
++/*
++ * This file is part of Lustre, http://www.lustre.org/
++ * Lustre is a trademark of Sun Microsystems, Inc.
++ *
++ * lustre/llite/llite_nfs.c
++ *
++ * NFS export of Lustre Light File System
++ */
++
++#define DEBUG_SUBSYSTEM S_LLITE
++#include <lustre_lite.h>
++#include "llite_internal.h"
++#ifdef HAVE_LINUX_EXPORTFS_H
++#include <linux/exportfs.h>
++#endif
++
++__u32 get_uuid2int(const char *name, int len)
++{
++        __u32 key0 = 0x12a3fe2d, key1 = 0x37abe8f9;
++        while (len--) {
++                __u32 key = key1 + (key0 ^ (*name++ * 7152373));
++                if (key & 0x80000000) key -= 0x7fffffff;
++                key1 = key0;
++                key0 = key;
++        }
++        return (key0 << 1);
++}
++
++static int ll_nfs_test_inode(struct inode *inode, void *opaque)
++{
++        struct ll_fid *iid = opaque;
++
++        if (inode->i_ino == iid->id && inode->i_generation == iid->generation)
++                return 1;
++
++        return 0;
++}
++
++static struct inode * search_inode_for_lustre(struct super_block *sb,
++                                              unsigned long ino,
++                                              unsigned long generation,
++                                              int mode)
++{
++        struct ptlrpc_request *req = NULL;
++        struct ll_sb_info *sbi = ll_s2sbi(sb);
++        struct ll_fid fid;
++        unsigned long valid = 0;
++        int eadatalen = 0, rc;
++        struct inode *inode = NULL;
++        struct ll_fid iid = { .id = ino, .generation = generation };
++        ENTRY;
++
++        inode = ILOOKUP(sb, ino, ll_nfs_test_inode, &iid);
++
++        if (inode)
++                RETURN(inode);
++        if (S_ISREG(mode)) {
++                rc = ll_get_max_mdsize(sbi, &eadatalen);
++                if (rc) 
++                        RETURN(ERR_PTR(rc));
++                valid |= OBD_MD_FLEASIZE;
++        }
++        fid.id = (__u64)ino;
++        fid.generation = generation;
++        fid.f_type = mode;
++
++        rc = mdc_getattr(sbi->ll_mdc_exp, &fid, valid, eadatalen, &req);
++        if (rc) {
++                CERROR("failure %d inode %lu\n", rc, ino);
++                RETURN(ERR_PTR(rc));
++        }
++
++        rc = ll_prep_inode(sbi->ll_osc_exp, &inode, req, REPLY_REC_OFF, sb);
++        if (rc) {
++                ptlrpc_req_finished(req);
++                RETURN(ERR_PTR(rc));
++        }
++        ptlrpc_req_finished(req);
++
++        RETURN(inode);
++}
++
++static struct dentry *ll_iget_for_nfs(struct super_block *sb, unsigned long ino,
++                                      __u32 generation, umode_t mode)
++{
++        struct inode *inode;
++        struct dentry *result;
++        ENTRY;
++
++        if (ino == 0)
++                RETURN(ERR_PTR(-ESTALE));
++
++        inode = search_inode_for_lustre(sb, ino, generation, mode);
++        if (IS_ERR(inode)) {
++                RETURN(ERR_PTR(PTR_ERR(inode)));
++        }
++        if (is_bad_inode(inode) ||
++            (generation && inode->i_generation != generation)){
++                /* we didn't find the right inode.. */
++                CERROR("Inode %lu, Bad count: %lu %d or version  %u %u\n",
++                       inode->i_ino, (unsigned long)inode->i_nlink,
++                       atomic_read(&inode->i_count), inode->i_generation,
++                       generation);
++                iput(inode);
++                RETURN(ERR_PTR(-ESTALE));
++        }
++
++        result = d_alloc_anon(inode);
++        if (!result) {
++                iput(inode);
++                RETURN(ERR_PTR(-ENOMEM));
++        }
++        ll_dops_init(result, 1);
++
++        RETURN(result);
++}
++
++struct dentry *ll_fh_to_dentry(struct super_block *sb, __u32 *data, int len,
++                               int fhtype, int parent)
++{
++        switch (fhtype) {
++                case 2:
++                        if (len < 5)
++                                break;
++                        if (parent)
++                                return ll_iget_for_nfs(sb, data[3], 0, data[4]);
++                case 1:
++                        if (len < 3)
++                                break;
++                        if (parent)
++                                break;
++                        return ll_iget_for_nfs(sb, data[0], data[1], data[2]);
++                default: break;
++        }
++        return ERR_PTR(-EINVAL);
++}
++
++int ll_dentry_to_fh(struct dentry *dentry, __u32 *datap, int *lenp,
++                    int need_parent)
++{
++        if (*lenp < 3)
++                return 255;
++        *datap++ = dentry->d_inode->i_ino;
++        *datap++ = dentry->d_inode->i_generation;
++        *datap++ = (__u32)(S_IFMT & dentry->d_inode->i_mode);
++
++        if (*lenp == 3 || S_ISDIR(dentry->d_inode->i_mode)) {
++                *lenp = 3;
++                return 1;
++        }
++        if (dentry->d_parent) {
++                *datap++ = dentry->d_parent->d_inode->i_ino;
++                *datap++ = (__u32)(S_IFMT & dentry->d_parent->d_inode->i_mode);
++
++                *lenp = 5;
++                return 2;
++        }
++        *lenp = 3;
++        return 1;
++}
++
++#if THREAD_SIZE >= 8192
++struct dentry *ll_get_dentry(struct super_block *sb, void *data)
++{
++        __u32 *inump = (__u32*)data;
++        return ll_iget_for_nfs(sb, inump[0], inump[1], S_IFREG);
++}
++
++struct dentry *ll_get_parent(struct dentry *dchild)
++{
++        struct ptlrpc_request *req = NULL;
++        struct inode *dir = dchild->d_inode;
++        struct ll_sb_info *sbi;
++        struct dentry *result = NULL;
++        struct ll_fid fid;
++        struct mds_body *body;
++        char dotdot[] = "..";
++        int  rc = 0;
++        ENTRY;
++        
++        LASSERT(dir && S_ISDIR(dir->i_mode));
++        
++        sbi = ll_s2sbi(dir->i_sb);       
++ 
++        fid.id = (__u64)dir->i_ino;
++        fid.generation = dir->i_generation;
++        fid.f_type = S_IFDIR;
++
++        rc = mdc_getattr_name(sbi->ll_mdc_exp, &fid, dotdot, strlen(dotdot) + 1,
++                              0, 0, &req);
++        if (rc) {
++                CERROR("failure %d inode %lu get parent\n", rc, dir->i_ino);
++                return ERR_PTR(rc);
++        }
++        body = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF, sizeof (*body)); 
++       
++        LASSERT((body->valid & OBD_MD_FLGENER) && (body->valid & OBD_MD_FLID));
++        
++        result = ll_iget_for_nfs(dir->i_sb, body->ino, body->generation, S_IFDIR);
++
++        if (IS_ERR(result))
++                rc = PTR_ERR(result);
++
++        ptlrpc_req_finished(req);
++        if (rc)
++                return ERR_PTR(rc);
++        RETURN(result);
++} 
++
++struct export_operations lustre_export_operations = {
++       .get_parent = ll_get_parent,
++       .get_dentry = ll_get_dentry, 
++};
++#endif
 diff -urNad lustre~/lustre/llite/lloop.c lustre/lustre/llite/lloop.c
 --- lustre~/lustre/llite/lloop.c	2009-06-02 11:38:20.000000000 +0200
-+++ lustre/lustre/llite/lloop.c	2009-06-05 10:43:08.000000000 +0200
++++ lustre/lustre/llite/lloop.c	2009-06-05 10:57:07.000000000 +0200
 @@ -347,7 +347,7 @@
          loop_add_bio(lo, old_bio);
          return 0;

-- 
Lustre Debian Packaging 



More information about the Pkg-lustre-svn-commit mailing list