Whamcloud - gitweb
- unland b_fid to HEAD
authoryury <yury>
Sun, 24 Oct 2004 17:05:37 +0000 (17:05 +0000)
committeryury <yury>
Sun, 24 Oct 2004 17:05:37 +0000 (17:05 +0000)
122 files changed:
lnet/include/linux/kp30.h
lnet/include/linux/libcfs.h
lnet/klnds/qswlnd/qswlnd.h
lnet/utils/portals.c
lustre/cmobd/Makefile.in
lustre/cmobd/Makefile.mk
lustre/cmobd/autoMakefile.am
lustre/cmobd/cache_manager_obd.c [new file with mode: 0644]
lustre/cmobd/cm_internal.h [deleted file]
lustre/cmobd/cm_mds_reint.c [deleted file]
lustre/cmobd/cm_obd.c [deleted file]
lustre/cmobd/cmobd_internal.h [new file with mode: 0644]
lustre/cmobd/cmobd_mds_reint.c [new file with mode: 0644]
lustre/cmobd/cmobd_oss_reint.c [moved from lustre/cmobd/cm_oss_reint.c with 82% similarity]
lustre/cmobd/cmobd_reint.c [moved from lustre/cmobd/cm_reint.c with 70% similarity]
lustre/cmobd/cmobd_write.c [moved from lustre/cmobd/cm_write.c with 91% similarity]
lustre/cobd/cache_obd.c
lustre/cobd/lproc_cache.c
lustre/include/liblustre.h
lustre/include/linux/lustre_fsfilt.h
lustre/include/linux/lustre_idl.h
lustre/include/linux/lustre_lib.h
lustre/include/linux/lustre_lite.h
lustre/include/linux/lustre_mds.h
lustre/include/linux/lustre_net.h
lustre/include/linux/lustre_smfs.h
lustre/include/linux/lvfs.h
lustre/include/linux/lvfs_linux.h
lustre/include/linux/obd.h
lustre/include/linux/obd_class.h
lustre/include/linux/obd_lmv.h
lustre/kernel_patches/patches/ext3-dentry-fid.patch [deleted file]
lustre/kernel_patches/patches/kksymoops-2.4.24.vanilla.patch
lustre/kernel_patches/series/vanilla-2.4.24
lustre/ldlm/ldlm_lib.c
lustre/liblustre/dir.c
lustre/liblustre/file.c
lustre/liblustre/llite_lib.c
lustre/liblustre/llite_lib.h
lustre/liblustre/namei.c
lustre/liblustre/rw.c
lustre/liblustre/super.c
lustre/llite/dcache.c
lustre/llite/dir.c
lustre/llite/file.c
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/llite_nfs.c
lustre/llite/namei.c
lustre/llite/rw.c
lustre/llite/special.c
lustre/llite/symlink.c
lustre/lmv/lmv_intent.c
lustre/lmv/lmv_internal.h
lustre/lmv/lmv_obd.c
lustre/lmv/lmv_objmgr.c
lustre/lov/lov_obd.c
lustre/lvfs/fsfilt_ext3.c
lustre/lvfs/fsfilt_smfs.c
lustre/lvfs/llog_lvfs.c
lustre/lvfs/lvfs_common.c
lustre/mdc/mdc_internal.h
lustre/mdc/mdc_lib.c
lustre/mdc/mdc_locks.c
lustre/mdc/mdc_reint.c
lustre/mdc/mdc_request.c
lustre/mds/handler.c
lustre/mds/mds_fs.c
lustre/mds/mds_groups.c
lustre/mds/mds_internal.h
lustre/mds/mds_lib.c
lustre/mds/mds_lmv.c
lustre/mds/mds_log.c
lustre/mds/mds_lov.c
lustre/mds/mds_open.c
lustre/mds/mds_reint.c
lustre/mds/mds_unlink_open.c
lustre/obdclass/genops.c
lustre/obdclass/lprocfs_status.c
lustre/obdclass/mea.c
lustre/obdclass/obd_config.c
lustre/obdecho/echo.c
lustre/obdfilter/filter.c
lustre/obdfilter/filter_internal.h
lustre/obdfilter/filter_io.c
lustre/obdfilter/filter_log.c
lustre/osc/osc_request.c
lustre/portals/include/linux/kp30.h
lustre/portals/include/linux/libcfs.h
lustre/portals/knals/qswnal/qswnal.h
lustre/portals/utils/portals.c
lustre/ptlbd/client.c
lustre/ptlrpc/import.c
lustre/ptlrpc/pack_generic.c
lustre/ptlrpc/ptlrpc_module.c
lustre/smfs/cache_space.c
lustre/smfs/dir.c
lustre/smfs/file.c
lustre/smfs/inode.c
lustre/smfs/ioctl.c
lustre/smfs/kml.c
lustre/smfs/mds_kml.c
lustre/smfs/ost_kml.c
lustre/smfs/smfs_internal.h
lustre/smfs/smfs_lib.c
lustre/smfs/smfs_llog.c
lustre/smfs/super.c
lustre/smfs/symlink.c
lustre/tests/cmobd.sh [deleted file]
lustre/tests/cobd.sh
lustre/tests/cobd_test.sh
lustre/tests/conf-sanity.sh
lustre/tests/local.sh
lustre/tests/sanity-cmobd.sh [deleted file]
lustre/tests/sanity.sh
lustre/tests/uml_cobd.sh
lustre/utils/lconf
lustre/utils/lmc
lustre/utils/lustre_cfg.c
lustre/utils/obd.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index de642bd..db63a08 100644 (file)
@@ -728,13 +728,4 @@ typedef int (*cfg_record_cb_t)(enum cfg_record_type, int len, void *data);
 # error "No word size defined"
 #endif
 
-/* lustre_id output helper macros */
-#define DLID4   "%lu/%lu/%lu/%lu"
-
-#define OLID4(id)                                  \
-        (unsigned long)(id)->li_fid.lf_id,         \
-        (unsigned long)(id)->li_fid.lf_group,      \
-        (unsigned long)(id)->li_stc.u.e3s.l3s_ino, \
-        (unsigned long)(id)->li_stc.u.e3s.l3s_gen
-
 #endif
index 17d5a11..d1a5c44 100644 (file)
@@ -145,13 +145,6 @@ struct ptldebug_header {
 # endif
 #endif
 
-#ifndef likely
-# define likely(exp) (exp)
-#endif
-#ifndef unlikely
-# define unlikely(exp) (exp)
-#endif
-
 #define LUSTRE_TRACE_SIZE (THREAD_SIZE >> 5)
 
 #ifdef __KERNEL__
index d25d201..438edc6 100644 (file)
@@ -79,7 +79,6 @@
 #include <portals/p30.h>
 #include <portals/lib-p30.h>
 #include <portals/nal.h>
-#include <linux/lustre_idl.h>
 
 #define KQSW_CHECKSUM   0
 #if KQSW_CHECKSUM
index 0e109cb..1bde59f 100644 (file)
 #include <endian.h>
 
 #ifdef __CYGWIN__
+
 #include <netinet/in.h>
-#endif
+
+#endif /* __CYGWIN__ */
  
 #include <portals/api-support.h>
 #include <portals/ptlctl.h>
@@ -52,7 +54,12 @@ unsigned int portal_printk;
 
 static unsigned int g_nal = 0;
 
-typedef struct {
+static int g_socket_txmem = 0;
+static int g_socket_rxmem = 0;
+static int g_socket_nonagle = 1;
+
+typedef struct
+{
         char *name;
         int   num;
 } name2num_t;
index 51c1902..8c16488 100644 (file)
@@ -1,4 +1,4 @@
 MODULES := cmobd 
-cmobd-objs := cm_obd.o cm_reint.o cm_write.o 
-cmobd-objs += cm_oss_reint.o cm_mds_reint.o lproc_cm.o
+cmobd-objs := cache_manager_obd.o cmobd_reint.o cmobd_write.o 
+cmobd-objs += cmobd_oss_reint.o cmobd_mds_reint.o lproc_cm.o
 @INCLUDE_RULES@
index 4fc7cf2..bcc81ec 100644 (file)
@@ -6,6 +6,6 @@
 include $(src)/../portals/Kernelenv
 
 obj-y += cmobd.o
-cmobd-objs := cm_obd.o cm_reint.o cm_write.o \ 
-             cm_oss_reint.o cm_mds_reint.o lproc_cm.o
+cmobd-objs := cache_manager_obd.o cmobd_reint.o cmobd_write.o \ 
+             cmobd_oss_reint.o cmobd_mds_reint.o lproc_cm.o
        
index 59d6abb..35dd6ef 100644 (file)
@@ -8,4 +8,4 @@ modulefs_DATA = cmobd$(KMODEXT)
 endif
 
 MOSTLYCLEANFILES = *.o *.ko *.mod.c
-DIST_SOURCES = $(cmobd-objs:%.o=%.c) cm_internal.h
+DIST_SOURCES = $(cmobd-objs:%.o=%.c) cmobd_internal.h
diff --git a/lustre/cmobd/cache_manager_obd.c b/lustre/cmobd/cache_manager_obd.c
new file mode 100644 (file)
index 0000000..92d850f
--- /dev/null
@@ -0,0 +1,215 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ *  Copyright (c) 2002 Cluster File Systems, Inc. <info@clusterfs.com>
+ *
+ *   This file is part of Lustre, http://www.lustre.org.
+ *
+ *   Lustre is free software; you can redistribute it and/or
+ *   modify it under the terms of version 2 of the GNU General Public
+ *   License as published by the Free Software Foundation.
+ *
+ *   Lustre 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 for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with Lustre; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#define DEBUG_SUBSYSTEM S_CMOBD
+
+#include <linux/version.h>
+#include <linux/init.h>
+#include <linux/obd_support.h>
+#include <linux/lustre_lib.h>
+#include <linux/lustre_net.h>
+#include <linux/lustre_idl.h>
+#include <linux/obd_class.h>
+#include <linux/lustre_mds.h>
+#include <linux/lustre_cmobd.h>
+#include <linux/lprocfs_status.h>
+#include <linux/obd_lov.h>
+
+#include "cmobd_internal.h"
+
+static int cmobd_attach(struct obd_device *obd, obd_count len, void *data)
+{
+        struct lprocfs_static_vars lvars;
+
+        lprocfs_init_vars(cmobd, &lvars);
+        return lprocfs_obd_attach(obd, lvars.obd_vars);
+}
+
+static int cmobd_detach(struct obd_device *obd)
+{
+        return lprocfs_obd_detach(obd);
+}
+
+static void cmobd_find_master_client_obd(struct obd_device *obd,
+                                        struct obd_uuid *uuid)
+{             
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+         
+        cmobd->cm_master_obd = class_find_client_obd(NULL, OBD_LOV_DEVICENAME,
+                                                     uuid);
+        if (cmobd->cm_master_obd == NULL) 
+               cmobd->cm_master_obd = class_find_client_obd(NULL, 
+                                                            LUSTRE_MDC_NAME, 
+                                                            uuid);
+}        
+
+static int cmobd_setup(struct obd_device *obd, obd_count len, void *buf)
+{
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+        struct lustre_cfg* lcfg = buf;
+        struct obd_uuid master_uuid, cache_uuid;
+        struct lustre_handle conn = { 0 };
+        int rc;
+        ENTRY;
+
+        if (lcfg->lcfg_inllen1 < 1 || !lcfg->lcfg_inlbuf1) {
+                CERROR("CMOBD setup requires master uuid\n");
+                RETURN(-EINVAL);
+        }
+        if (lcfg->lcfg_inllen2 < 1 || !lcfg->lcfg_inlbuf2) {
+                CERROR("CMOBD setup requires cache uuid\n");
+                RETURN(-EINVAL);
+        }
+        
+        obd_str2uuid(&master_uuid, lcfg->lcfg_inlbuf1);
+        obd_str2uuid(&cache_uuid, lcfg->lcfg_inlbuf2);
+
+        cmobd_find_master_client_obd(obd, &master_uuid);
+        if (cmobd->cm_master_obd == NULL) {
+                CERROR("Can't find master obd %s\n", &master_uuid.uuid[0]);
+                RETURN(-EINVAL);
+        }
+        cmobd->cm_cache_obd = class_uuid2obd(&cache_uuid);
+        if (cmobd->cm_cache_obd == NULL) {
+                CERROR("Can't find cache obd %s\n", &cache_uuid.uuid[0]);
+                RETURN(-EINVAL);
+        }
+
+        /* master lov connects to master ost here */
+        rc = obd_connect(&conn, cmobd->cm_master_obd, &obd->obd_uuid, 0); 
+        if (rc)
+                RETURN(rc);
+        cmobd->cm_master_exp = class_conn2export(&conn);
+
+        memset(&conn, 0, sizeof(conn));
+        rc = class_connect(&conn, cmobd->cm_cache_obd, &obd->obd_uuid);
+        if (rc)
+                GOTO(put_master, rc);
+        cmobd->cm_cache_exp = class_conn2export(&conn);
+        if (!strcmp(cmobd->cm_master_obd->obd_type->typ_name, 
+                    OBD_LOV_DEVICENAME)){
+                /* for master osc remove the recovery flag of oscc */
+                rc = obd_set_info(cmobd->cm_master_exp, strlen("unrecovery"),
+                                  "unrecovery", 0, NULL); 
+                if (rc)
+                        GOTO(put_master, rc);
+                
+                rc = cmobd_init_write_srv(obd);
+                if (rc)
+                        GOTO(put_cache, rc);
+
+        } else {
+                /*FIXME later temp fix here 
+                 *Assumation:cache mds only have one ost*/
+                cmobd->cm_master_obd->u.cli.cl_max_mds_easize = 
+                                                lov_mds_md_size(1);
+        }
+        /* start n threads for write replay */
+        RETURN(0);
+put_cache:
+        class_disconnect(cmobd->cm_cache_exp, 0);
+put_master:
+        obd_disconnect(cmobd->cm_master_exp, 0);
+        RETURN(rc);
+}
+
+static int cmobd_cleanup(struct obd_device *obd, int flags)
+{
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+        ENTRY;
+        
+        if (!strcmp(cmobd->cm_master_obd->obd_type->typ_name,
+                    OBD_LOV_DEVICENAME)) {
+                cmobd_cleanup_write_srv(obd);
+        }
+        class_disconnect(cmobd->cm_cache_exp, 0);
+        obd_disconnect(cmobd->cm_master_exp, 0);
+        
+        RETURN(0);
+}
+
+static int cmobd_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
+                           void *karg, void *uarg)
+{
+        struct obd_device *obd = exp->exp_obd;
+        int rc = 0;
+        ENTRY;
+        
+        switch (cmd) {
+        case OBD_IOC_CMOBD_SYNC: /* trigger reintegration */
+                rc = cmobd_reintegrate(obd);
+                break;
+        default:
+                CERROR("unrecognized ioctl %#x\n", cmd);
+                rc = -EINVAL;
+                break;
+        }
+                
+        RETURN(rc);
+}
+
+static struct obd_ops cmobd_ops = {
+        o_owner:                THIS_MODULE,
+        o_attach:               cmobd_attach,
+        o_detach:               cmobd_detach,
+        o_setup:                cmobd_setup,
+        o_cleanup:              cmobd_cleanup,
+        o_iocontrol:            cmobd_iocontrol,
+};
+
+kmem_cache_t *cmobd_extent_slab;
+
+static int __init cmobd_init(void)
+{
+        struct lprocfs_static_vars lvars;
+        int rc;
+        ENTRY;
+
+        printk(KERN_INFO "Lustre: Cache Manager OBD driver; info@clusterfs.com\n");
+
+        lprocfs_init_vars(cmobd, &lvars);
+        rc = class_register_type(&cmobd_ops, NULL, lvars.module_vars,
+                                 LUSTRE_CMOBD_NAME);
+        if (rc)
+                RETURN(rc);
+        cmobd_extent_slab = kmem_cache_create("cmobd_extents",
+                                               sizeof(struct cmobd_extent_info), 0,
+                                               SLAB_HWCACHE_ALIGN, NULL, NULL);
+        if (cmobd_extent_slab == NULL) {
+                class_unregister_type(LUSTRE_CMOBD_NAME);
+                RETURN(-ENOMEM);
+        }
+        RETURN(0);
+}
+
+static void /*__exit*/ cmobd_exit(void)
+{
+        class_unregister_type(LUSTRE_CMOBD_NAME);
+        if (kmem_cache_destroy(cmobd_extent_slab) != 0)
+                CERROR("couldn't free cmobd extent slab\n");
+}
+
+MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
+MODULE_DESCRIPTION("Lustre Cache Manager OBD driver");
+MODULE_LICENSE("GPL");
+
+module_init(cmobd_init);
+module_exit(cmobd_exit);
diff --git a/lustre/cmobd/cm_internal.h b/lustre/cmobd/cm_internal.h
deleted file mode 100644 (file)
index 5d32eb6..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Copyright (C) 2003 Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-
-#ifndef CM_INTERNAL_H
-#define CM_INTERNAL_H
-
-int cmobd_reintegrate(struct obd_device *);
-int cmobd_dummy_lsm(struct lov_stripe_md **, int, struct obdo*, __u32);
-void cmobd_free_lsm(struct lov_stripe_md **);
-
-int cmobd_replay_write(struct obd_device *, struct obdo *, 
-                       struct ldlm_extent *);
-
-int cmobd_init_write_srv(struct obd_device *);
-void cmobd_cleanup_write_srv(struct obd_device *);
-
-int cmobd_reint_mds(struct obd_device*obd, void *record, int opcode);
-int cmobd_reint_oss(struct obd_device *obd, void *record, int opcode);
-
-/* methods for updating/reading master lustre_id from local MDS inode EA.*/
-int mds_update_mid(struct obd_device *obd, struct lustre_id *id,
-                   void *data, int data_len);
-
-int mds_read_mid(struct obd_device *obd, struct lustre_id *id,
-                 void *data, int data_len);
-
-#endif /* CM_INTERNAL_H */
diff --git a/lustre/cmobd/cm_mds_reint.c b/lustre/cmobd/cm_mds_reint.c
deleted file mode 100644 (file)
index d77acf2..0000000
+++ /dev/null
@@ -1,377 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Copyright (C) 2001-2003 Cluster File Systems, Inc.
- *
- *   This file is part of Lustre, http://www.sf.net/projects/lustre/
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre 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 for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#define DEBUG_SUBSYSTEM S_CMOBD
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/obd_class.h>
-#include <linux/lustre_net.h>
-#include <linux/lustre_mds.h>
-#include <linux/lustre_smfs.h>
-
-#include "cm_internal.h"
-
-/* converts mds_rec_setattr to struct iattr. */
-static inline void cmobd_rec2iattr(struct mds_rec_setattr *rec,
-                                   struct iattr *iattr)
-{
-        iattr->ia_uid = rec->sa_uid;
-        iattr->ia_gid = rec->sa_gid;
-        iattr->ia_mode = rec->sa_mode;
-        iattr->ia_size = rec->sa_size;
-        iattr->ia_valid = rec->sa_valid;
-        LTIME_S(iattr->ia_atime) = rec->sa_atime;
-        LTIME_S(iattr->ia_mtime) = rec->sa_mtime;
-        LTIME_S(iattr->ia_ctime) = rec->sa_ctime;
-        iattr->ia_attr_flags = rec->sa_attr_flags;
-}
-
-static void
-cmobd_prepare_mdc_data(struct mdc_op_data *data, struct lustre_id *id1,
-                       struct lustre_id *id2, const char *name,
-                       int namelen, __u32 mode)
-{
-        LASSERT(id1);
-        LASSERT(data);
-
-        memset(data, 0, sizeof(*data));
-
-        data->id1 = *id1;
-        if (id2)
-                data->id2 = *id2;
-       else
-               memset(&data->id2, 0, sizeof(data->id2));
-
-       data->valid = 0;
-        data->name = name;
-        data->namelen = namelen;
-        data->create_mode = mode;
-        data->mod_time = CURRENT_TIME;
-}
-
-/* If mdc_setattr() is called with an 'iattr', then it is a normal RPC that
- * should take the normal semaphore and go to the normal portal.
- *
- * If it is called with iattr->ia_valid & ATTR_FROM_OPEN, then it is a magic
- * open-path setattr that should take the setattr semaphore and go to the
- * setattr portal. */
-static int cmobd_reint_setattr(struct obd_device *obd, void *record)
-{
-        struct cm_obd *cmobd = &obd->u.cm;
-        struct ptlrpc_request *req = NULL;
-        struct mds_kml_pack_info *mkpi;
-        struct mds_rec_setattr *rec;
-        struct mdc_op_data op_data;
-        struct lustre_msg *msg;
-        int ea1len, ea2len;
-        struct iattr iattr;
-        void *ea1, *ea2;
-        int rc = 0;
-        ENTRY;
-
-        mkpi = (struct mds_kml_pack_info *)record;
-        msg = (struct lustre_msg *)(record + sizeof(*mkpi));
-
-        rec = lustre_msg_buf(msg, 0, 0);
-        if (!rec) 
-                RETURN(-EINVAL);
-
-        /* converting setattr rec to struct iattr. */
-        cmobd_rec2iattr(rec, &iattr);
-
-        /* FIXME-UMKA: here should be handling of setattr() from open. Bug
-         * #249. Will be fixed later. */
-
-        /* converting localstore cookie to remote lustre_id. */
-        rc = mds_read_mid(cmobd->cache_obd, &rec->sa_id,
-                          &rec->sa_id, sizeof(rec->sa_id));
-        if (rc) {
-                CERROR("Can't read master MDS store cookie "
-                       "from local inode EA, err = %d.\n", rc);
-                RETURN(rc);
-        }
-
-        cmobd_prepare_mdc_data(&op_data, &rec->sa_id, NULL,
-                               NULL, 0, 0);
-
-        /* handling possible EAs. */
-        ea1 = lustre_msg_buf(msg, 1, 0);
-        ea1len = ea1 ? msg->buflens[1] : 0;
-
-        ea2 = lustre_msg_buf(msg, 2, 0);
-        ea2len = ea2 ? msg->buflens[2] : 0;
-
-        rc = md_setattr(cmobd->master_exp, &op_data, &iattr,
-                        ea1, ea1len, ea2, ea2len, &req);
-
-        if (req)
-                ptlrpc_req_finished(req);
-        RETURN(rc);
-}
-
-static int cmobd_reint_create(struct obd_device *obd, void *record)
-{
-        struct cm_obd *cmobd = &obd->u.cm;
-        struct ptlrpc_request *req = NULL;
-        struct mds_kml_pack_info *mkpi;
-        int rc = 0, namelen, datalen;
-        struct mds_rec_create *rec;
-        struct mdc_op_data op_data;
-        struct lustre_msg *msg;
-        struct mds_body *body;
-        struct lustre_id lid;
-        char *name, *data;
-        ENTRY;
-
-        mkpi = (struct mds_kml_pack_info *)record;
-        msg = (struct lustre_msg *)(record + sizeof(*mkpi));
-
-        rec = lustre_msg_buf(msg, 0, 0);
-        if (!rec) 
-                RETURN(-EINVAL);
-        
-        lid = rec->cr_replayid;
-
-        /* zeroing @rec->cr_replayid out in request, as master MDS should create
-         * own inode (with own store cookie). */
-        memset(&rec->cr_replayid, 0, sizeof(rec->cr_replayid));
-
-        /* converting local inode store cookie to remote lustre_id. */
-        rc = mds_read_mid(cmobd->cache_obd, &rec->cr_id,
-                          &rec->cr_id, sizeof(rec->cr_id));
-        if (rc) {
-                CERROR("Can't read master MDS store cookie "
-                       "from local inode EA, err = %d.\n", rc);
-                RETURN(rc);
-        }
-
-        /* getting name to be created and its length */
-        name = lustre_msg_string(msg, 1, 0);
-        namelen = name ? msg->buflens[1] - 1 : 0;
-
-        /* getting misc data (symlink) and its length */
-        data = (char *)lustre_msg_buf(msg, 2, 0);
-        datalen = data ? msg->buflens[2] : 0;
-
-        /* prepare mdc request data. */
-        cmobd_prepare_mdc_data(&op_data, &rec->cr_id, &rec->cr_replayid,
-                               name, namelen, rec->cr_mode);
-
-        /* requesting to master to create object with passed attributes. */
-        rc = md_create(cmobd->master_exp, &op_data, data, datalen,
-                       rec->cr_mode, current->fsuid, current->fsgid,
-                       rec->cr_rdev, &req);
-
-        if (!rc) {
-                /* here we save store cookie from master MDS to local 
-                 * inode EA. */
-                body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
-
-                rc = mds_update_mid(cmobd->cache_obd, &lid,
-                                    &body->id1, sizeof(body->id1));
-        }
-
-        if (req)
-                ptlrpc_req_finished(req);
-        RETURN(rc);
-}
-
-static int cmobd_reint_unlink(struct obd_device *obd, void *record)
-{
-        struct cm_obd *cmobd = &obd->u.cm;
-        struct ptlrpc_request *req = NULL;
-        struct mds_kml_pack_info *mkpi;
-        struct mdc_op_data op_data;
-        struct mds_rec_unlink *rec;
-        struct lustre_msg *msg;
-        int rc = 0, namelen;
-        char *name = NULL;
-        ENTRY;
-        
-        mkpi = (struct mds_kml_pack_info *)record;
-        msg = (struct lustre_msg *)(record + sizeof(*mkpi));
-
-        rec = lustre_msg_buf(msg, 0, 0);
-        if (!rec) 
-                RETURN(-EINVAL);
-
-        /* converting local store cookie to remote lustre_id. */
-        rc = mds_read_mid(cmobd->cache_obd, &rec->ul_id1,
-                          &rec->ul_id1, sizeof(rec->ul_id1));
-        if (rc) {
-                CERROR("Can't read master MDS store cookie "
-                       "from local inode EA, err = %d.\n", rc);
-                RETURN(rc);
-        }
-
-        /* getting name to be created and its length */
-        name = lustre_msg_string(msg, 1, 0);
-        namelen = name ? msg->buflens[1] - 1 : 0;
-
-        /* prepare mdc request data. */
-        cmobd_prepare_mdc_data(&op_data, &rec->ul_id1, NULL,
-                               name, namelen, rec->ul_mode);
-
-        rc = md_unlink(cmobd->master_exp, &op_data, &req);
-
-        if (req)
-                ptlrpc_req_finished(req);
-        RETURN(rc);
-}
-
-static int cmobd_reint_link(struct obd_device *obd, void *record)
-{
-        struct cm_obd *cmobd = &obd->u.cm;
-        struct ptlrpc_request *req = NULL;
-        struct mds_kml_pack_info *mkpi;
-        struct mdc_op_data op_data;
-        struct mds_rec_link *rec;
-        struct lustre_msg *msg;
-        int rc = 0, namelen;
-        char *name;
-        ENTRY;
-
-        mkpi = (struct mds_kml_pack_info *)record;
-        msg = (struct lustre_msg *)(record + sizeof(*mkpi));
-        
-        rec = lustre_msg_buf(msg, 0, 0);
-        if (!rec) 
-                RETURN(-EINVAL);
-
-        /* converting local store cookie for both ids to remote lustre_id. */
-        rc = mds_read_mid(cmobd->cache_obd, &rec->lk_id1,
-                          &rec->lk_id1, sizeof(rec->lk_id1));
-        if (rc) {
-                CERROR("Can't read master MDS store cookie "
-                       "from local inode EA, err = %d.\n", rc);
-                RETURN(rc);
-        }
-        
-        rc = mds_read_mid(cmobd->cache_obd, &rec->lk_id2,
-                          &rec->lk_id2, sizeof(rec->lk_id2));
-        if (rc) {
-                CERROR("Can't read master MDS store cookie "
-                       "from local inode EA, err = %d.\n", rc);
-                RETURN(rc);
-        }
-        
-        /* getting name to be created and its length */
-        name = lustre_msg_string(msg, 1, 0);
-        namelen = name ? msg->buflens[1] - 1: 0;
-
-        /* prepare mdc request data. */
-        cmobd_prepare_mdc_data(&op_data, &rec->lk_id1, &rec->lk_id2,
-                               name, namelen, 0);
-
-        rc = md_link(cmobd->master_exp, &op_data, &req);
-
-        if (req)
-                ptlrpc_req_finished(req);
-        RETURN(rc);
-}
-
-static int cmobd_reint_rename(struct obd_device *obd, void *record)
-{
-        struct cm_obd *cmobd = &obd->u.cm;
-        struct ptlrpc_request *req = NULL;
-        struct mds_kml_pack_info *mkpi;
-        struct mdc_op_data op_data;
-        struct mds_rec_rename *rec;
-        int rc = 0, oldlen, newlen;
-        struct lustre_msg *msg;
-        char *old, *new;
-        ENTRY;
-
-        mkpi = (struct mds_kml_pack_info *)record;
-        msg = (struct lustre_msg *)(record + sizeof(*mkpi));
-        
-        rec = lustre_msg_buf(msg, 0, 0);
-        if (!rec) 
-                RETURN(-EINVAL);
-        
-        /* converting local store cookie for both ids to remote lustre_id. */
-        rc = mds_read_mid(cmobd->cache_obd, &rec->rn_id1,
-                          &rec->rn_id1, sizeof(rec->rn_id1));
-        if (rc) {
-                CERROR("Can't read master MDS store cookie "
-                       "from local inode EA, err = %d.\n", rc);
-                RETURN(rc);
-        }
-        
-        rc = mds_read_mid(cmobd->cache_obd, &rec->rn_id2,
-                          &rec->rn_id2, sizeof(rec->rn_id2));
-        if (rc) {
-                CERROR("Can't read master MDS store cookie "
-                       "from local inode EA, err = %d.\n", rc);
-                RETURN(rc);
-        }
-
-        /* getting old name and its length */
-        old = lustre_msg_string(msg, 1, 0);
-        oldlen = old ? msg->buflens[1] - 1 : 0;
-
-        /* getting new len and its length */
-        new = lustre_msg_string(msg, 2, 0);
-        newlen = new ? msg->buflens[2] - 1: 0;
-        
-        /* prepare mdc request data. */
-        cmobd_prepare_mdc_data(&op_data, &rec->rn_id1, &rec->rn_id1,
-                               NULL, 0, 0);
-
-        rc = md_rename(cmobd->master_exp, &op_data, old, oldlen,
-                       new, newlen, &req);
-
-        if (req)
-                ptlrpc_req_finished(req);
-        RETURN(rc);
-}
-
-typedef int (*cmobd_reint_rec_func_t)(struct obd_device *, void *);
-
-static cmobd_reint_rec_func_t mds_reint_handler[REINT_MAX + 1] = {
-        [REINT_SETATTR] cmobd_reint_setattr,
-        [REINT_CREATE] cmobd_reint_create,
-        [REINT_LINK] cmobd_reint_link,
-        [REINT_UNLINK] cmobd_reint_unlink,
-        [REINT_RENAME] cmobd_reint_rename,
-};
-
-int cmobd_reint_mds(struct obd_device *obd, void *record, int dummy)
-{
-        struct mds_kml_pack_info *mkpi;
-        struct lustre_msg *msg;
-        __u32 opcode;
-        
-        mkpi = (struct mds_kml_pack_info *)record;
-        msg = (struct lustre_msg *)(record + sizeof(*mkpi));
-        
-        opcode = *(__u32 *)lustre_msg_buf(msg, 0, 0);
-        
-        if (opcode > REINT_MAX || opcode <= 0) {
-                CERROR("Invalid mds reint opcode %u\n",
-                       opcode);
-                return -EINVAL;
-        }
-        
-        return mds_reint_handler[opcode](obd, record);
-} 
diff --git a/lustre/cmobd/cm_obd.c b/lustre/cmobd/cm_obd.c
deleted file mode 100644 (file)
index 5d6592d..0000000
+++ /dev/null
@@ -1,319 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (c) 2002 Cluster File Systems, Inc. <info@clusterfs.com>
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre 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 for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#define DEBUG_SUBSYSTEM S_CMOBD
-
-#include <linux/version.h>
-#include <linux/init.h>
-#include <linux/obd_support.h>
-#include <linux/lustre_lib.h>
-#include <linux/lustre_net.h>
-#include <linux/lustre_idl.h>
-#include <linux/obd_class.h>
-#include <linux/lustre_mds.h>
-#include <linux/lustre_cmobd.h>
-#include <linux/lprocfs_status.h>
-#include <linux/obd_lov.h>
-#include <linux/obd_lmv.h>
-
-#include "cm_internal.h"
-
-static int cmobd_attach(struct obd_device *obd,
-                        obd_count len, void *data)
-{
-        struct lprocfs_static_vars lvars;
-
-        lprocfs_init_vars(cmobd, &lvars);
-        return lprocfs_obd_attach(obd, lvars.obd_vars);
-}
-
-static int cmobd_detach(struct obd_device *obd)
-{
-        return lprocfs_obd_detach(obd);
-}
-
-static struct obd_device *cmobd_find_master(struct obd_device *obd,
-                                            struct obd_uuid *uuid)
-{
-        struct obd_device *master_obd;
-
-        CWARN("%s: looking for client obd %s\n",
-              obd->obd_uuid.uuid, uuid->uuid);
-         
-        master_obd = class_find_client_obd(NULL,
-                                           OBD_LOV_DEVICENAME,
-                                           uuid);
-        if (master_obd)
-                return master_obd;
-        
-        master_obd = class_find_client_obd(NULL,
-                                           OBD_LMV_DEVICENAME,
-                                           uuid);
-        if (master_obd)
-                return master_obd;
-        
-        master_obd = class_find_client_obd(NULL, LUSTRE_MDC_NAME, 
-                                           uuid);
-        return master_obd;
-}
-
-static inline int cmobd_lmv_obd(struct obd_device *obd)
-{
-        if (!strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) ||
-            !strcmp(obd->obd_type->typ_name, OBD_LMV_DEVICENAME))
-                return 1;
-
-        return 0;
-}
-
-static inline int cmobd_lov_obd(struct obd_device *obd)
-{
-        if (!strcmp(obd->obd_type->typ_name, OBD_LOV_DEVICENAME))
-                return 1;
-
-        return 0;
-}
-
-static void cmobd_init_ea_size(struct obd_device *obd)
-{
-        int ost_count = 1, easize, cookiesize;
-        struct cm_obd *cmobd = &obd->u.cm;
-        ENTRY;
-
-        /* FIXME-UMKA: here we should also take into account that there is
-         * possible to have few OSTs. */
-        easize = lov_mds_md_size(ost_count);
-        cookiesize = ost_count * sizeof(struct llog_cookie);
-
-        obd_init_ea_size(cmobd->master_exp, easize, cookiesize);
-
-        cmobd->master_obd->u.cli.cl_max_mds_easize = easize;
-        cmobd->master_obd->u.cli.cl_max_mds_cookiesize = cookiesize;
-        
-        EXIT;
-}
-
-static int cmobd_setup(struct obd_device *obd, obd_count len, void *buf)
-{
-        struct obd_uuid master_uuid, cache_uuid;
-        struct lustre_handle conn = { 0 };
-        struct cm_obd *cmobd = &obd->u.cm;
-        struct lustre_cfg* lcfg = buf;
-        struct lustre_id mid, lid;
-        int valsize, rc;
-        ENTRY;
-
-        if (lcfg->lcfg_inllen1 < 1 || !lcfg->lcfg_inlbuf1) {
-                CERROR("CMOBD setup requires master uuid\n");
-                RETURN(-EINVAL);
-        }
-        if (lcfg->lcfg_inllen2 < 1 || !lcfg->lcfg_inlbuf2) {
-                CERROR("CMOBD setup requires cache uuid\n");
-                RETURN(-EINVAL);
-        }
-        
-        obd_str2uuid(&master_uuid, lcfg->lcfg_inlbuf1);
-        obd_str2uuid(&cache_uuid, lcfg->lcfg_inlbuf2);
-
-        /* FIXME-WANGDI: saving client obds here is not correct as they may
-           become invalid due to refcounter exhausting on cleanup. The prefer
-           way seems to be getting them each time we need them. */
-        cmobd->master_obd = cmobd_find_master(obd, &master_uuid);
-        if (cmobd->master_obd == NULL) {
-                CERROR("Can't find master obd %s\n", &master_uuid.uuid[0]);
-                RETURN(-EINVAL);
-        }
-        
-        cmobd->cache_obd = class_uuid2obd(&cache_uuid);
-        if (cmobd->cache_obd == NULL) {
-                CERROR("Can't find cache obd %s\n", &cache_uuid.uuid[0]);
-                RETURN(-EINVAL);
-        }
-
-        rc = obd_connect(&conn, cmobd->master_obd, &obd->obd_uuid, 0);
-        if (rc)
-                RETURN(rc);
-        cmobd->master_exp = class_conn2export(&conn);
-
-        memset(&conn, 0, sizeof(conn));
-        rc = class_connect(&conn, cmobd->cache_obd, &obd->obd_uuid);
-        if (rc)
-                GOTO(put_master, rc);
-
-        cmobd->cache_exp = class_conn2export(&conn);
-        
-        if (cmobd_lov_obd(cmobd->master_obd)) {
-                /* for master osc remove the recovery flag. */
-                rc = obd_set_info(cmobd->master_exp, strlen("unrecovery"),
-                                  "unrecovery", 0, NULL); 
-                if (rc)
-                        GOTO(put_master, rc);
-                
-                rc = cmobd_init_write_srv(obd);
-                if (rc)
-                        GOTO(put_cache, rc);
-        } else {
-                cmobd_init_ea_size(obd);
-                cmobd->write_srv = NULL;
-        }
-
-        if (cmobd_lmv_obd(cmobd->master_obd)) {
-                /* making sure, that both obds are ready. This is especially
-                 * important in the case of using LMV as master. */
-                rc = obd_getready(cmobd->master_exp);
-                if (rc) {
-                        CERROR("Can't make %s obd ready.\n",
-                               master_uuid.uuid);
-                        GOTO(put_cache, rc);
-                }
-        
-                rc = obd_getready(cmobd->cache_exp);
-                if (rc) {
-                        CERROR("Can't make %s obd ready.\n",
-                               cache_uuid.uuid);
-                        GOTO(put_cache, rc);
-                }
-        
-                /* requesting master obd to have its root inode store cookie to
-                 * be able to save it to local root inode EA. */
-                valsize = sizeof(struct lustre_id);
-        
-                rc = obd_get_info(cmobd->master_exp, strlen("rootid"),
-                                  "rootid", &valsize, &mid);
-                if (rc) {
-                        CERROR("Can't get rootid from master MDS %s, "
-                               "err= %d.\n", master_uuid.uuid, rc);
-                        GOTO(put_cache, rc);
-                }
-
-                /* getting rootid from cache MDS. It is needed to update local
-                 * (cache) root inode by rootid value from master obd. */
-                rc = obd_get_info(cmobd->cache_exp, strlen("rootid"),
-                                  "rootid", &valsize, &lid);
-                if (rc) {
-                        CERROR("Can't get rootid from local MDS %s, "
-                               "err= %d.\n", cache_uuid.uuid, rc);
-                        GOTO(put_cache, rc);
-                }
-
-                /* storing master MDS rootid to local root inode EA. */
-                CWARN("storing "DLID4" to local inode "DLID4".\n",
-                      OLID4(&mid), OLID4(&lid));
-
-                rc = mds_update_mid(cmobd->cache_obd, &lid,
-                                    &mid, sizeof(mid));
-                if (rc) {
-                        CERROR("Can't update local root inode by ID "
-                               "from master MDS %s, err = %d.\n",
-                               master_uuid.uuid, rc);
-                        GOTO(put_cache, rc);
-                }
-        }
-
-        RETURN(rc);
-put_cache:
-        class_disconnect(cmobd->cache_exp, 0);
-put_master:
-        obd_disconnect(cmobd->master_exp, 0);
-        RETURN(rc);
-}
-
-static int cmobd_cleanup(struct obd_device *obd, int flags)
-{
-        struct cm_obd *cmobd = &obd->u.cm;
-        ENTRY;
-
-        if (cmobd->write_srv)
-                cmobd_cleanup_write_srv(obd);
-
-        class_disconnect(cmobd->cache_exp, 0);
-        obd_disconnect(cmobd->master_exp, 0);
-        
-        RETURN(0);
-}
-
-static int cmobd_iocontrol(unsigned int cmd, struct obd_export *exp,
-                           int len, void *karg, void *uarg)
-{
-        struct obd_device *obd = exp->exp_obd;
-        int rc = 0;
-        ENTRY;
-        
-        switch (cmd) {
-        case OBD_IOC_CMOBD_SYNC: /* trigger reintegration */
-                rc = cmobd_reintegrate(obd);
-                break;
-        default:
-                CERROR("unrecognized ioctl %#x\n", cmd);
-                rc = -EINVAL;
-                break;
-        }
-                
-        RETURN(rc);
-}
-
-static struct obd_ops cmobd_ops = {
-        o_owner:                THIS_MODULE,
-        o_attach:               cmobd_attach,
-        o_detach:               cmobd_detach,
-        o_setup:                cmobd_setup,
-        o_cleanup:              cmobd_cleanup,
-        o_iocontrol:            cmobd_iocontrol,
-};
-
-kmem_cache_t *cmobd_extent_slab;
-
-static int __init cmobd_init(void)
-{
-        struct lprocfs_static_vars lvars;
-        int rc;
-        ENTRY;
-
-        printk(KERN_INFO "Lustre: Cache Manager OBD driver; info@clusterfs.com\n");
-
-        lprocfs_init_vars(cmobd, &lvars);
-        rc = class_register_type(&cmobd_ops, NULL, lvars.module_vars,
-                                 LUSTRE_CMOBD_NAME);
-        if (rc)
-                RETURN(rc);
-        cmobd_extent_slab = kmem_cache_create("cmobd_extents",
-                                               sizeof(struct cmobd_extent_info), 0,
-                                               SLAB_HWCACHE_ALIGN, NULL, NULL);
-        if (cmobd_extent_slab == NULL) {
-                class_unregister_type(LUSTRE_CMOBD_NAME);
-                RETURN(-ENOMEM);
-        }
-        RETURN(0);
-}
-
-static void /*__exit*/ cmobd_exit(void)
-{
-        class_unregister_type(LUSTRE_CMOBD_NAME);
-        if (kmem_cache_destroy(cmobd_extent_slab) != 0)
-                CERROR("couldn't free cmobd extent slab\n");
-}
-
-MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
-MODULE_DESCRIPTION("Lustre Cache Manager OBD driver");
-MODULE_LICENSE("GPL");
-
-module_init(cmobd_init);
-module_exit(cmobd_exit);
diff --git a/lustre/cmobd/cmobd_internal.h b/lustre/cmobd/cmobd_internal.h
new file mode 100644 (file)
index 0000000..d245015
--- /dev/null
@@ -0,0 +1,28 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ * Copyright (C) 2003 Cluster File Systems, Inc.
+ *
+ * This code is issued under the GNU General Public License.
+ * See the file COPYING in this distribution
+ */
+
+#ifndef CMOBD_INTERNAL_H
+#define CMOBD_INTERNAL_H
+
+/* cmobd_reint.c */
+int cmobd_reintegrate(struct obd_device *);
+int cmobd_dummy_lsm(struct lov_stripe_md **, int, struct obdo*, __u32);
+void cmobd_free_lsm(struct lov_stripe_md **);
+
+/* cmobd_write.c */
+int cmobd_replay_write(struct obd_device *, struct obdo*, struct ldlm_extent *);
+int cmobd_init_write_srv(struct obd_device *);
+void cmobd_cleanup_write_srv(struct obd_device *);
+
+int cmobd_reint_mds(struct obd_device*, void *record);
+int cmobd_reint_setattr(struct obd_device *obd, void *rec);
+int cmobd_reint_create(struct obd_device *obd, void *rec);
+int cmobd_reint_write(struct obd_device *obd, void *rec);
+
+#endif /* CMOBD_INTERNAL_H */
diff --git a/lustre/cmobd/cmobd_mds_reint.c b/lustre/cmobd/cmobd_mds_reint.c
new file mode 100644 (file)
index 0000000..0fb8e07
--- /dev/null
@@ -0,0 +1,184 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ * Copyright (C) 2001-2003 Cluster File Systems, Inc.
+ *
+ *   This file is part of Lustre, http://www.sf.net/projects/lustre/
+ *
+ *   Lustre is free software; you can redistribute it and/or
+ *   modify it under the terms of version 2 of the GNU General Public
+ *   License as published by the Free Software Foundation.
+ *
+ *   Lustre 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 for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with Lustre; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#define DEBUG_SUBSYSTEM S_CMOBD
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/obd_class.h>
+#include <linux/lustre_net.h>
+#include <linux/lustre_mds.h>
+#include <linux/lustre_smfs.h>
+#include "cmobd_internal.h"
+
+/* If mdc_setattr is called with an 'iattr', then it is a normal RPC that
+ * should take the normal semaphore and go to the normal portal.
+ *
+ * If it is called with iattr->ia_valid & ATTR_FROM_OPEN, then it is a
+ * magic open-path setattr that should take the setattr semaphore and
+ * go to the setattr portal. */
+int cmobd_setattr_reint(struct obd_device *obd, struct ptlrpc_request *req)
+{
+        struct mds_rec_setattr *rec;
+        int    size[1], rc = 0; 
+        
+        ENTRY;
+
+        rec = (struct mds_rec_setattr *)lustre_msg_buf(req->rq_reqmsg, 0, 0);
+        if (!rec) 
+                RETURN (-EINVAL);
+        if (rec->sa_valid & ATTR_FROM_OPEN) 
+                req->rq_request_portal = MDS_SETATTR_PORTAL; //XXX FIXME bug 249
+
+        if (rec->sa_valid & (ATTR_MTIME | ATTR_CTIME)) 
+                CDEBUG(D_INODE, "setting mtime %lu, ctime %lu\n",
+                       ((time_t)rec->sa_mtime), 
+                       ((time_t)rec->sa_ctime));
+        size[0] = sizeof(struct mds_body);
+        req->rq_replen = lustre_msg_size(1, size);
+
+        rc = mdc_reint(req, NULL, LUSTRE_IMP_FULL);
+        
+        if (rc == -ERESTARTSYS)
+                rc = 0;
+
+        RETURN(rc);
+}
+
+int cmobd_create_reint(struct obd_device *obd, struct ptlrpc_request *req)
+{
+        int rc = 0, level, size[1];
+        ENTRY;
+
+        size[0] = sizeof(struct mds_body);
+        req->rq_replen = lustre_msg_size(1, size);
+
+        level = LUSTRE_IMP_FULL;
+ resend:
+        rc = mdc_reint(req, NULL, level);
+        /* Resend if we were told to. */
+        if (rc == -ERESTARTSYS) {
+                level = LUSTRE_IMP_RECOVER;
+                goto resend;
+        }
+
+        if (!rc)
+                mdc_store_inode_generation(NULL, req, 0, 0);
+
+        RETURN(rc);
+}
+
+int cmobd_unlink_reint(struct obd_device *obd, struct ptlrpc_request *req)
+{
+        int rc = 0, size[3];
+        ENTRY;
+        
+        size[0] = sizeof(struct mds_body);
+        size[1] = obd->u.cli.cl_max_mds_easize;
+        size[2] = obd->u.cli.cl_max_mds_cookiesize;
+        req->rq_replen = lustre_msg_size(3, size);
+
+        rc = mdc_reint(req,  NULL, LUSTRE_IMP_FULL);
+        if (rc == -ERESTARTSYS)
+                rc = 0;
+        RETURN(rc);
+}
+
+int cmobd_link_reint(struct obd_device *obd, struct ptlrpc_request *req)
+{
+        int rc = 0, size[1];
+        ENTRY;
+
+        size[0] = sizeof(struct mds_body);
+        req->rq_replen = lustre_msg_size(1, size);
+
+        rc = mdc_reint(req, NULL, LUSTRE_IMP_FULL);
+        if (rc == -ERESTARTSYS)
+                rc = 0;
+
+        RETURN(rc);
+}
+
+int cmobd_rename_reint(struct obd_device *obd, struct ptlrpc_request *req)
+{
+        int rc = 0, size[2];
+        ENTRY;
+
+        size[0] = sizeof(struct mds_body);
+        size[1] = obd->u.cli.cl_max_mds_easize;
+        req->rq_replen = lustre_msg_size(2, size);
+
+        rc = mdc_reint(req,  NULL, LUSTRE_IMP_FULL);
+        if (rc == -ERESTARTSYS)
+                rc = 0;
+
+        RETURN(rc);
+}
+
+typedef int (*cmobd_reint_mds_rec)(struct obd_device*,
+                                   struct ptlrpc_request *req);
+
+static cmobd_reint_mds_rec cmobd_mds_reint[REINT_MAX + 1] = {
+        [REINT_SETATTR] cmobd_setattr_reint,
+        [REINT_CREATE] cmobd_create_reint,
+        [REINT_LINK] cmobd_link_reint,
+        [REINT_UNLINK] cmobd_unlink_reint,
+        [REINT_RENAME] cmobd_rename_reint,
+};
+
+int cmobd_reint_mds(struct obd_device *obd, void* record)
+{
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+        struct ptlrpc_request *req; 
+        struct lustre_msg *msg; 
+        struct mds_kml_pack_info *mkpi;
+        __u32  opcode; 
+        int    rc = 0;
+        mkpi = (struct mds_kml_pack_info *)record; 
+       
+        req = ptlrpc_prep_req(class_exp2cliimp(cmobd->cm_master_exp), 
+                              LUSTRE_MDS_VERSION, MDS_REINT,
+                              mkpi->mpi_bufcount, mkpi->mpi_size, NULL);
+        if (req == NULL)
+                RETURN(-ENOMEM);
+        record += sizeof(*mkpi);
+        msg = (struct lustre_msg *)record;
+        opcode = (__u32)*(int*)lustre_msg_buf(msg, 0, 0); 
+        if (opcode > REINT_MAX || opcode <= 0) {
+                CERROR("Unrecorgnized reint opcode %u in cmobd mds reint\n",
+                        opcode);
+                GOTO(out, rc=-EINVAL);
+        }
+        
+        memcpy(req->rq_reqmsg, record, mkpi->mpi_total_size);
+        /*flags and opc will be rewrite, so reset here 
+         *FIXME maybe should set some flags in reint process*/  
+
+        req->rq_reqmsg->opc = MDS_REINT;
+        req->rq_reqmsg->flags = 0;
+
+        rc = cmobd_mds_reint[opcode](cmobd->cm_master_obd, req);
+out:
+        ptlrpc_req_finished(req);
+        return rc;
+} 
+
similarity index 82%
rename from lustre/cmobd/cm_oss_reint.c
rename to lustre/cmobd/cmobd_oss_reint.c
index aec0557..41d5369 100644 (file)
 #include <linux/lustre_fsfilt.h>
 #include <linux/lustre_smfs.h>
 
-#include "cm_internal.h"
+#include "cmobd_internal.h"
 
+int lov_alloc_memmd(struct lov_stripe_md **lsmp, int stripe_count, int pattern);
 void lov_free_memmd(struct lov_stripe_md **lsmp);
-
-int lov_alloc_memmd(struct lov_stripe_md **lsmp, int stripe_count, 
-                    int pattern);
-
-int smfs_rec_unpack(struct smfs_proc_args *args, char *record, 
-                    char **pbuf, int *opcode);
+int smfs_rec_unpack(struct smfs_proc_args *args, char *record, char **pbuf, 
+                    int *opcode);
 
 /* helper functions for cmobd to construct pseudo lsm */
 int cmobd_dummy_lsm(struct lov_stripe_md **lsmp, int stripe_cnt, 
@@ -75,11 +72,11 @@ void cmobd_free_lsm(struct lov_stripe_md **lsmp)
 }
 
 /* reintegration functions */
-static int cmobd_setattr_reint(struct obd_device *obd, void *rec)
+int cmobd_reint_setattr(struct obd_device *obd, void *rec)
 {
-        struct cm_obd *cmobd = &obd->u.cm;
-        struct lov_obd *lov = &cmobd->master_obd->u.lov;
-        struct obd_export *exp = cmobd->master_exp;
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+        struct lov_obd *lov = &cmobd->cm_master_obd->u.lov;
+        struct obd_export *exp = cmobd->cm_master_exp;
         struct lov_stripe_md *lsm;
         struct obdo *oa = (struct obdo*)rec;
         int rc;
@@ -97,11 +94,11 @@ out:
         RETURN(rc);
 }
 
-static int cmobd_create_reint(struct obd_device *obd, void *rec)
+int cmobd_reint_create(struct obd_device *obd, void *rec)
 {
-        struct cm_obd *cmobd = &obd->u.cm;
-        struct lov_obd *lov = &cmobd->master_obd->u.lov;
-        struct obd_export *exp = cmobd->master_exp;
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+        struct lov_obd *lov = &cmobd->cm_master_obd->u.lov;
+        struct obd_export *exp = cmobd->cm_master_exp;
         struct lov_stripe_md *lsm;
         struct obd_trans_info oti = { 0 };
         struct obdo *oa=(struct obdo*)rec;
@@ -112,14 +109,14 @@ static int cmobd_create_reint(struct obd_device *obd, void *rec)
                              (__u32)lov->desc.ld_default_stripe_size);
         if (rc)
                 GOTO(out, rc);
-        if (cmobd->master_group != oa->o_gr) {
+        if (cmobd->cm_master_group != oa->o_gr) {
                 int group = oa->o_gr;
                 int valsize = sizeof(group);
                 rc = obd_set_info(exp, strlen("mds_conn"), "mds_conn",
                                   valsize, &group);
                 if (rc)
                         GOTO(out, rc = -EINVAL);
-                cmobd->master_group = oa->o_gr;
+                cmobd->cm_master_group = oa->o_gr;
         }
         rc = obd_create(exp, oa, &lsm, &oti);
 
@@ -202,9 +199,9 @@ static int master_blocking_ast(struct ldlm_lock *lock,
 static int cmobd_write_extents(struct obd_device *obd, struct obdo *oa, 
                                struct ldlm_extent *extent)
 {
-        struct cm_obd *cmobd = &obd->u.cm;
-        struct obd_device *cache = cmobd->cache_obd;
-        struct lov_obd *lov = &cmobd->master_obd->u.lov;
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+        struct obd_device *cache = cmobd->cm_cache_obd;
+        struct lov_obd *lov = &cmobd->cm_master_obd->u.lov;
         struct ldlm_res_id res_id;
         ldlm_policy_data_t policy;
         struct lustre_handle lockh_src = { 0 };
@@ -233,7 +230,7 @@ static int cmobd_write_extents(struct obd_device *obd, struct obdo *oa,
         if (rc)
                 GOTO(out_lock, rc);
         
-        rc = obd_enqueue(cmobd->master_exp, lsm, LDLM_EXTENT, &policy, 
+        rc = obd_enqueue(cmobd->cm_master_exp, lsm, LDLM_EXTENT, &policy, 
                          LCK_PW, &flags, master_blocking_ast, 
                          ldlm_completion_ast, NULL,
                          NULL, 0, NULL, &lockh_dst);
@@ -242,12 +239,12 @@ static int cmobd_write_extents(struct obd_device *obd, struct obdo *oa,
 
         err = cmobd_replay_write(obd, oa, &policy.l_extent);
         
-        rc = obd_cancel(cmobd->master_exp, lsm, LCK_PW, &lockh_dst);
+        rc = obd_cancel(cmobd->cm_master_exp, lsm, LCK_PW, &lockh_dst);
         if (rc)
                 GOTO(out_lsm, rc);
         /* XXX in fact, I just want to cancel the only lockh_dst 
          *     instantly. */
-        rc = obd_cancel_unused(cmobd->master_exp, lsm, 0, NULL);
+        rc = obd_cancel_unused(cmobd->cm_master_exp, lsm, 0, NULL);
         if (err)
                 rc = err;
 out_lsm:
@@ -256,11 +253,10 @@ out_lock:
         ldlm_lock_decref(&lockh_src, LCK_PR);
         RETURN(rc);
 }
-
-static int cmobd_write_reint(struct obd_device *obd, void *rec)
+int cmobd_reint_write(struct obd_device *obd, void *rec)
 {
-        struct cm_obd *cmobd = &obd->u.cm;
-        struct obd_device *cache = cmobd->cache_obd;
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+        struct obd_device *cache = cmobd->cm_cache_obd;
         struct obdo *oa = (struct obdo *)rec;
         struct ldlm_extent *extent = NULL; 
         unsigned long csb, ino;
@@ -270,7 +266,7 @@ static int cmobd_write_reint(struct obd_device *obd, void *rec)
 
         size = sizeof(csb);
 
-        obd_get_info(cmobd->cache_exp, strlen("cache_sb") + 1,
+        obd_get_info(cmobd->cm_cache_exp, strlen("cache_sb") + 1,
                      "cache_sb", &size, &csb); 
  
         ino = *(int*)(&oa->o_inline[0]);
@@ -288,23 +284,8 @@ static int cmobd_write_reint(struct obd_device *obd, void *rec)
         }
 out:
         if (extents_buf)
-                fsfilt_free_write_extents(cache, (struct super_block *)csb, 
-                                          ino, extents_buf, ext_num); 
+                fsfilt_free_write_extents(cache, (struct super_block *)csb, ino, 
+                                          extents_buf, ext_num); 
         RETURN(rc);
 }
 
-int cmobd_reint_oss(struct obd_device *obd, void *record, int opcode)
-{
-        switch (opcode) {
-        case OST_CREATE:
-                return cmobd_create_reint(obd, record);
-        case OST_SETATTR:
-                return cmobd_setattr_reint(obd, record);
-        case OST_WRITE:
-                return cmobd_write_reint(obd, record);
-        default:
-                CERROR("unrecognized oss reint opcode %d\n", 
-                       opcode);
-                return -EINVAL;
-        }
-}
similarity index 70%
rename from lustre/cmobd/cm_reint.c
rename to lustre/cmobd/cmobd_reint.c
index 230f6f1..f68132f 100644 (file)
 #include <linux/lustre_fsfilt.h>
 #include <linux/lustre_smfs.h>
 
-#include "cm_internal.h"
+#include "cmobd_internal.h"
 
-#define OSS_REINT(opcode)      \
-({                             \
-    int _opcode = (opcode);    \
-                               \
-    (_opcode == OST_CREATE  || \
-     _opcode == OST_SETATTR || \
-     _opcode == OST_WRITE);    \
-})
-
-#define MDS_REINT(opcode)      \
-    ((opcode) == MDS_REINT)
-
-static int cmobd_reint_record(struct obd_device *obd, 
-                              void *record, int opcode)
+static int cmobd_reint_record(int opcode, struct obd_device *obd, char *record)
 {
-        if (OSS_REINT(opcode))
-                return cmobd_reint_oss(obd, record, opcode);
+        int rc = 0;
         
-        if (MDS_REINT(opcode))
-                return cmobd_reint_mds(obd, record, opcode);
-
-        CERROR("unrecognized reint opcode %d\n", opcode);
-        return -EINVAL;
-}
-
-static int cmobd_reint_cb(struct llog_handle *llh, 
-                          struct llog_rec_hdr *rec,
+        switch (opcode) {
+        case OST_CREATE:
+                rc = cmobd_reint_create(obd, record);
+                break;                       
+        case OST_SETATTR:
+                rc = cmobd_reint_setattr(obd, record);
+                break;                       
+        case OST_WRITE:
+                rc = cmobd_reint_write(obd, record);
+                break;                       
+        case MDS_REINT:
+                rc = cmobd_reint_mds(obd, record);
+                break;                       
+        default:
+                CERROR("unrecognized format %d\n", opcode);
+                rc = -EINVAL;
+                break; 
+        }
+        return rc;
+}  
+static int cmobd_reint_cb(struct llog_handle *llh, struct llog_rec_hdr *rec,
                           void *data)
 {
         struct obd_device *obd = (struct obd_device*)data;
@@ -74,7 +72,6 @@ static int cmobd_reint_cb(struct llog_handle *llh,
                 CERROR("log is not plain log\n");
                 RETURN(-EINVAL);
         }
-        
         if (rec->lrh_type != SMFS_UPDATE_REC)
                RETURN(-EINVAL);
 
@@ -82,12 +79,10 @@ static int cmobd_reint_cb(struct llog_handle *llh,
         rc = smfs_rec_unpack(NULL, buf, &pbuf, &opcode);
         if (rc)
                 GOTO(out, rc);
-
-        rc = cmobd_reint_record(obd, pbuf, opcode); 
+        rc = cmobd_reint_record(opcode, obd, pbuf); 
         if (rc)
                 GOTO(out, rc);
-
-        /* delete this record. */
+        /*delete this record*/
         rc = LLOG_DEL_RECORD; 
 out:
         RETURN(rc);
@@ -95,7 +90,7 @@ out:
 
 int cmobd_reintegrate(struct obd_device *obd)
 {
-        struct cm_obd *cmobd = &obd->u.cm;
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
         struct llog_ctxt *ctxt = NULL;
         struct llog_handle *llh;
         int val_size, rc = 0;
@@ -104,7 +99,7 @@ int cmobd_reintegrate(struct obd_device *obd)
         /* XXX just fetch the reintegration log context from
          * cache ost directly, use logid later ?? */
         val_size = sizeof(ctxt);
-        rc = obd_get_info(cmobd->cache_exp, strlen("reint_log") + 1,
+        rc = obd_get_info(cmobd->cm_cache_exp, strlen("reint_log") + 1,
                           "reint_log", &val_size, &ctxt);
         if (rc)
                 RETURN(rc);
@@ -120,3 +115,5 @@ int cmobd_reintegrate(struct obd_device *obd)
 
         RETURN(rc);
 }
+
+
similarity index 91%
rename from lustre/cmobd/cm_write.c
rename to lustre/cmobd/cmobd_write.c
index 833cc8c..815efc6 100644 (file)
@@ -34,7 +34,7 @@
 #include <asm/div64.h>
 #include <linux/pagemap.h>
 
-#include "cm_internal.h"
+#include "cmobd_internal.h"
 
 extern kmem_cache_t *cmobd_extent_slab;
 
@@ -108,10 +108,8 @@ static void cmobd_ap_fill_obdo(void *data, int cmd, struct obdo *oa)
         valid_flags = OBD_MD_FLTYPE | OBD_MD_FLATIME;
         if (cmd == OBD_BRW_WRITE) {
                 oa->o_valid |= OBD_MD_FLIFID;
-                
-                /* FIXME-UMKA: should be here some mds num and mds id? */
-                mdc_pack_id(obdo_id(oa), inode->i_ino, 0, 
-                            inode->i_mode, 0, 0);
+                mdc_pack_fid(obdo_fid(oa), inode->i_ino, 0, inode->i_mode);
+
                 valid_flags |= OBD_MD_FLMTIME | OBD_MD_FLCTIME;
         }
 
@@ -171,8 +169,8 @@ static int cmobd_send_pages(struct obd_device *obd,
                             obd_count oa_bufs,
                             struct cmobd_extent_set *set)
 {
-        struct cm_obd *cmobd = &obd->u.cm;
-        struct obd_export *exp = cmobd->master_exp;
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+        struct obd_export *exp = cmobd->cm_master_exp;
         struct cmobd_async_page *cmap = NULL;
         obd_count i;
         int rc = 0;
@@ -261,7 +259,7 @@ static int cmobd_write_extent(struct obd_device *obd,
                               struct cmobd_extent_info *ei)
 {
         struct cmobd_extent_set *set = ei->ei_set;
-        struct cm_obd *cmobd = &obd->u.cm;
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
         unsigned long flags;
         struct obd_ioobj ioo;
         struct niobuf_local *lnb;
@@ -295,7 +293,7 @@ static int cmobd_write_extent(struct obd_device *obd,
         obdo_to_ioobj(oa, &ioo);
         ioo.ioo_bufcnt = oa_bufs;
 
-        ret = obd_preprw(OBD_BRW_READ, cmobd->cache_exp, oa, 1, &ioo, 
+        ret = obd_preprw(OBD_BRW_READ, cmobd->cm_cache_exp, oa, 1, &ioo, 
                          oa_bufs, rnb, lnb, NULL);
         if (ret)
                 GOTO(out, rc = ret);
@@ -304,7 +302,7 @@ static int cmobd_write_extent(struct obd_device *obd,
         if (rc)
                 CERROR("cmobd_send_pages failed %d\n", rc);
 
-        rc = obd_commitrw(OBD_BRW_READ, cmobd->cache_exp, oa, 1, &ioo,
+        rc = obd_commitrw(OBD_BRW_READ, cmobd->cm_cache_exp, oa, 1, &ioo,
                           oa_bufs, lnb, NULL, ret);
 
         /* countdown and wake up */
@@ -357,24 +355,16 @@ static int cmobd_write_main(void *arg)
         struct ptlrpc_svc_data *data = (struct ptlrpc_svc_data *)arg;
         struct ptlrpc_thread   *thread = data->thread;
         struct obd_device *obd = data->dev;
-        struct cm_obd *cmobd = &obd->u.cm;
-        struct cmobd_write_service *ws = cmobd->write_srv;
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+        struct cmobd_write_service *ws = cmobd->cm_write_srv;
         struct cmobd_extent_info *extent = NULL;
         unsigned long flags;
         int rc;
         ENTRY;
 
         lock_kernel();
-        /* vv ptlrpc_daemonize(); vv */
-        exit_mm(current);
-
-        current->session = 1;
-        current->pgrp = 1;
-        current->tty = NULL;
-
-        exit_files(current);
-        reparent_to_init();
-        /* ^^ ptlrpc_daemonize(); ^^ */
+        
+        ptlrpc_daemonize();
 
         SIGNAL_MASK_LOCK(current, flags);
         sigfillset(&current->blocked);
@@ -426,8 +416,8 @@ static int cmobd_write_main(void *arg)
  * ptlrpc threads functions */
 static int cmobd_start_thread(struct obd_device *obd, char *name)
 {
-        struct cm_obd *cmobd = &obd->u.cm;
-        struct cmobd_write_service *ws = cmobd->write_srv;
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+        struct cmobd_write_service *ws = cmobd->cm_write_srv;
         struct l_wait_info lwi = { 0 };
         struct ptlrpc_svc_data d;
         struct ptlrpc_thread *thread;
@@ -470,8 +460,8 @@ static int cmobd_start_thread(struct obd_device *obd, char *name)
 static void cmobd_stop_thread(struct obd_device *obd, 
                               struct ptlrpc_thread *thread)
 {
-        struct cm_obd *cmobd = &obd->u.cm;
-        struct cmobd_write_service *ws = cmobd->write_srv;
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+        struct cmobd_write_service *ws = cmobd->cm_write_srv;
         struct l_wait_info lwi = { 0 };
         unsigned long flags;
         ENTRY;
@@ -492,8 +482,8 @@ static void cmobd_stop_thread(struct obd_device *obd,
 
 static void cmobd_stop_all_threads(struct obd_device *obd)
 {
-        struct cm_obd *cmobd = &obd->u.cm;
-        struct cmobd_write_service *ws = cmobd->write_srv;
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+        struct cmobd_write_service *ws = cmobd->cm_write_srv;
         unsigned long flags;
         struct ptlrpc_thread *thread;
         ENTRY;
@@ -533,33 +523,33 @@ static int cmobd_start_n_threads(struct obd_device *obd, int num_threads,
 
 void cmobd_cleanup_write_srv(struct obd_device *obd)
 {
-        struct cm_obd *cmobd = &obd->u.cm;
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
         struct list_head *pos, *n;
         struct cmobd_extent_info *ei;
         ENTRY;
         
         cmobd_stop_all_threads(obd);
         
-        list_for_each_safe(pos, n, &cmobd->write_srv->ws_extents) {
+        list_for_each_safe(pos, n, &cmobd->cm_write_srv->ws_extents) {
                 ei = list_entry(pos, struct cmobd_extent_info, ei_link);
                 list_del_init(&ei->ei_link);
                 OBD_FREE(ei, sizeof(*ei));
         }
-        OBD_FREE(cmobd->write_srv, sizeof(*cmobd->write_srv));
+        OBD_FREE(cmobd->cm_write_srv, sizeof(*cmobd->cm_write_srv));
         EXIT;
 }
 
 int cmobd_init_write_srv(struct obd_device *obd)
 {
-        struct cm_obd *cmobd = &obd->u.cm;
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
         struct cmobd_write_service *ws;
         int rc;
         ENTRY;
 
-        OBD_ALLOC(cmobd->write_srv, sizeof(*cmobd->write_srv));
-        if (cmobd->write_srv == NULL)
+        OBD_ALLOC(cmobd->cm_write_srv, sizeof(*cmobd->cm_write_srv));
+        if (cmobd->cm_write_srv == NULL)
                 RETURN(-ENOMEM);
-        ws = cmobd->write_srv;
+        ws = cmobd->cm_write_srv;
         
         INIT_LIST_HEAD(&ws->ws_threads);
         spin_lock_init(&ws->ws_thread_lock);
@@ -593,8 +583,8 @@ static int extent_queue_full(struct cmobd_write_service *ws)
 static void cmobd_queue_extent(struct obd_device *obd, 
                                struct cmobd_extent_info *ex)
 {
-        struct cm_obd *cmobd = &obd->u.cm;
-        struct cmobd_write_service *ws = cmobd->write_srv;
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+        struct cmobd_write_service *ws = cmobd->cm_write_srv;
         struct cmobd_extent_set *set = ex->ei_set;
         unsigned long flags;
         struct l_wait_info lwi = { 0 };
@@ -621,7 +611,7 @@ wait:
         EXIT;
 } 
 
-static obd_size cmobd_id2size(struct obd_export *exp, obd_id id, obd_gr grp)
+static obd_size cmobd_fid2size(struct obd_export *exp, obd_id id, obd_gr grp)
 {
         struct lvfs_run_ctxt saved;
         struct dentry *de = NULL;
@@ -630,7 +620,7 @@ static obd_size cmobd_id2size(struct obd_export *exp, obd_id id, obd_gr grp)
         
         push_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL);
         
-        de = obd_lvfs_id2dentry(exp, id, 0, grp);
+        de = obd_lvfs_fid2dentry(exp, id, 0, grp);
         LASSERT(de);
 
         size = de->d_inode->i_size;
@@ -659,8 +649,8 @@ static int extent_set_done(struct cmobd_extent_set *set, int phase)
 int cmobd_replay_write(struct obd_device *obd, struct obdo *oa, 
                        struct ldlm_extent *ext)
 {
-        struct cm_obd *cmobd = &obd->u.cm;
-        struct lov_obd *lov = &cmobd->master_obd->u.lov;
+        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+        struct lov_obd *lov = &cmobd->cm_master_obd->u.lov;
         struct lov_stripe_md *lsm = NULL;
         struct cmobd_extent_set set;
         struct cmobd_extent_info *ex;
@@ -681,7 +671,7 @@ int cmobd_replay_write(struct obd_device *obd, struct obdo *oa,
         set.es_extent.start = ext->start;
         set.es_extent.end = ext->end;
         set.es_lsm = lsm;
-        set.es_exp = cmobd->master_exp;
+        set.es_exp = cmobd->cm_master_exp;
         set.es_ext_sz = CMOBD_MAX_EXTENT_SZ;
         set.es_count = 0;
         memcpy(&set.es_oa, oa, sizeof(*oa));
@@ -698,8 +688,8 @@ int cmobd_replay_write(struct obd_device *obd, struct obdo *oa,
         set.es_extent.start -= set.es_extent.start & ~PAGE_MASK;
         /* if the end of extent is EOF, set it as file size */
         if (set.es_extent.end == OBD_OBJECT_EOF) {
-                set.es_extent.end = cmobd_id2size(cmobd->cache_exp, 
-                                                  oa->o_id, oa->o_gr) - 1;
+                set.es_extent.end = cmobd_fid2size(cmobd->cm_cache_exp, 
+                                                   oa->o_id, oa->o_gr) - 1;
                 if (set.es_extent.end <= 0)
                         GOTO(out, rc = 0);
         }
index a081fc1..f4072eb 100644 (file)
@@ -66,24 +66,22 @@ static int cobd_setup(struct obd_device *obd, obd_count len, void *buf)
 {
         struct lustre_cfg *lcfg = (struct lustre_cfg *)buf;
         struct cache_obd  *cobd = &obd->u.cobd;
-#if 0
-        struct lustre_handle master_conn = {0,};
-#endif
-        struct lustre_handle cache_conn = {0,};
-        struct obd_device *master;
+//        struct lustre_handle real_conn = {0,}, cache_conn = {0,};
+        struct lustre_handle  cache_conn = {0,};
+        struct obd_device *real;
         struct obd_device *cache;
         int rc;
         ENTRY;
 
         if (lcfg->lcfg_inllen1 == 0 || lcfg->lcfg_inlbuf1 == NULL) {
-                CERROR("%s: setup requires master device name\n", 
+                CERROR("%s: setup requires real device name\n", 
                        obd->obd_name);
                 RETURN(-EINVAL);
         }
 
-        master = class_name2obd(lcfg->lcfg_inlbuf1);
-        if (master == NULL) {
-                CERROR("%s: unable to find a client for master: %s\n",
+        real = class_name2obd(lcfg->lcfg_inlbuf1);
+        if (real == NULL) {
+                CERROR("%s: unable to find a client for real: %s\n",
                        obd->obd_name, lcfg->lcfg_inlbuf1);
                 RETURN(-EINVAL);
         }
@@ -93,60 +91,60 @@ static int cobd_setup(struct obd_device *obd, obd_count len, void *buf)
                 RETURN(-EINVAL);
         }
 
-        cache = class_name2obd(lcfg->lcfg_inlbuf2);
+        cache  = class_name2obd(lcfg->lcfg_inlbuf2);
         if (cache == NULL) {
                 CERROR("%s: unable to find a client for cache: %s\n",
                        obd->obd_name, lcfg->lcfg_inlbuf2);
                 RETURN(-EINVAL);
         }
 
-        OBD_ALLOC(cobd->master_name, strlen(lcfg->lcfg_inlbuf1) + 1);
-        if (!cobd->master_name) 
+        OBD_ALLOC(cobd->cobd_real_name, strlen(lcfg->lcfg_inlbuf1) + 1);
+        if (!cobd->cobd_real_name) 
                 GOTO(exit, rc = -ENOMEM);
-        memcpy(cobd->master_name, lcfg->lcfg_inlbuf1, 
+        memcpy(cobd->cobd_real_name, lcfg->lcfg_inlbuf1, 
                strlen(lcfg->lcfg_inlbuf1));
         
-        OBD_ALLOC(cobd->cache_name, strlen(lcfg->lcfg_inlbuf2) + 1);
-        if (!cobd->cache_name) 
+        OBD_ALLOC(cobd->cobd_cache_name, strlen(lcfg->lcfg_inlbuf2) + 1);
+        if (!cobd->cobd_cache_name) 
                 GOTO(exit, rc = -ENOMEM);
-        memcpy(cobd->cache_name, lcfg->lcfg_inlbuf2, 
+        memcpy(cobd->cobd_cache_name, lcfg->lcfg_inlbuf2, 
                strlen(lcfg->lcfg_inlbuf2));
 
 #if 0        
-        /* don't bother checking attached/setup; obd_connect() should, and it
-         * can change underneath us */
-        rc = connect_to_obd(cobd->master_name, &master_conn);
+        /* don't bother checking attached/setup;
+         * obd_connect() should, and it can change underneath us */
+        rc = connect_to_obd(cobd->cobd_real_name, &real_conn);
         if (rc != 0)
                 GOTO(exit, rc);
-        cobd->master_exp = class_conn2export(&master_conn);
+        cobd->cobd_real_exp = class_conn2export(&real_conn);
 #endif        
-        rc = connect_to_obd(cobd->cache_name, &cache_conn);
+        rc = connect_to_obd(cobd->cobd_cache_name, &cache_conn);
         if (rc != 0) {
-                obd_disconnect(cobd->cache_exp, 0);
+                obd_disconnect(cobd->cobd_cache_exp, 0);
                 GOTO(exit, rc);
         }
-        cobd->cache_exp = class_conn2export(&cache_conn);
+        cobd->cobd_cache_exp = class_conn2export(&cache_conn);
+        
         cobd->cache_on = 1;
-
-        if (!strcmp(master->obd_type->typ_name, LUSTRE_MDC_NAME)) {
-                int mds_type;
-                
-                mds_type = MDS_MASTER_OBD;
-                obd_set_info(cobd->master_exp, strlen("mds_type"),
-                             "mds_type", sizeof(mds_type), &mds_type);
-                
-                mds_type = MDS_CACHE_OBD;
-                obd_set_info(cobd->cache_exp, strlen("mds_type"),
-                             "mds_type", sizeof(mds_type), &mds_type);
+        if (!strcmp(real->obd_type->typ_name, LUSTRE_MDC_NAME)) {
+                /* set mds_num for lustre */
+                int mds_num;
+                mds_num = REAL_MDS_NUMBER;
+                obd_set_info(cobd->cobd_real_exp, strlen("mds_num"),
+                             "mds_num", sizeof(mds_num), &mds_num);
+                mds_num = CACHE_MDS_NUMBER;
+                obd_set_info(cobd->cobd_cache_exp, strlen("mds_num"),
+                             "mds_num", sizeof(mds_num), &mds_num);
         }
+        /*default write to real obd*/
 exit:
         if (rc) {
-                if (cobd->cache_name)
-                        OBD_FREE(cobd->cache_name, 
-                                 strlen(cobd->cache_name) + 1);
-                if (cobd->master_name)
-                        OBD_FREE(cobd->master_name, 
-                                 strlen(cobd->master_name) + 1);
+                if (cobd->cobd_cache_name)
+                        OBD_FREE(cobd->cobd_cache_name, 
+                                 strlen(cobd->cobd_cache_name) + 1);
+                if (cobd->cobd_real_name)
+                        OBD_FREE(cobd->cobd_real_name, 
+                                 strlen(cobd->cobd_real_name) + 1);
         }
         RETURN(rc);
 }
@@ -159,20 +157,20 @@ static int cobd_cleanup(struct obd_device *obd, int flags)
         if (!list_empty(&obd->obd_exports))
                 return (-EBUSY);
         
-        if (cobd->cache_name)
-                OBD_FREE(cobd->cache_name, 
-                         strlen(cobd->cache_name) + 1);
-        if (cobd->master_name)
-                OBD_FREE(cobd->master_name, 
-                         strlen(cobd->master_name) + 1);
+        if (cobd->cobd_cache_name)
+                OBD_FREE(cobd->cobd_cache_name, 
+                         strlen(cobd->cobd_cache_name) + 1);
+        if (cobd->cobd_real_name)
+                OBD_FREE(cobd->cobd_real_name, 
+                         strlen(cobd->cobd_real_name) + 1);
         if (cobd->cache_on) { 
-                rc = obd_disconnect(cobd->cache_exp, flags);
+                rc = obd_disconnect(cobd->cobd_cache_exp, flags);
                 if (rc != 0)
                         CERROR("error %d disconnecting cache\n", rc);
         }
-        rc = obd_disconnect(cobd->master_exp, flags);
+        rc = obd_disconnect(cobd->cobd_real_exp, flags);
         if (rc != 0)
-                CERROR("error %d disconnecting master\n", rc);
+                CERROR("error %d disconnecting real\n", rc);
         
         return (rc);
 }
@@ -182,21 +180,25 @@ struct obd_export *cobd_get_exp(struct obd_device *obd)
         struct cache_obd  *cobd = &obd->u.cobd;
         
         if (cobd->cache_on)  
-                return cobd->cache_exp;
+                return cobd->cobd_cache_exp;
         else
-                return cobd->master_exp;
+                return cobd->cobd_real_exp;
 }
 
 static int
 cobd_connect(struct lustre_handle *conn, struct obd_device *obd,
              struct obd_uuid *cluuid, unsigned long connect_flags)
 {
-        return class_connect(conn, obd, cluuid);
+        int rc;
+        rc = class_connect(conn, obd, cluuid);
+        return rc; 
 }
 
 static int cobd_disconnect(struct obd_export *exp, int flags)
 {
-        return class_disconnect(exp, 0);
+        int rc;
+        rc = class_disconnect(exp, 0);
+        return rc; 
 }
 
 static int cobd_get_info(struct obd_export *exp, obd_count keylen,
@@ -204,15 +206,14 @@ static int cobd_get_info(struct obd_export *exp, obd_count keylen,
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
-        
         if (obd == NULL) {
                 CERROR("invalid client cookie "LPX64"\n", 
                        exp->exp_handle.h_cookie);
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-
         /* intercept cache utilisation info? */
+
         return obd_get_info(cobd_exp, keylen, key, vallen, val);
 }
 
@@ -228,8 +229,8 @@ static int cobd_set_info(struct obd_export *exp, obd_count keylen,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        
         /* intercept cache utilisation info? */
+
         return obd_set_info(cobd_exp, keylen, key, vallen, val);
 }
 
@@ -310,7 +311,7 @@ static int cobd_destroy(struct obd_export *exp, struct obdo *obdo,
 
 static int cobd_precleanup(struct obd_device *obd, int flags)
 {
-        /* FIXME-WANGDI: do we need some cleanup here? */
+        /*FIXME Do we need some cleanup here?*/
         return 0;
 }
 
@@ -330,8 +331,8 @@ static int cobd_getattr(struct obd_export *exp, struct obdo *oa,
 }
 
 static int cobd_getattr_async(struct obd_export *exp,
-                              struct obdo *obdo, struct lov_stripe_md *ea,
-                              struct ptlrpc_request_set *set)
+                             struct obdo *obdo, struct lov_stripe_md *ea,
+                             struct ptlrpc_request_set *set)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
@@ -361,8 +362,7 @@ static int cobd_setattr(struct obd_export *exp, struct obdo *obdo,
         return obd_setattr(cobd_exp, obdo, ea, oti);
 }
 
-static int cobd_md_getstatus(struct obd_export *exp,
-                             struct lustre_id *rootid)
+static int cobd_md_getstatus(struct obd_export *exp, struct ll_fid *rootfid)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
@@ -373,7 +373,7 @@ static int cobd_md_getstatus(struct obd_export *exp,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_getstatus(cobd_exp, rootid);
+        return md_getstatus(cobd_exp, rootfid);
 }
 
 static int cobd_brw(int cmd, struct obd_export *exp, struct obdo *oa,
@@ -675,7 +675,8 @@ static int cobd_commitrw(int cmd, struct obd_export *exp, struct obdo *oa,
 
 static int cobd_flush(struct obd_device *obd)
 {
-        /* flush the filesystem from the cache to the real device. */
+       /*FLUSH the filesystem from the cache 
+        *to the real device */
         return 0; 
 }
 
@@ -684,7 +685,7 @@ static int cobd_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct cache_obd  *cobd = &obd->u.cobd;
-        struct obd_device *master_dev = NULL;
+        struct obd_device *real_dev = NULL;
         struct obd_export *cobd_exp;
         int rc = 0;
  
@@ -693,39 +694,39 @@ static int cobd_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                 if (!cobd->cache_on) {
                         struct lustre_handle cache_conn = {0,};
                         
-                        rc = obd_disconnect(cobd->master_exp, 0);
+                        rc = obd_disconnect(cobd->cobd_real_exp, 0);
                         if (rc != 0)
-                                CERROR("error %d disconnecting master\n", rc);
-                        rc = connect_to_obd(cobd->cache_name, &cache_conn);
+                                CERROR("error %d disconnecting real\n", rc);
+                        rc = connect_to_obd(cobd->cobd_cache_name, &cache_conn);
                         if (rc != 0)
                                 RETURN(rc); 
-                        cobd->cache_exp = class_conn2export(&cache_conn);
+                        cobd->cobd_cache_exp = class_conn2export(&cache_conn);
                         
                         cobd->cache_on = 1;
                 }
                 break;
         case OBD_IOC_COBD_COFF: 
                 if (cobd->cache_on) {
-                        struct lustre_handle master_conn = {0,};
+                        struct lustre_handle real_conn = {0,};
                         struct obd_device *cache_dev = NULL;
                         int m_easize, m_cooksize;
 
-                        cache_dev = class_exp2obd(cobd->cache_exp); 
+                        cache_dev = class_exp2obd(cobd->cobd_cache_exp); 
                         m_easize = cache_dev->u.cli.cl_max_mds_easize; 
                         m_cooksize = cache_dev->u.cli.cl_max_mds_cookiesize; 
-                        rc = obd_disconnect(cobd->cache_exp, 0);
+                        rc = obd_disconnect(cobd->cobd_cache_exp, 0);
                         if (rc != 0)
-                                CERROR("error %d disconnecting master\n", rc);
+                                CERROR("error %d disconnecting real\n", rc);
 
-                        /* FIXME-WANGDI: should we read from master_dev? */
+                        /*FIXME, should read from real_dev*/
                         
-                        rc = connect_to_obd(cobd->master_name, &master_conn);
+                        rc = connect_to_obd(cobd->cobd_real_name, &real_conn);
                         if (rc != 0)
                                 RETURN(rc); 
-                        cobd->master_exp = class_conn2export(&master_conn);
-                        master_dev = class_exp2obd(cobd->master_exp);
-                        master_dev->u.cli.cl_max_mds_easize = m_easize;
-                        master_dev->u.cli.cl_max_mds_cookiesize = m_cooksize;
+                        cobd->cobd_real_exp = class_conn2export(&real_conn);
+                        real_dev = class_exp2obd(cobd->cobd_real_exp);
+                        real_dev->u.cli.cl_max_mds_easize = m_easize;
+                        real_dev->u.cli.cl_max_mds_cookiesize = m_cooksize;
                         cobd->cache_on = 0;
                 }
                 break;
@@ -832,7 +833,7 @@ static int  cobd_import_event(struct obd_device *obd,
         return 0; 
 }
 
-static int cobd_md_getattr(struct obd_export *exp, struct lustre_id *id,
+static int cobd_md_getattr(struct obd_export *exp, struct ll_fid *fid,
                            unsigned long valid, unsigned int ea_size,
                            struct ptlrpc_request **request)
 {
@@ -845,7 +846,7 @@ static int cobd_md_getattr(struct obd_export *exp, struct lustre_id *id,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_getattr(cobd_exp, id, valid, ea_size, request);
+        return md_getattr(cobd_exp, fid, valid, ea_size, request);
 }
 
 static int cobd_md_req2lustre_md (struct obd_export *mdc_exp, 
@@ -864,7 +865,7 @@ static int cobd_md_req2lustre_md (struct obd_export *mdc_exp,
         return md_req2lustre_md(cobd_exp, req, offset, osc_exp, md);
 }
 
-static int cobd_md_change_cbdata(struct obd_export *exp, struct lustre_id *id, 
+static int cobd_md_change_cbdata(struct obd_export *exp, struct ll_fid *fid, 
                                  ldlm_iterator_t it, void *data)
 {
         struct obd_device *obd = class_exp2obd(exp);
@@ -876,12 +877,14 @@ static int cobd_md_change_cbdata(struct obd_export *exp, struct lustre_id *id,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_change_cbdata(cobd_exp, id, it, data);
+        return md_change_cbdata(cobd_exp, fid, it, data);
 }
 
-static int cobd_md_getattr_name(struct obd_export *exp, struct lustre_id *id,
-                                char *filename, int namelen, unsigned long valid,
-                                unsigned int ea_size, struct ptlrpc_request **request)
+static int cobd_md_getattr_name(struct obd_export *exp, struct ll_fid *fid,
+                                char *filename, int namelen, 
+                                unsigned long valid,
+                                unsigned int ea_size, 
+                                struct ptlrpc_request **request)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
@@ -892,7 +895,7 @@ static int cobd_md_getattr_name(struct obd_export *exp, struct lustre_id *id,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_getattr_name(cobd_exp, id, filename, namelen, valid,
+        return md_getattr_name(cobd_exp, fid, filename, namelen, valid,
                                ea_size, request);
 }
 
@@ -929,8 +932,7 @@ static int cobd_md_unlink(struct obd_export *exp, struct mdc_op_data *data,
         return md_unlink(cobd_exp, data, request);
 }
 
-static int cobd_md_valid_attrs(struct obd_export *exp,
-                               struct lustre_id *id)
+static int cobd_md_valid_attrs(struct obd_export *exp, struct ll_fid *fid)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
@@ -941,7 +943,7 @@ static int cobd_md_valid_attrs(struct obd_export *exp,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_valid_attrs(cobd_exp, id);
+        return md_valid_attrs(cobd_exp, fid);
 }
 
 static int cobd_md_rename(struct obd_export *exp, struct mdc_op_data *data,
@@ -991,8 +993,7 @@ static int cobd_md_setattr(struct obd_export *exp, struct mdc_op_data *data,
         return md_setattr(cobd_exp, data, iattr, ea, ealen, ea2, ea2len, request);
 }
 
-static int cobd_md_readpage(struct obd_export *exp,
-                            struct lustre_id *mdc_id,
+static int cobd_md_readpage(struct obd_export *exp, struct ll_fid *mdc_fid,
                             __u64 offset, struct page *page, 
                             struct ptlrpc_request **request)
 {
@@ -1005,7 +1006,7 @@ static int cobd_md_readpage(struct obd_export *exp,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_readpage(cobd_exp, mdc_id, offset, page, request);
+        return md_readpage(cobd_exp, mdc_fid, offset, page, request);
 }
 
 static int cobd_md_close(struct obd_export *exp, struct obdo *obdo,
@@ -1038,7 +1039,7 @@ static int cobd_md_done_writing(struct obd_export *exp, struct obdo *obdo)
         return md_done_writing(cobd_exp, obdo);
 }
 
-static int cobd_md_sync(struct obd_export *exp, struct lustre_id *id,
+static int cobd_md_sync(struct obd_export *exp, struct ll_fid *fid,
                         struct ptlrpc_request **request)
 {
         struct obd_device *obd = class_exp2obd(exp);
@@ -1051,7 +1052,7 @@ static int cobd_md_sync(struct obd_export *exp, struct lustre_id *id,
         }
         cobd_exp = cobd_get_exp(obd);
         
-        return md_sync(cobd_exp, id, request);
+        return md_sync(cobd_exp, fid, request);
 }
 
 static int cobd_md_set_open_replay_data(struct obd_export *exp,
@@ -1140,9 +1141,10 @@ static int cobd_md_enqueue(struct obd_export *exp, int lock_type,
                           cb_data);
 }
 
-static int cobd_md_intent_lock(struct obd_export *exp, struct lustre_id *pid, 
-                               const char *name, int len, void *lmm, int lmmsize,
-                               struct lustre_id *cid, struct lookup_intent *it,
+static int cobd_md_intent_lock(struct obd_export *exp,
+                               struct ll_fid *pfid, const char *name, int len,
+                               void *lmm, int lmmsize,
+                               struct ll_fid *cfid, struct lookup_intent *it,
                                int lookup_flags, struct ptlrpc_request **reqp,
                                ldlm_blocking_callback cb_blocking)
 {
@@ -1155,12 +1157,12 @@ static int cobd_md_intent_lock(struct obd_export *exp, struct lustre_id *pid,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_intent_lock(cobd_exp, pid, name, len, lmm, lmmsize,
-                              cid, it, lookup_flags, reqp, cb_blocking);
+        return md_intent_lock(cobd_exp, pfid, name, len, lmm, lmmsize,
+                              cfid, it, lookup_flags, reqp, cb_blocking);
 }
 
-static struct obd_device *cobd_md_get_real_obd(struct obd_export *exp,
-                                               char *name, int len)
+static struct obd_device * cobd_md_get_real_obd(struct obd_export *exp,
+                                                char *name, int len)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
@@ -1175,8 +1177,8 @@ static struct obd_device *cobd_md_get_real_obd(struct obd_export *exp,
 }
 
 static int cobd_md_change_cbdata_name(struct obd_export *exp,
-                                      struct lustre_id *id, char *name,
-                                      int namelen, struct lustre_id *id2,
+                                      struct ll_fid *fid, char *name,
+                                      int namelen, struct ll_fid *fid2,
                                       ldlm_iterator_t it, void *data)
 {
         struct obd_device *obd = class_exp2obd(exp);
@@ -1188,8 +1190,8 @@ static int cobd_md_change_cbdata_name(struct obd_export *exp,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_change_cbdata_name(cobd_exp, id, name, namelen,
-                                     id2, it, data);
+        return md_change_cbdata_name(cobd_exp, fid, name, namelen, fid2, it, 
+                                     data);
 }
 static struct obd_ops cobd_obd_ops = {
         .o_owner                = THIS_MODULE,
index a40f42d..25b1e3a 100644 (file)
@@ -41,7 +41,7 @@ static int cobd_rd_target(char *page, char **start, off_t off, int count,
                 rc = snprintf(page, count, "not set up\n");
         } else {
                 struct obd_device *tgt =
-                        class_exp2obd(cobd->u.cobd.master_exp);
+                        class_exp2obd(cobd->u.cobd.cobd_real_exp);
                 LASSERT(tgt != NULL);
                 rc = snprintf(page, count, "%s\n", tgt->obd_uuid.uuid);
         }
@@ -60,7 +60,7 @@ static int cobd_rd_cache(char *page, char **start, off_t off, int count,
                 rc = snprintf(page, count, "not set up\n");
         } else {
                 struct obd_device *cache =
-                        class_exp2obd(cobd->u.cobd.cache_exp);
+                        class_exp2obd(cobd->u.cobd.cobd_cache_exp);
                 LASSERT(cache != NULL);
                 rc = snprintf(page, count, "%s\n", cache->obd_uuid.uuid);
         }
index f32b34e..3c602cd 100644 (file)
@@ -363,7 +363,6 @@ struct page {
 #define PAGE_LIST_ENTRY list
 #define PAGE_LIST(page) ((page)->list)
 
-#define page_address(page) ((page)->addr)
 #define kmap(page) (page)->addr
 #define kunmap(a) do {} while (0)
 
@@ -675,6 +674,13 @@ typedef struct { volatile int counter; } atomic_t;
 #define atomic_add(b,a)  do {(a)->counter += b;} while (0)
 #define atomic_sub(b,a)  do {(a)->counter -= b;} while (0)
 
+#ifndef likely
+#define likely(exp) (exp)
+#endif
+#ifndef unlikely
+#define unlikely(exp) (exp)
+#endif
+
 /* FIXME sys/capability will finally included linux/fs.h thus
  * cause numerous trouble on x86-64. as temporary solution for
  * build broken at cary, we copy definition we need from capability.h
index 32cd252..0287964 100644 (file)
@@ -57,24 +57,10 @@ struct fsfilt_operations {
                                struct iattr *iattr, int do_trunc);
         int     (* fs_iocontrol)(struct inode *inode, struct file *file,
                                  unsigned int cmd, unsigned long arg);
-        
-        /* two methods for getting lov EA and setting it back to inode xattr. */
         int     (* fs_set_md)(struct inode *inode, void *handle, void *md,
                               int size);
         int     (* fs_get_md)(struct inode *inode, void *md, int size);
 
-        /* two methods for getting MID (master id) EA and setting it back to
-         * inode xattr. */
-        int     (* fs_set_mid)(struct inode *inode, void *handle, void *fid,
-                               int size);
-        int     (* fs_get_mid)(struct inode *inode, void *fid, int size);
-
-        /* two methods for getting self id EA and setting it back to inode
-         * xattr. */
-        int     (* fs_set_sid)(struct inode *inode, void *handle, void *sid,
-                               int size);
-        int     (* fs_get_sid)(struct inode *inode, void *sid, int size);
-
         /* this method is needed to make IO operation fsfilt nature depend. */
         int     (* fs_send_bio)(int rw, struct inode *inode,struct kiobuf *bio);
 
@@ -139,7 +125,7 @@ struct fsfilt_operations {
         int     (* fs_get_op_len)(int, struct fsfilt_objinfo *, int);
         int     (* fs_add_dir_entry)(struct obd_device *, struct dentry *,
                                      char *, int, unsigned long, unsigned long,
-                                     unsigned long, unsigned long);
+                                     unsigned);
         int     (* fs_del_dir_entry)(struct obd_device *, struct dentry *);
         /*snap operations*/
         int     (* fs_is_redirector)(struct inode *inode);
@@ -389,7 +375,6 @@ static inline int fsfilt_setup(struct obd_device *obd,
                 return obd->obd_fsops->fs_setup(obd, fs);
         return 0;
 }
-
 static inline int
 fsfilt_set_md(struct obd_device *obd, struct inode *inode,
               void *handle, void *md, int size)
@@ -404,34 +389,6 @@ fsfilt_get_md(struct obd_device *obd, struct inode *inode,
         return obd->obd_fsops->fs_get_md(inode, md, size);
 }
 
-static inline int
-fsfilt_set_mid(struct obd_device *obd, struct inode *inode,
-               void *handle, void *mid, int size)
-{
-        return obd->obd_fsops->fs_set_mid(inode, handle, mid, size);
-}
-
-static inline int
-fsfilt_get_mid(struct obd_device *obd, struct inode *inode,
-               void *mid, int size)
-{
-        return obd->obd_fsops->fs_get_mid(inode, mid, size);
-}
-
-static inline int
-fsfilt_set_sid(struct obd_device *obd, struct inode *inode,
-               void *handle, void *sid, int size)
-{
-        return obd->obd_fsops->fs_set_sid(inode, handle, sid, size);
-}
-
-static inline int
-fsfilt_get_sid(struct obd_device *obd, struct inode *inode,
-               void *sid, int size)
-{
-        return obd->obd_fsops->fs_get_sid(inode, sid, size);
-}
-
 static inline int fsfilt_send_bio(int rw, struct obd_device *obd,
                                   struct inode *inode, void *bio)
 {
@@ -502,10 +459,10 @@ fsfilt_readpage(struct obd_device *obd, struct file *file, char *buf,
 
 static inline int
 fsfilt_add_journal_cb(struct obd_device *obd, struct super_block *sb,
-                      __u64 last_num, void *handle, fsfilt_cb_t cb_func,
+                      __u64 last_rcvd, void *handle, fsfilt_cb_t cb_func,
                       void *cb_data)
 {
-        return obd->obd_fsops->fs_add_journal_cb(obd, sb, last_num, handle,
+        return obd->obd_fsops->fs_add_journal_cb(obd, sb, last_rcvd, handle,
                                                  cb_func, cb_data);
 }
 
@@ -701,15 +658,11 @@ fsfilt_set_mds_flags(struct obd_device *obd, struct super_block *sb)
 static inline int 
 fsfilt_add_dir_entry(struct obd_device *obd, struct dentry *dir,
                      char *name, int namelen, unsigned long ino,
-                     unsigned long generation, unsigned long mds,
-                     unsigned long fid)
+                     unsigned long generation, unsigned mds)
 {
         LASSERT(obd->obd_fsops->fs_add_dir_entry);
-        
         return obd->obd_fsops->fs_add_dir_entry(obd, dir, name,
-                                                namelen, ino,
-                                                generation, mds,
-                                                fid);
+                                                namelen, ino, generation, mds);
 }
 
 static inline int 
index 5c7d80d..66e79f1 100644 (file)
@@ -267,9 +267,7 @@ typedef uint32_t        obd_count;
 #define OBD_FL_RECREATE_OBJS (0x00000020) // recreate missing obj
 #define OBD_FL_DEBUG_CHECK  (0x00000040) /* echo client/server debug check */
 
-/* this should be sizeof(struct lustre_handle) + sizeof(struct llog_cookie) +
- * sizeof(struct lustre_id). */
-#define OBD_INLINESZ (80)
+#define OBD_INLINESZ    64
 
 /* Note: 64-bit types are 64-bit aligned in structure */
 struct obdo {
@@ -292,7 +290,6 @@ struct obdo {
         obd_count               o_misc;          /* brw: o_dropped */
         __u32                   o_easize;       /* epoch in ost writes */
         __u32                   o_mds;
-        __u64                   o_fid;
         __u32                   o_padding;
         char                    o_inline[OBD_INLINESZ]; /* fid in ost writes */
 };
@@ -377,8 +374,7 @@ struct lov_mds_md_v0 {            /* LOV EA mds/wire data (little-endian) */
 #define OBD_MD_FLGRANT  (0x08000000)    /* ost preallocation space grant */
 #define OBD_MD_MDS      (0x10000000)    /* where an inode lives on */
 #define OBD_MD_FLDIREA  (0x20000000)    /* dir's extended attribute data */
-#define OBD_MD_REINT    (0x40000000)    /* reintegrate oa */
-#define OBD_MD_FID      (0x80000000)    /* take care about fid component */
+#define OBD_MD_REINT    (0x40000000)    /* reintegrate oa*/
 #define OBD_MD_FLNOTOBD (~(OBD_MD_FLBLOCKS | OBD_MD_LINKNAME|\
                            OBD_MD_FLEASIZE | OBD_MD_FLHANDLE | OBD_MD_FLCKSUM|\
                            OBD_MD_FLQOS | OBD_MD_FLOSCOPQ | OBD_MD_FLCOOKIE|\
@@ -395,9 +391,8 @@ static inline struct llog_cookie *obdo_logcookie(struct obdo *oa)
         return (struct llog_cookie *)(oa->o_inline +
                                       sizeof(struct lustre_handle));
 }
-
-/* don't forget obdo_fid which is way down at the bottom so it can come after
- * the definition of llog_cookie */
+/* don't forget obdo_fid which is way down at the bottom so it can
+ * come after the definition of llog_cookie */
 
 struct obd_statfs {
         __u64           os_type;
@@ -455,7 +450,6 @@ struct ost_body {
 
 extern void lustre_swab_ost_body (struct ost_body *b);
 extern void lustre_swab_ost_last_id(obd_id *id);
-extern void lustre_swab_generic_32s(__u32 *val);
 
 /* lock value block communicated between the filter and llite */
 
@@ -529,58 +523,43 @@ typedef enum {
  * Do not exceed 63
  */
 
-#define REINT_SETATTR      1
-#define REINT_CREATE       2
-#define REINT_LINK         3
-#define REINT_UNLINK       4
-#define REINT_RENAME       5
-#define REINT_OPEN         6
-#define REINT_CLOSE        7
-#define REINT_WRITE        8
-#define REINT_MAX          8
+#define REINT_SETATTR    1
+#define REINT_CREATE     2
+#define REINT_LINK       3
+#define REINT_UNLINK     4
+#define REINT_RENAME     5
+#define REINT_OPEN       6
+#define REINT_CLOSE      7
+#define REINT_WRITE      8
+#define REINT_MAX        8
 
 /* the disposition of the intent outlines what was executed */
-#define DISP_IT_EXECD     (1 << 0)
-#define DISP_LOOKUP_EXECD (1 << 1)
-#define DISP_LOOKUP_NEG   (1 << 2)
-#define DISP_LOOKUP_POS   (1 << 3)
-#define DISP_OPEN_CREATE  (1 << 4)
-#define DISP_OPEN_OPEN    (1 << 5)
-#define DISP_ENQ_COMPLETE (1 << 6)
+#define DISP_IT_EXECD     0x01
+#define DISP_LOOKUP_EXECD 0x02
+#define DISP_LOOKUP_NEG   0x04
+#define DISP_LOOKUP_POS   0x08
+#define DISP_OPEN_CREATE  0x10
+#define DISP_OPEN_OPEN    0x20
+#define DISP_ENQ_COMPLETE 0x40
 
 /* INODE LOCK PARTS */
-#define MDS_INODELOCK_LOOKUP 0x000001  /* dentry, mode, owner, group */
-#define MDS_INODELOCK_UPDATE 0x000002  /* size, links, timestamps */
-
-/* lustre store cookie */
-struct lustre_stc {
-        union {
-                struct {
-                    __u64 l3s_ino;     /* inode number on local MDS */
-                    __u32 l3s_gen;     /* inode generation */
-                    __u32 l3s_type;    /* inode type */
-                } e3s;
-        } u;
-};
-
-/* lustre file id */
-struct lustre_fid {
-        __u64 lf_id;                   /* fid counter maintained on per 
-                                          group basis */
-        __u64 lf_group;                /* sequence group num */
-        __u32 lf_version;              /* what snapfs version of inode */
-        __u32 lf_padding;
-};
-
-struct lustre_id {
-        struct lustre_stc li_stc;      /* store cookie */
-        struct lustre_fid li_fid;      /* fid cookie */
+#define MDS_INODELOCK_LOOKUP 0x000001       /* dentry, mode, owner, group */
+#define MDS_INODELOCK_UPDATE 0x000002       /* size, links, timestamps */
+//#define MDS_INODELOCK_MAXSHIFT 1
+//#define MDS_INODELOCK_FULL ((1<<(MDS_INODELOCK_MAXSHIFT+1))-1)
+
+struct ll_fid {
+        __u64 id;
+        __u32 generation;
+        __u32 f_type;
+        __u32 mds;
+        __u32 padding;
 };
 
 struct mea_old {
         __u32 mea_count;
         __u32 mea_master;
-        struct lustre_id mea_ids[0];
+        struct ll_fid mea_fids[0];
 };
 
 #define MEA_MAGIC_LAST_CHAR      0xb2221ca1
@@ -590,9 +569,11 @@ struct mea {
         __u32 mea_magic;
         __u32 mea_count;
         __u32 mea_master;
-        struct lustre_id mea_ids[0];
+        struct ll_fid mea_fids[0];
 };
 
+extern void lustre_swab_ll_fid (struct ll_fid *fid);
+
 #define MDS_STATUS_CONN 1
 #define MDS_STATUS_LOV 2
 
@@ -601,20 +582,18 @@ struct mds_status_req {
         __u32  repbuf;
 };
 
-extern void lustre_swab_lustre_id(struct lustre_id *id);
-extern void lustre_swab_lustre_stc(struct lustre_stc *stc);
-extern void lustre_swab_lustre_fid(struct lustre_fid *fid);
 extern void lustre_swab_mds_status_req (struct mds_status_req *r);
 
 #define MDS_BFLAG_UNCOMMITTED_WRITES   0x1
 
 struct mds_body {
-        struct lustre_id id1;
-        struct lustre_id id2;
+        struct ll_fid  fid1;
+        struct ll_fid  fid2;
         struct lustre_handle handle;
         __u64          size;   /* Offset, in the case of MDS_READPAGE */
         __u64          blocks; /* XID, in the case of MDS_READPAGE */
         __u64          io_epoch;
+        __u32          ino;   /* make this a __u64 */
         __u32          valid;
         __u32          mode;
         __u32          uid;
@@ -622,10 +601,12 @@ struct mds_body {
         __u32          mtime;
         __u32          ctime;
         __u32          atime;
-        __u32          flags;  /* from vfs for pin/unpin, MDS_BFLAG for close */
+        __u32          flags; /* from vfs for pin/unpin, MDS_BFLAG for close */
         __u32          rdev;
-        __u32          nlink;  /* #bytes to read in the case of MDS_READPAGE */
+        __u32          nlink; /* #bytes to read in the case of MDS_READPAGE */
+        __u32          generation;
         __u32          eadatasize;
+        __u32          mds;
 };
 
 extern void lustre_swab_mds_body (struct mds_body *b);
@@ -637,32 +618,31 @@ struct lustre_md {
 };
 
 struct mdc_op_data {
-        struct lustre_id id1;
-        struct lustre_id id2;
+        struct ll_fid fid1;
+        struct ll_fid fid2;
         __u64 mod_time;
         const char *name;
         int namelen;
         __u32 create_mode;
         struct mea *mea1;       /* mea of inode1 */
         struct mea *mea2;       /* mea of inode2 */
-        __u32 valid;
 };
 
 #define MDS_MODE_DONT_LOCK      (1 << 30)
 #define MDS_MODE_REPLAY         (1 << 31)
 
 struct mds_rec_setattr {
-        __u32            sa_opcode;
-        __u32            sa_valid;
-        struct lustre_id sa_id;
-        __u32            sa_mode;
-        __u32            sa_uid;
-        __u32            sa_gid;
-        __u32            sa_attr_flags;
-        __u64            sa_size;
-        __u64            sa_atime;
-        __u64            sa_mtime;
-        __u64            sa_ctime;
+        __u32           sa_opcode;
+        __u32           sa_valid;
+        struct ll_fid   sa_fid;
+        __u32           sa_mode;
+        __u32           sa_uid;
+        __u32           sa_gid;
+        __u32           sa_attr_flags;
+        __u64           sa_size;
+        __u64           sa_atime;
+        __u64           sa_mtime;
+        __u64           sa_ctime;
 };
 
 /* Remove this once we declare it in include/linux/fs.h (v21 kernel patch?) */
@@ -686,49 +666,49 @@ extern void lustre_swab_mds_rec_setattr (struct mds_rec_setattr *sa);
 #define MDS_OPEN_SYNC            00010000
 #define MDS_OPEN_DIRECTORY       00200000
 
-#define MDS_OPEN_DELAY_CREATE    0100000000   /* delay initial object create */
-#define MDS_OPEN_HAS_EA          010000000000 /* specify object create pattern */
-#define MDS_OPEN_HAS_OBJS        020000000000 /* Just set the EA the obj exist */
+#define MDS_OPEN_DELAY_CREATE  0100000000 /* delay initial object create */
+#define MDS_OPEN_HAS_EA      010000000000 /* specify object create pattern */
+#define MDS_OPEN_HAS_OBJS    020000000000 /* Just set the EA the obj exist */
 
 struct mds_rec_create {
-        __u32            cr_opcode;
-        __u32            cr_flags; /* for use with open */
-        __u32            cr_mode;
-        __u32            cr_padding;
-        struct lustre_id cr_id;
-        struct lustre_id cr_replayid;
-        __u64            cr_time;
-        __u64            cr_rdev;
+        __u32           cr_opcode;
+        __u32           cr_flags; /* for use with open */
+        __u32           cr_mode;
+        __u32           cr_padding;
+        struct ll_fid   cr_fid;
+        struct ll_fid   cr_replayfid;
+        __u64           cr_time;
+        __u64           cr_rdev;
 };
 
 extern void lustre_swab_mds_rec_create (struct mds_rec_create *cr);
 
 struct mds_rec_link {
-        __u32            lk_opcode;
-        __u32            lk_padding;
-        struct lustre_id lk_id1;
-        struct lustre_id lk_id2;
-        __u64            lk_time;
+        __u32           lk_opcode;
+        __u32           lk_padding;
+        struct ll_fid   lk_fid1;
+        struct ll_fid   lk_fid2;
+        __u64           lk_time;
 };
 
 extern void lustre_swab_mds_rec_link (struct mds_rec_link *lk);
 
 struct mds_rec_unlink {
-        __u32            ul_opcode;
-        __u32            ul_mode;
-        struct lustre_id ul_id1;
-        struct lustre_id ul_id2;
-        __u64            ul_time;
+        __u32           ul_opcode;
+        __u32           ul_mode;
+        struct ll_fid   ul_fid1;
+        struct ll_fid   ul_fid2;
+        __u64           ul_time;
 };
 
 extern void lustre_swab_mds_rec_unlink (struct mds_rec_unlink *ul);
 
 struct mds_rec_rename {
-        __u32            rn_opcode;
-        __u32            rn_padding;
-        struct lustre_id rn_id1;
-        struct lustre_id rn_id2;
-        __u64            rn_time;
+        __u32           rn_opcode;
+        __u32           rn_padding;
+        struct ll_fid   rn_fid1;
+        struct ll_fid   rn_fid2;
+        __u64           rn_time;
 };
 
 extern void lustre_swab_mds_rec_rename (struct mds_rec_rename *rn);
@@ -872,11 +852,11 @@ extern void lustre_swab_ldlm_reply (struct ldlm_reply *r);
  * ptlbd, portal block device requests
  */
 typedef enum {
-        PTLBD_QUERY      = 200,
-        PTLBD_READ       = 201,
-        PTLBD_WRITE      = 202,
-        PTLBD_FLUSH      = 203,
-        PTLBD_CONNECT    = 204,
+        PTLBD_QUERY = 200,
+        PTLBD_READ = 201,
+        PTLBD_WRITE = 202,
+        PTLBD_FLUSH = 203,
+        PTLBD_CONNECT = 204,
         PTLBD_DISCONNECT = 205,
         PTLBD_LAST_OPC
 } ptlbd_cmd_t;
@@ -987,7 +967,7 @@ struct llog_logid_rec {
 
 struct llog_create_rec {
         struct llog_rec_hdr     lcr_hdr;
-        struct lustre_id        lcr_id;
+        struct ll_fid           lcr_fid;
         obd_id                  lcr_oid;
         obd_count               lcr_ogen;
         __u32                   padding;
@@ -1012,7 +992,7 @@ struct llog_unlink_rec {
 
 struct llog_size_change_rec {
         struct llog_rec_hdr     lsc_hdr;
-        struct lustre_id        lsc_id;
+        struct ll_fid           lsc_fid;
         __u32                   lsc_io_epoch;
         __u32                   padding;
         struct llog_rec_tail    lsc_tail;
@@ -1031,8 +1011,8 @@ struct llog_gen_rec {
 
 struct llog_lru_rec {
         struct llog_rec_hdr     llr_hdr;
-        struct lustre_id        llr_cid;
-        struct lustre_id        llr_pid;
+        struct ll_fid           llr_cfid;
+        struct ll_fid           llr_pfid;
         struct llog_rec_tail    llr_tail;
 } __attribute__((packed));
 
@@ -1107,12 +1087,10 @@ extern void lustre_swab_llogd_body (struct llogd_body *d);
 extern void lustre_swab_llog_hdr (struct llog_log_hdr *h);
 extern void lustre_swab_llogd_conn_body (struct llogd_conn_body *d);
 
-static inline struct lustre_id *obdo_id(struct obdo *oa)
+static inline struct ll_fid *obdo_fid(struct obdo *oa)
 {
-        void *raw_id = oa->o_inline + sizeof(struct lustre_handle) +
-                sizeof(struct llog_cookie);
-        
-        return (struct lustre_id *)raw_id;
+        return (struct ll_fid *)(oa->o_inline + sizeof(struct lustre_handle) +
+                                 sizeof(struct llog_cookie));
 }
 
 #endif
index 868a4dd..7a9d350 100644 (file)
 #endif
 #endif
 
-/* lustre_id output helper macros */
-#define DLID4   "%lu/%lu/%lu/%lu"
-
-#define OLID4(id)                                  \
-        (unsigned long)(id)->li_fid.lf_id,         \
-        (unsigned long)(id)->li_fid.lf_group,      \
-        (unsigned long)(id)->li_stc.u.e3s.l3s_ino, \
-        (unsigned long)(id)->li_stc.u.e3s.l3s_gen
-
 /* target.c */
 struct ptlrpc_request;
 struct recovd_data;
index bd8341b..1c34c4c 100644 (file)
 /* careful, this is easy to screw up */
 #define PAGE_CACHE_MAXBYTES ((__u64)(~0UL) << PAGE_CACHE_SHIFT)
 
+
+/*
+struct lustre_intent_data {
+        __u64 it_lock_handle[2];
+        __u32 it_disposition;
+        __u32 it_status;
+        __u32 it_lock_mode;
+        }; */
+
 #define LL_IT2STR(it) ((it) ? ldlm_it2str((it)->it_op) : "0")
 
 static inline struct lookup_intent *ll_nd2it(struct nameidata *nd)
@@ -67,17 +76,16 @@ extern struct file_operations ll_pgcache_seq_fops;
 #define LLI_F_HAVE_OST_SIZE_LOCK        0
 #define LLI_F_HAVE_MDS_SIZE_LOCK        1
 #define LLI_F_PREFER_EXTENDED_SIZE      2
-
 struct ll_inode_info {
         int                     lli_inode_magic;
         struct lov_stripe_md   *lli_smd;
         struct mea             *lli_mea;
-        struct lustre_id        lli_id;    /* full lustre_id */
         char                   *lli_symlink_name;
         struct semaphore        lli_open_sem;
         __u64                   lli_maxbytes;
         __u64                   lli_io_epoch;
         unsigned long           lli_flags;
+        __u32                   lli_mds;
 
         /* this lock protects s_d_w and p_w_ll */
         spinlock_t              lli_lock;
@@ -143,34 +151,31 @@ enum {
          LPROC_LL_FILE_OPCODES
 };
 
-static inline void
-ll_inode2id(struct lustre_id *id, struct inode *inode)
+static inline void ll_inode2fid(struct ll_fid *fid, struct inode *inode)
 {
-        struct lustre_id *lid = &ll_i2info(inode)->lli_id;
-
-        mdc_pack_id(id, inode->i_ino, inode->i_generation,
-                    (inode->i_mode & S_IFMT), id_group(lid),
-                    id_fid(lid));
+        mdc_pack_fid(fid, inode->i_ino, inode->i_generation,
+                     inode->i_mode & S_IFMT);
+        LASSERT(ll_i2info(inode));
+        fid->mds = ll_i2info(inode)->lli_mds;
 }
 
 static inline void 
-ll_prepare_mdc_data(struct mdc_op_data *data, struct inode *i1,
-                    struct inode *i2, const char *name, int namelen,
-                    int mode)
+ll_prepare_mdc_op_data(struct mdc_op_data *data, struct inode *i1,
+                       struct inode *i2, const char *name, int namelen,
+                       int mode)
 {
         LASSERT(i1);
 
-        ll_inode2id(&data->id1, i1);
+        ll_inode2fid(&data->fid1, i1);
 
         /* it could be directory with mea */
         data->mea1 = ll_i2info(i1)->lli_mea;
 
         if (i2) {
-                ll_inode2id(&data->id2, i2);
+                ll_inode2fid(&data->fid2, i2);
                 data->mea2 = ll_i2info(i2)->lli_mea;
         }
 
-       data->valid = 0;
         data->name = name;
         data->namelen = namelen;
         data->create_mode = mode;
index 2db1dcc..c125662 100644 (file)
@@ -53,29 +53,29 @@ struct ll_file_data;
 #define LUSTRE_MDC_NAME "mdc"
 
 struct mds_update_record {
-        __u32               ur_opcode;
-        struct lustre_id   *ur_id1;
-        struct lustre_id   *ur_id2;
-        int                 ur_namelen;
-        char               *ur_name;
-        int                 ur_tgtlen;
-        char               *ur_tgt;
-        int                 ur_eadatalen;
-        void               *ur_eadata;
-        int                 ur_cookielen;
+        __u32 ur_opcode;
+        struct ll_fid *ur_fid1;
+        struct ll_fid *ur_fid2;
+        int ur_namelen;
+        char *ur_name;
+        int ur_tgtlen;
+        char *ur_tgt;
+        int ur_eadatalen;
+        void *ur_eadata;
+        int ur_cookielen;
         struct llog_cookie *ur_logcookies;
-        struct iattr        ur_iattr;
-        struct lvfs_ucred   ur_uc;
-        __u64               ur_rdev;
-        __u32               ur_mode;
-        __u64               ur_time;
-        __u32               ur_flags;
+        struct iattr ur_iattr;
+        struct lvfs_ucred ur_uc;
+        __u64 ur_rdev;
+        __u32 ur_mode;
+        __u64 ur_time;
+        __u32 ur_flags;
 };
 
-#define ur_fsuid    ur_uc.luc_fsuid
-#define ur_fsgid    ur_uc.luc_fsgid
-#define ur_cap      ur_uc.luc_cap
-#define ur_uid      ur_uc.luc_uid
+#define _ur_fsuid    ur_uc.luc_fsuid
+#define _ur_fsgid    ur_uc.luc_fsgid
+#define _ur_cap      ur_uc.luc_cap
+#define _ur_uid      ur_uc.luc_uid
 
 
 #define MDS_LR_SERVER_SIZE    512
@@ -93,12 +93,12 @@ struct mds_update_record {
 
 #define MDS_INCOMPAT_SUPP       (0)
 
-#define MDS_MASTER_OBD           1
-#define MDS_CACHE_OBD            0
+#define REAL_MDS_NUMBER       1 
+#define CACHE_MDS_NUMBER      0 
 
 /*flags for indicate the record are come from cmobd reint or 
   mdc create */
-#define REC_REINT_CREATE        0x0001
+#define REC_REINT_CREATE      0x0001
 
 /* Data stored per server at the head of the last_rcvd file.  In le32 order.
  * Try to keep this the same as fsd_server_data so we might one day merge. */
@@ -172,17 +172,13 @@ int mds_reint_rec(struct mds_update_record *r, int offset,
 
 /* mds/handler.c */
 #ifdef __KERNEL__
-struct dentry *
-mds_id2dentry(struct obd_device *obd, struct lustre_id *id,
-              struct vfsmount **mnt);
-
-struct dentry *
-mds_id2locked_dentry(struct obd_device *obd, struct lustre_id *id,
-                     struct vfsmount **mnt, int lock_mode,
-                     struct lustre_handle *lockh, int *pmode,
-                     char *name, int namelen, __u64 lockpart);
+struct dentry *mds_fid2locked_dentry(struct obd_device *obd, struct ll_fid *fid,
+                                     struct vfsmount **mnt, int lock_mode,
+                                     struct lustre_handle *lockh, int *pmode,
+                                     char *name, int namelen, __u64 lockpart);
+struct dentry *mds_fid2dentry(struct mds_obd *mds, struct ll_fid *fid,
+                              struct vfsmount **mnt);
 int mds_update_server_data(struct obd_device *, int force_sync);
-int mds_update_last_fid(struct obd_device *obd, int force_sync);
 
 /* mds/mds_fs.c */
 int mds_fs_setup(struct obd_device *obddev, struct vfsmount *mnt);
@@ -196,12 +192,13 @@ int it_disposition(struct lookup_intent *it, int flag);
 void it_set_disposition(struct lookup_intent *it, int flag);
 int it_open_error(int phase, struct lookup_intent *it);
 int mdc_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data);
-int mdc_change_cbdata(struct obd_export *exp, struct lustre_id *id, 
+int mdc_change_cbdata(struct obd_export *exp, struct ll_fid *fid, 
                       ldlm_iterator_t it, void *data);
-int mdc_intent_lock(struct obd_export *exp, struct lustre_id *parent, 
-                    const char *name, int len, void *lmm, int lmmsize, 
-                    struct lustre_id *child, struct lookup_intent *, int, 
-                    struct ptlrpc_request **reqp, 
+int mdc_intent_lock(struct obd_export *exp, struct ll_fid *parent, 
+                    const char *name, int len, void *lmm, int lmmsize,
+                    struct ll_fid *child,
+                    struct lookup_intent *, int, 
+                    struct ptlrpc_request **reqp,
                     ldlm_blocking_callback cb_blocking);
 int mdc_enqueue(struct obd_export *exp,
                 int lock_type,
@@ -221,11 +218,11 @@ void mdc_pack_secdesc(struct ptlrpc_request *req, int size);
 int mdc_req2lustre_md(struct obd_export *exp_mdc, struct ptlrpc_request *req, 
                       unsigned int offset, struct obd_export *exp_osc, 
                       struct lustre_md *md);
-int mdc_getstatus(struct obd_export *exp, struct lustre_id *rootid);
-int mdc_getattr(struct obd_export *exp, struct lustre_id *id,
+int mdc_getstatus(struct obd_export *exp, struct ll_fid *rootfid);
+int mdc_getattr(struct obd_export *exp, struct ll_fid *fid,
                 unsigned long valid, unsigned int ea_size,
                 struct ptlrpc_request **request);
-int mdc_getattr_name(struct obd_export *exp, struct lustre_id *id,
+int mdc_getattr_name(struct obd_export *exp, struct ll_fid *fid,
                      char *filename, int namelen, unsigned long valid,
                      unsigned int ea_size, struct ptlrpc_request **request);
 int mdc_setattr(struct obd_export *exp, struct mdc_op_data *data,
@@ -234,9 +231,7 @@ int mdc_setattr(struct obd_export *exp, struct mdc_op_data *data,
 int mdc_open(struct obd_export *exp, obd_id ino, int type, int flags,
              struct lov_mds_md *lmm, int lmm_size, struct lustre_handle *fh,
              struct ptlrpc_request **);
-
 struct obd_client_handle;
-
 int mdc_set_open_replay_data(struct obd_export *exp, 
                              struct obd_client_handle *och,
                              struct ptlrpc_request *open_req);
@@ -244,7 +239,7 @@ int mdc_clear_open_replay_data(struct obd_export *exp,
                                struct obd_client_handle *och);
 int mdc_close(struct obd_export *, struct obdo *, struct obd_client_handle *,
               struct ptlrpc_request **);
-int mdc_readpage(struct obd_export *exp, struct lustre_id *id,
+int mdc_readpage(struct obd_export *exp, struct ll_fid *mdc_fid,
                  __u64, struct page *, struct ptlrpc_request **);
 int mdc_create(struct obd_export *exp, struct mdc_op_data *op_data,
                const void *data, int datalen, int mode, __u32 uid, __u32 gid,
@@ -256,23 +251,28 @@ int mdc_link(struct obd_export *exp, struct mdc_op_data *data,
 int mdc_rename(struct obd_export *exp, struct mdc_op_data *data,
                const char *old, int oldlen, const char *new, int newlen,
                struct ptlrpc_request **request);
-int mdc_sync(struct obd_export *exp, struct lustre_id *id,
+int mdc_sync(struct obd_export *exp, struct ll_fid *fid,
              struct ptlrpc_request **);
 int mdc_create_client(struct obd_uuid uuid, struct ptlrpc_client *cl);
 
-/* store the generation of a newly-created inode in |req| for replay. */
-int mdc_store_inode_generation(struct obd_export *exp,
-                               struct ptlrpc_request *req, 
+/* Store the generation of a newly-created inode in |req| for replay. */
+int mdc_store_inode_generation(struct obd_export *exp, struct ptlrpc_request *req, 
                                int reqoff, int repoff);
-
-int mdc_llog_process(struct obd_export *, char *, llog_cb_t,
-                     void *);
-
-int mdc_done_writing(struct obd_export *, struct obdo *);
+int mdc_llog_process(struct obd_export *, char *logname, llog_cb_t, void *data);
+int mdc_done_writing(struct obd_export *exp, struct obdo *);
+int mdc_reint(struct ptlrpc_request *request, struct mdc_rpc_lock *rpc_lock, 
+              int level);
+static inline void mdc_pack_fid(struct ll_fid *fid, obd_id ino, __u32 gen,
+                                int type)
+{
+        fid->id = ino;
+        fid->generation = gen;
+        fid->f_type = type;
+}
 
 /* ioctls for trying requests */
-#define IOC_REQUEST_TYPE                 'f'
-#define IOC_REQUEST_MIN_NR               30
+#define IOC_REQUEST_TYPE                   'f'
+#define IOC_REQUEST_MIN_NR                 30
 
 #define IOC_REQUEST_GETATTR             _IOWR('f', 30, long)
 #define IOC_REQUEST_READPAGE            _IOWR('f', 31, long)
index aaec825..f3569c0 100644 (file)
@@ -708,86 +708,15 @@ void *mdc_setattr_pack(struct lustre_msg *msg, int offset,
                        struct mdc_op_data *data, struct iattr *iattr,
                        void *ea, int ealen, void *ea2, int ea2len);
 void *mdc_create_pack(struct lustre_msg *msg, int offset,
-                      struct mdc_op_data *op_data, __u32 mode,
-                      __u64 rdev, const void *data, int datalen);
+                      struct mdc_op_data *op_data, __u32 mode, __u64 rdev,
+                      const void *data, int datalen);
 void *mdc_unlink_pack(struct lustre_msg *msg, int offset,
                       struct mdc_op_data *data);
 void *mdc_link_pack(struct lustre_msg *msg, int offset,
                     struct mdc_op_data *data);
 void *mdc_rename_pack(struct lustre_msg *msg, int offset,
                       struct mdc_op_data *data,
-                      const char *old, int oldlen,
-                      const char *new, int newlen);
-
-/* lustre id helper functions and macros. */
-static inline
-void mdc_pack_id(struct lustre_id *id, obd_id ino, 
-                 __u32 gen, int type, __u64 mds, 
-                 __u64 fid)
-{
-        LASSERT(id != NULL);
-
-        id->li_fid.lf_id = fid;
-        id->li_fid.lf_group = mds;
-        
-        id->li_stc.u.e3s.l3s_ino = ino;
-        id->li_stc.u.e3s.l3s_gen = gen;
-        id->li_stc.u.e3s.l3s_type = type;
-}
-
-#define id_ino(id)                              \
-        (id)->li_stc.u.e3s.l3s_ino
-
-#define id_gen(id)                              \
-        (id)->li_stc.u.e3s.l3s_gen
-
-#define id_type(id)                             \
-        (id)->li_stc.u.e3s.l3s_type
-
-#define id_fid(id)                              \
-        (id)->li_fid.lf_id
-
-#define id_group(id)                            \
-        (id)->li_fid.lf_group
-
-#define id_assign_fid(id1, id2)                 \
-        ((id1)->li_fid = (id2)->li_fid)
-
-#define id_assign_stc(id1, id2)                 \
-        ((id1)->li_stc = (id2)->li_stc)
-
-#define id_equal(id1, id2)                      \
-        (id_ino(id1) == id_ino(id2) &&          \
-         id_gen(id1) == id_gen(id2) &&          \
-         id_fid(id1) == id_fid(id2) &&          \
-         id_group(id1) == id_group(id2))
-
-#ifdef __KERNEL__
-static inline void
-mdc_inode2id(struct lustre_id *id, struct inode *inode)
-{
-        mdc_pack_id(id, inode->i_ino, inode->i_generation,
-                    (inode->i_mode & S_IFMT), 0, 0);
-}
-
-static inline void 
-mdc_prepare_mdc_data(struct mdc_op_data *data, struct inode *i1,
-                     struct inode *i2, const char *name, int namelen,
-                     int mode)
-{
-        LASSERT(i1);
-
-        mdc_inode2id(&data->id1, i1);
-        if (i2)
-                mdc_inode2id(&data->id2, i2);
-
-       data->valid = 0;
-        data->name = name;
-        data->namelen = namelen;
-        data->create_mode = mode;
-        data->mod_time = CURRENT_TIME;
-}
-#endif
+                      const char *old, int oldlen, const char *new, int newlen);
 
 /* ldlm/ldlm_lib.c */
 int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf);
index b6fd845..62efd3c 100644 (file)
@@ -33,10 +33,6 @@ struct snap_inode_info {
         ino_t sn_root_ino;        /*the root ino of this snap*/
 };
 struct smfs_inode_info {
-        /* this first part of struct should be the same as in mds_info_info */
-        struct lustre_id smi_id;
-        
-        /* smfs part. */
         struct inode *smi_inode;
         __u32  smi_flags;
        struct snap_inode_info sm_sninfo;
@@ -128,14 +124,11 @@ struct fs_extent{
 };
 
 #define I2SMI(inode)  ((struct smfs_inode_info *) ((inode->u.generic_ip)))
-#define I2FSI(inode)  (((inode->u.generic_ip)))
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#define S2FSI(sb)   (((sb->u.generic_sbp)))
 #define S2SMI(sb)   ((struct smfs_super_info *) ((sb->u.generic_sbp)))
 #define S2CSB(sb)   (((struct smfs_super_info *)((sb->u.generic_sbp)))->smsi_sb)
 #else
-#define S2FSI(sb)   ((sb->s_fs_info))
 #define S2SMI(sb)   ((struct smfs_super_info *) (sb->s_fs_info))
 #define S2CSB(sb)   (((struct smfs_super_info *) (sb->s_fs_info))->smsi_sb)
 #endif
@@ -320,10 +313,9 @@ static inline void post_smfs_inode(struct inode *inode,
 {
         if (inode && cache_inode) {
                 duplicate_inode(inode, cache_inode);
-                
-                /*
-                 * here we must release the cache_inode, otherwise we will have
-                 * no chance to do it later.
+                /*Here we must release the cache_inode,
+                 *Otherwise we will have no chance to
+                 *do it
                  */
                 cache_inode->i_state &=~I_LOCK;
                 inode->i_blocks = cache_inode->i_blocks;
@@ -441,11 +433,6 @@ static inline void post_smfs_dentry(struct dentry *cache_dentry)
 {
         if (!cache_dentry)
                 return;
-
-        /* 
-         * this is needed because d_unalloc() calls dput(), which in turn calls
-         * iput() on dentry inode.
-         */
         if (cache_dentry->d_inode)
                 igrab(cache_dentry->d_inode);
         d_unalloc(cache_dentry);
index fcccab4..3585660 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <linux/kp30.h>
 
-#define LL_ID_NAMELEN (16 + 1 + 8 + 1)
+#define LL_FID_NAMELEN (16 + 1 + 8 + 1)
 
 #if defined __KERNEL__
 #include <linux/lustre_compat25.h>
@@ -28,8 +28,7 @@ struct lvfs_ucred {
 };
 
 struct lvfs_callback_ops {
-        struct dentry *(*l_id2dentry)(__u64 ino, __u32 gen, 
-                                      __u64 gr, void *data);
+        struct dentry *(*l_fid2dentry)(__u64 id_ino, __u32 gen, __u64 gr, void *data);
 };
 
 #define OBD_RUN_CTXT_MAGIC      0xC0FFEEAA
@@ -59,8 +58,7 @@ struct lvfs_run_ctxt {
 #endif
 
 /* lvfs_common.c */
-struct dentry *lvfs_id2dentry(struct lvfs_run_ctxt *, __u64, 
-                              __u32, __u64 ,void *data);
+struct dentry *lvfs_fid2dentry(struct lvfs_run_ctxt *, __u64, __u32, __u64 ,void *data);
 
 void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx,
                struct lvfs_ucred *cred);
@@ -91,25 +89,27 @@ void *lock_dir(struct inode *dir, struct qstr *name);
 void unlock_dir(struct inode *dir, void *lock);
 #endif
 
-/* We need to hold the inode semaphore over the dcache lookup itself, or we run
- * the risk of entering the filesystem lookup path concurrently on SMP systems,
- * and instantiating two inodes for the same entry.  We still protect against
- * concurrent addition/removal races with the DLM locking. */
-static inline struct dentry *
-ll_lookup_one_len(const char *name, struct dentry *dparent, int namelen)
+/* We need to hold the inode semaphore over the dcache lookup itself, or we
+ * run the risk of entering the filesystem lookup path concurrently on SMP
+ * systems, and instantiating two inodes for the same entry.  We still
+ * protect against concurrent addition/removal races with the DLM locking.
+ */
+static inline struct dentry *ll_lookup_one_len(const char *fid_name,
+                                               struct dentry *dparent,
+                                               int fid_namelen)
 {
         struct dentry *dchild;
 #ifdef S_PDIROPS
        struct qstr qstr;
        void *lock;
-       qstr.name = name;
-       qstr.len = namelen;
+       qstr.name = fid_name;
+       qstr.len = fid_namelen;
        lock = lock_dir(dparent->d_inode, &qstr);
 #else
         down(&dparent->d_inode->i_sem);
 #endif
 
-        dchild = lookup_one_len(name, dparent, namelen);
+        dchild = lookup_one_len(fid_name, dparent, fid_namelen);
 
 #ifdef S_PDIROPS
        unlock_dir(dparent->d_inode, lock);
@@ -127,10 +127,9 @@ static inline void ll_sleep(int t)
 }
 #endif
 
-static inline int ll_id2str(char *str, __u64 id, __u32 generation)
+static inline int ll_fid2str(char *str, __u64 id, __u32 generation)
 {
-        return sprintf(str, "%llx:%08x", (unsigned long long)id, 
-                       generation);
+        return sprintf(str, "%llx:%08x", (unsigned long long)id, generation);
 }
 
 #endif
index 5d84673..ae27f81 100644 (file)
@@ -26,7 +26,7 @@ struct l_linux_dirent {
         struct list_head lld_list;
         ino_t           lld_ino;
         unsigned long   lld_off;
-        char            lld_name[LL_ID_NAMELEN];
+        char            lld_name[LL_FID_NAMELEN];
 };
 struct l_readdir_callback {
         struct l_linux_dirent *lrc_dirent;
index c9e122d..4cf2769 100644 (file)
@@ -216,8 +216,8 @@ struct filter_obd {
         struct semaphore     fo_init_lock;      /* group initialization lock */
         int                  fo_committed_group;
 
-        spinlock_t           fo_objidlock;      /* protect fo_lastobjid increment */
-        spinlock_t           fo_translock;      /* protect fsd_last_rcvd increment */
+        spinlock_t           fo_objidlock; /* protect fo_lastobjid increment */
+        spinlock_t           fo_translock; /* protect fsd_last_rcvd increment */
         struct file         *fo_rcvd_filp;
         struct filter_server_data *fo_fsd;
         unsigned long       *fo_last_rcvd_slots;
@@ -332,28 +332,26 @@ struct mds_obd {
         struct ptlrpc_service           *mds_readpage_service;
         struct super_block              *mds_sb;
         struct vfsmount                 *mds_vfsmnt;
-        struct dentry                   *mds_id_de;
+        struct dentry                   *mds_fid_de;
         int                              mds_max_mdsize;
         int                              mds_max_cookiesize;
         struct file                     *mds_rcvd_filp;
-        struct file                     *mds_fid_filp;
         spinlock_t                       mds_transno_lock;
         __u64                            mds_last_transno;
         __u64                            mds_mount_count;
         __u64                            mds_io_epoch;
-        spinlock_t                       mds_fid_lock;
-        __u64                            mds_last_fid;
         struct semaphore                 mds_epoch_sem;
-        struct lustre_id                 mds_rootid;
+        struct ll_fid                    mds_rootfid;
         struct mds_server_data          *mds_server_data;
         struct dentry                   *mds_pending_dir;
         struct dentry                   *mds_logs_dir;
         struct dentry                   *mds_objects_dir;
         struct llog_handle              *mds_cfg_llh;
-        struct obd_device               *mds_lov_obd;
+//      struct llog_handle              *mds_catalog;
+        struct obd_device               *mds_osc_obd; /* XXX lov_obd */
         struct obd_uuid                  mds_lov_uuid;
         char                            *mds_profile;
-        struct obd_export               *mds_lov_exp;
+        struct obd_export               *mds_osc_exp; /* XXX lov_exp */
         int                              mds_has_lov_desc;
         struct lov_desc                  mds_lov_desc;
         obd_id                          *mds_lov_objids;
@@ -363,15 +361,15 @@ struct mds_obd {
         spinlock_t                      mds_lov_lock;
         unsigned long                   *mds_client_bitmap;
         struct semaphore                 mds_orphan_recovery_sem;
-        
+        /*add mds num here for real mds and cache mds create
+          FIXME later will be totally fixed by b_cmd*/
         int                              mds_num;
         struct lprocfs_stats            *mds_counters;
         int                              mds_config_version;
 
         char                            *mds_lmv_name;
-        struct obd_device               *mds_lmv_obd;
-        struct obd_export               *mds_lmv_exp;
-
+        struct obd_device               *mds_lmv_obd; /* XXX lmv_obd */
+        struct obd_export               *mds_lmv_exp; /* XXX lov_exp */
         struct ptlrpc_service           *mds_create_service;
         struct semaphore                 mds_lmv_sem;
         uid_t                            mds_squash_uid;
@@ -379,8 +377,7 @@ struct mds_obd {
         ptl_nid_t                        mds_nosquash_nid;
         atomic_t                         mds_real_clients;
         struct obd_uuid                  mds_lmv_uuid;
-        struct dentry                   *mds_id_dir;
-        int                              mds_obd_type;
+        struct dentry                   *mds_fids_dir;
         int                              mds_lmv_connected;
         struct dentry                   *mds_unnamed_dir; /* for mdt_obd_create only */
 };
@@ -429,55 +426,54 @@ struct ost_obd {
 };
 
 struct echo_client_obd {
-        struct obd_export      *ec_exp;   /* the local connection to osc/lov */
-        spinlock_t              ec_lock;
-        struct list_head        ec_objects;
-        int                     ec_nstripes;
-        __u64                   ec_unique;
+        struct obd_export   *ec_exp;   /* the local connection to osc/lov */
+        spinlock_t           ec_lock;
+        struct list_head     ec_objects;
+        int                  ec_nstripes;
+        __u64                ec_unique;
 };
 
 struct cache_obd {
-        struct obd_export      *master_exp; /* local connection to master obd */
-        struct obd_export      *cache_exp;  /* local connection to cache obd */
-        char                   *master_name;
-        char                   *cache_name;
-        int                     refcount;
-        int                     cache_on;
+        struct obd_export *cobd_real_exp;/* local connection to target obd */
+        struct obd_export *cobd_cache_exp; /* local connection to cache obd */
+        char   *cobd_real_name;
+        char   *cobd_cache_name;
+        int    refcount;
+        int    cache_on;
 };
 
 struct lov_tgt_desc {
-        struct obd_uuid         uuid;
-        __u32                   ltd_gen;
-        struct obd_export      *ltd_exp;
-        int                     active;   /* is this target up for requests */
+        struct obd_uuid          uuid;
+        __u32                    ltd_gen;
+        struct obd_export       *ltd_exp;
+        int                      active; /* is this target up for requests */
 };
 
 struct lov_obd {
-        spinlock_t              lov_lock;
-        struct lov_desc         desc;
-        int                     bufsize;
-        int                     refcount;
-        int                     lo_catalog_loaded:1;
-        struct semaphore        lov_llog_sem;
-        unsigned long           lov_connect_flags;
-        struct lov_tgt_desc    *tgts;
+        spinlock_t lov_lock;
+        struct lov_desc desc;
+        struct semaphore lov_llog_sem;
+        int bufsize;
+        int refcount;
+        int lo_catalog_loaded:1;
+        unsigned long lov_connect_flags;
+        struct lov_tgt_desc *tgts;
 };
 
 struct lmv_tgt_desc {
         struct obd_uuid         uuid;
-        struct obd_export      *ltd_exp;
-        int                     active;   /* is this target up for requests */
+        struct obd_export       *ltd_exp;
+        int                      active; /* is this target up for requests */
 };
 
 struct lmv_obd {
-        int                     refcount;
         spinlock_t              lmv_lock;
         struct lmv_desc         desc;
+        int                     bufsize;
+        int                     refcount;
         struct lmv_tgt_desc     *tgts;
         struct obd_uuid         cluuid;
         struct obd_export       *exp;
-
-        int                     tgts_size;
         int                     connected;
         int                     max_easize;
         int                     max_cookiesize;
@@ -496,13 +492,13 @@ struct niobuf_local {
         int rc;
 };
 
-struct cm_obd {
-        struct obd_device      *master_obd;    /* master lov */
-        struct obd_export      *master_exp;
-        struct obd_device      *cache_obd;     /* cache obdfilter */
-        struct obd_export      *cache_exp;
-        int                     master_group;  /* master group*/
-        struct cmobd_write_service *write_srv;
+struct cache_manager_obd {
+        struct obd_device *cm_master_obd;       /* master lov */
+        struct obd_export *cm_master_exp;
+        struct obd_device *cm_cache_obd;        /* cache obdfilter */
+        struct obd_export *cm_cache_exp;
+        int    cm_master_group;                 /* master group*/        
+        struct cmobd_write_service   *cm_write_srv;
 };
         
 
@@ -632,35 +628,34 @@ struct obd_device {
 
 
         union {
-                struct filter_obd        filter;
-                struct mds_obd           mds;
-                struct client_obd        cli;
-                struct ost_obd           ost;
-                struct echo_client_obd   echo_client;
-                struct echo_obd          echo;
-                struct recovd_obd        recovd;
-                struct lov_obd           lov;
-                struct cache_obd         cobd;
-                struct ptlbd_obd         ptlbd;
-                struct mgmtcli_obd       mgmtcli;
-                struct lmv_obd           lmv;
-                struct cm_obd            cm;
+                struct filter_obd filter;
+                struct mds_obd mds;
+                struct client_obd cli;
+                struct ost_obd ost;
+                struct echo_client_obd echo_client;
+                struct echo_obd echo;
+                struct recovd_obd recovd;
+                struct lov_obd lov;
+                struct cache_obd cobd;
+                struct ptlbd_obd ptlbd;
+                struct mgmtcli_obd mgmtcli;
+                struct lmv_obd lmv;
+                struct cache_manager_obd cmobd;
         } u;
-        
-        /* fields used by LProcFS */
+       /* Fields used by LProcFS */
         unsigned int           obd_cntr_base;
         struct lprocfs_stats  *obd_stats;
         struct proc_dir_entry *obd_svc_procroot;
         struct lprocfs_stats  *obd_svc_stats;
 };
 
-#define OBD_OPT_FORCE             (1 << 0)
-#define OBD_OPT_FAILOVER          (1 << 1)
-#define OBD_OPT_REAL_CLIENT       (1 << 2)
-#define OBD_OPT_MDS_CONNECTION    (1 << 3)
+#define OBD_OPT_FORCE           0x0001
+#define OBD_OPT_FAILOVER        0x0002
+#define OBD_OPT_REAL_CLIENT     0x0004
+#define OBD_OPT_MDS_CONNECTION  0x0008
 
-#define OBD_LLOG_FL_SENDNOW       (1 << 0)
-#define OBD_LLOG_FL_CREATE        (1 << 1)
+#define OBD_LLOG_FL_SENDNOW     0x0001
+#define OBD_LLOG_FL_CREATE      0x0002
 
 struct mdc_op_data;
 
@@ -810,11 +805,6 @@ struct obd_ops {
 
         int (*o_notify)(struct obd_device *obd, struct obd_device *watched,
                         int active, void *data);
-
-        /* this method is needed for cmobd to make say to LMV "get ready" when
-         * master obd is LMV. This is needed, because LMV is initialized in
-         * "defered" manner to let all MDSs to be set up first. */
-        int (*o_getready)(struct obd_export *exp);
         int (*o_init_ea_size)(struct obd_export *, int, int);
 
         /* 
@@ -825,11 +815,11 @@ struct obd_ops {
 };
 
 struct md_ops {
-        int (*m_getstatus)(struct obd_export *, struct lustre_id *);
-        int (*m_change_cbdata)(struct obd_export *, struct lustre_id *,
+        int (*m_getstatus)(struct obd_export *, struct ll_fid *);
+        int (*m_change_cbdata)(struct obd_export *, struct ll_fid *,
                                ldlm_iterator_t, void *);
-        int (*m_change_cbdata_name)(struct obd_export *, struct lustre_id *,
-                                    char *, int, struct lustre_id *,
+        int (*m_change_cbdata_name)(struct obd_export *, struct ll_fid *,
+                                    char *, int, struct ll_fid *,
                                     ldlm_iterator_t, void *);
         int (*m_close)(struct obd_export *, struct obdo *,
                        struct obd_client_handle *,
@@ -842,15 +832,15 @@ struct md_ops {
                          int, struct mdc_op_data *, struct lustre_handle *,
                          void *, int, ldlm_completion_callback,
                          ldlm_blocking_callback, void *);
-        int (*m_getattr)(struct obd_export *, struct lustre_id *,
+        int (*m_getattr)(struct obd_export *, struct ll_fid *,
                          unsigned long, unsigned int,
                          struct ptlrpc_request **);
-        int (*m_getattr_name)(struct obd_export *, struct lustre_id *,
+        int (*m_getattr_name)(struct obd_export *, struct ll_fid *,
                               char *, int, unsigned long,
                               unsigned int, struct ptlrpc_request **);
         int (*m_intent_lock)(struct obd_export *,
-                             struct lustre_id *, const char *, int,
-                             void *, int, struct lustre_id *,
+                             struct ll_fid *, const char *, int,
+                             void *, int, struct ll_fid *,
                              struct lookup_intent *, int,
                              struct ptlrpc_request **,
                              ldlm_blocking_callback);
@@ -862,14 +852,13 @@ struct md_ops {
         int (*m_setattr)(struct obd_export *, struct mdc_op_data *,
                          struct iattr *, void *, int , void *, int,
                          struct ptlrpc_request **);
-        int (*m_sync)(struct obd_export *, struct lustre_id *,
+        int (*m_sync)(struct obd_export *, struct ll_fid *,
                       struct ptlrpc_request **);
-        int (*m_readpage)(struct obd_export *, struct lustre_id *,
+        int (*m_readpage)(struct obd_export *, struct ll_fid *,
                           __u64, struct page *, struct ptlrpc_request **);
         int (*m_unlink)(struct obd_export *, struct mdc_op_data *,
                         struct ptlrpc_request **);
-        int (*m_valid_attrs)(struct obd_export *, struct lustre_id *);
-        
+        int (*m_valid_attrs)(struct obd_export *, struct ll_fid *);
         struct obd_device * (*m_get_real_obd)(struct obd_export *,
                              char *name, int len);
         
@@ -886,26 +875,24 @@ struct md_ops {
                                         int repoff);
         int (*m_set_lock_data)(struct obd_export *exp, __u64 *l, void *data);
 
-        int (*m_delete_object)(struct obd_export *, struct lustre_id *);
-
-        /* NOTE: If adding ops, add another LPROCFS_OBD_OP_INIT() line to
-         * lprocfs_alloc_obd_stats() in obdclass/lprocfs_status.c. Also, add a
-         * wrapper function in include/linux/obd_class.h.
+        int (*m_delete_object)(struct obd_export *, struct ll_fid *);
+        /* 
+         * NOTE: If adding ops, add another LPROCFS_OBD_OP_INIT() line
+         * to lprocfs_alloc_obd_stats() in obdclass/lprocfs_status.c.
+         * Also, add a wrapper function in include/linux/obd_class.h.
          */
 };
 
-static inline void obd_transno_commit_cb(struct obd_device *obd,
-                                         __u64 transno, int error)
+static inline void obd_transno_commit_cb(struct obd_device *obd, __u64 transno,
+                                         int error)
 {
         if (error) {
                 CERROR("%s: transno "LPD64" commit error: %d\n",
                        obd->obd_name, transno, error);
                 return;
         }
-        
         CDEBUG(D_HA, "%s: transno "LPD64" committed\n",
                obd->obd_name, transno);
-
         if (transno > obd->obd_last_committed) {
                 obd->obd_last_committed = transno;
                 ptlrpc_commit_replies (obd);
index 0c30089..dd05896 100644 (file)
@@ -99,9 +99,9 @@ int class_config_dump_llog(struct llog_ctxt *ctxt, char *name,
 
 struct lustre_profile {
         struct list_head lp_list;
-        char *lp_profile;
-        char *lp_lov;
-        char *lp_lmv;
+        char * lp_profile;
+        char * lp_osc;
+        char * lp_mdc;
 };
 
 struct lustre_profile *class_get_profile(char * prof);
@@ -141,7 +141,6 @@ do {                                                                           \
         LASSERT(atomic_read(&(exp)->exp_refcount) < 0x5a5a5a);                 \
         __class_export_put(exp);                                               \
 } while (0)
-
 void __class_export_put(struct obd_export *);
 struct obd_export *class_new_export(struct obd_device *obddev);
 void class_unlink_export(struct obd_export *exp);
@@ -155,10 +154,9 @@ struct obd_type *class_get_type(char *name);
 void class_put_type(struct obd_type *type);
 int class_connect(struct lustre_handle *conn, struct obd_device *obd,
                   struct obd_uuid *cluuid);
-int class_disconnect(struct obd_export *exp, int flags);
-void class_disconnect_exports(struct obd_device *obddev, int flags);
-void class_disconnect_stale_exports(struct obd_device *obddev, int flags);
-
+int class_disconnect(struct obd_export *exp, int failover);
+void class_disconnect_exports(struct obd_device *obddev, int failover);
+void class_disconnect_stale_exports(struct obd_device *obddev, int failover);
 /* generic operations shared by various OBD types */
 int class_multi_setup(struct obd_device *obddev, uint32_t len, void *data);
 int class_multi_cleanup(struct obd_device *obddev);
@@ -700,17 +698,6 @@ static inline int obd_disconnect(struct obd_export *exp, int flags)
         RETURN(rc);
 }
 
-static inline int obd_getready(struct obd_export *exp)
-{
-        int rc;
-        ENTRY;
-
-        if (!OBP(exp->exp_obd, getready))
-                RETURN(0);
-        rc = OBP(exp->exp_obd, getready)(exp);
-        RETURN(rc);
-}
-
 static inline int obd_init_export(struct obd_export *exp)
 {
         int rc = 0;
@@ -732,13 +719,12 @@ static inline int obd_destroy_export(struct obd_export *exp)
 }
 
 static inline struct dentry *
-obd_lvfs_id2dentry(struct obd_export *exp, __u64 ino, 
-                   __u32 gen, __u64 gr)
+obd_lvfs_fid2dentry(struct obd_export *exp, __u64 id_ino, __u32 gen, __u64 gr)
 {
         LASSERT(exp->exp_obd);
 
-        return lvfs_id2dentry(&exp->exp_obd->obd_lvfs_ctxt, 
-                              ino, gen, gr, exp->exp_obd);
+        return lvfs_fid2dentry(&exp->exp_obd->obd_lvfs_ctxt, id_ino, gen, gr,
+                               exp->exp_obd);
 }
 
 #ifndef time_before
@@ -1202,21 +1188,20 @@ static inline int obd_init_ea_size(struct obd_export *exp, int size, int size2)
         rc = OBP(exp->exp_obd, init_ea_size)(exp, size, size2);
         RETURN(rc);
 }
-
-static inline int md_getstatus(struct obd_export *exp, struct lustre_id *id)
+static inline int md_getstatus(struct obd_export *exp, struct ll_fid *fid)
 {
         int rc;
 
         EXP_CHECK_MD_OP(exp, getstatus);
         MD_COUNTER_INCREMENT(exp->exp_obd, getstatus);
-        rc = MDP(exp->exp_obd, getstatus)(exp, id);
+        rc = MDP(exp->exp_obd, getstatus)(exp, fid);
         RETURN(rc);
 }
 
-/* this function notifies MDC, that inode described by @id gets removed from
+/* this function notifies MDC, that inode described by @fid gets removed from
  * memory.*/
 static inline int md_delete_object(struct obd_export *exp,
-                                   struct lustre_id *id)
+                                   struct ll_fid *fid)
 {
         int rc;
         ENTRY;
@@ -1228,11 +1213,11 @@ static inline int md_delete_object(struct obd_export *exp,
                 RETURN(0);
         
         MD_COUNTER_INCREMENT(exp->exp_obd, delete_object);
-        rc = MDP(exp->exp_obd, delete_object)(exp, id);
+        rc = MDP(exp->exp_obd, delete_object)(exp, fid);
         RETURN(rc);
 }
 
-static inline int md_getattr(struct obd_export *exp, struct lustre_id *id,
+static inline int md_getattr(struct obd_export *exp, struct ll_fid *fid,
                              unsigned long valid, unsigned int ea_size,
                              struct ptlrpc_request **request)
 {
@@ -1240,24 +1225,24 @@ static inline int md_getattr(struct obd_export *exp, struct lustre_id *id,
         ENTRY;
         EXP_CHECK_MD_OP(exp, getattr);
         MD_COUNTER_INCREMENT(exp->exp_obd, getattr);
-        rc = MDP(exp->exp_obd, getattr)(exp, id, valid, ea_size, request);
+        rc = MDP(exp->exp_obd, getattr)(exp, fid, valid, ea_size, request);
         RETURN(rc);
 }
 
-static inline int md_change_cbdata(struct obd_export *exp, struct lustre_id *id,
+static inline int md_change_cbdata(struct obd_export *exp, struct ll_fid *fid,
                                    ldlm_iterator_t it, void *data)
 {
         int rc;
         ENTRY;
         EXP_CHECK_MD_OP(exp, change_cbdata);
         MD_COUNTER_INCREMENT(exp->exp_obd, change_cbdata);
-        rc = MDP(exp->exp_obd, change_cbdata)(exp, id, it, data);
+        rc = MDP(exp->exp_obd, change_cbdata)(exp, fid, it, data);
         RETURN(rc);
 }
 
 static inline int md_change_cbdata_name(struct obd_export *exp,
-                                        struct lustre_id *id, char *name,
-                                        int namelen, struct lustre_id *id2,
+                                        struct ll_fid *fid, char *name,
+                                        int namelen, struct ll_fid *fid2,
                                         ldlm_iterator_t it, void *data)
 {
         int rc;
@@ -1269,8 +1254,8 @@ static inline int md_change_cbdata_name(struct obd_export *exp,
         ENTRY;
                 
         MD_COUNTER_INCREMENT(exp->exp_obd, change_cbdata_name);
-        rc = MDP(exp->exp_obd, change_cbdata_name)(exp, id, name, namelen,
-                                                   id2, it, data);
+        rc = MDP(exp->exp_obd, change_cbdata_name)(exp, fid, name, namelen,
+                                                   fid2, it, data);
         RETURN(rc);
 }
 
@@ -1330,7 +1315,7 @@ static inline int md_enqueue(struct obd_export *exp, int lock_type,
         RETURN(rc);
 }
 
-static inline int md_getattr_name(struct obd_export *exp, struct lustre_id *id,
+static inline int md_getattr_name(struct obd_export *exp, struct ll_fid *fid,
                                   char *filename, int namelen,
                                   unsigned long valid, unsigned int ea_size,
                                   struct ptlrpc_request **request)
@@ -1339,15 +1324,15 @@ static inline int md_getattr_name(struct obd_export *exp, struct lustre_id *id,
         ENTRY;
         EXP_CHECK_MD_OP(exp, getattr_name);
         MD_COUNTER_INCREMENT(exp->exp_obd, getattr_name);
-        rc = MDP(exp->exp_obd, getattr_name)(exp, id, filename, namelen,
+        rc = MDP(exp->exp_obd, getattr_name)(exp, fid, filename, namelen,
                                              valid, ea_size, request);
         RETURN(rc);
 }
 
 static inline int md_intent_lock(struct obd_export *exp,
-                                 struct lustre_id *pid, const char *name,
+                                 struct ll_fid *pfid, const char *name,
                                  int len, void *lmm, int lmmsize,
-                                 struct lustre_id *cid, struct lookup_intent *it,
+                                 struct ll_fid *cfid, struct lookup_intent *it,
                                  int flags, struct ptlrpc_request **reqp,
                                  ldlm_blocking_callback cb_blocking)
 {
@@ -1355,8 +1340,8 @@ static inline int md_intent_lock(struct obd_export *exp,
         ENTRY;
         EXP_CHECK_MD_OP(exp, intent_lock);
         MD_COUNTER_INCREMENT(exp->exp_obd, intent_lock);
-        rc = MDP(exp->exp_obd, intent_lock)(exp, pid, name, len,
-                                            lmm, lmmsize, cid, it, flags,
+        rc = MDP(exp->exp_obd, intent_lock)(exp, pfid, name, len,
+                                            lmm, lmmsize, cfid, it, flags,
                                             reqp, cb_blocking);
         RETURN(rc);
 }
@@ -1400,18 +1385,18 @@ static inline int md_setattr(struct obd_export *exp, struct mdc_op_data *data,
         RETURN(rc);
 }
 
-static inline int md_sync(struct obd_export *exp, struct lustre_id *id,
+static inline int md_sync(struct obd_export *exp, struct ll_fid *fid,
                                struct ptlrpc_request **request)
 {
         int rc;
         ENTRY;
         EXP_CHECK_MD_OP(exp, sync);
         MD_COUNTER_INCREMENT(exp->exp_obd, sync);
-        rc = MDP(exp->exp_obd, sync)(exp, id, request);
+        rc = MDP(exp->exp_obd, sync)(exp, fid, request);
         RETURN(rc);
 }
 
-static inline int md_readpage(struct obd_export *exp, struct lustre_id *id,
+static inline int md_readpage(struct obd_export *exp, struct ll_fid *fid,
                               __u64 offset, struct page *page,
                               struct ptlrpc_request **request)
 {
@@ -1419,7 +1404,7 @@ static inline int md_readpage(struct obd_export *exp, struct lustre_id *id,
         ENTRY;
         EXP_CHECK_MD_OP(exp, readpage);
         MD_COUNTER_INCREMENT(exp->exp_obd, readpage);
-        rc = MDP(exp->exp_obd, readpage)(exp, id, offset, page, request);
+        rc = MDP(exp->exp_obd, readpage)(exp, fid, offset, page, request);
         RETURN(rc);
 }
 
@@ -1444,13 +1429,12 @@ static inline struct obd_device *md_get_real_obd(struct obd_export *exp,
         return MDP(exp->exp_obd, get_real_obd)(exp, name, len);
 }
 
-static inline int md_valid_attrs(struct obd_export *exp,
-                                 struct lustre_id *id)
+static inline int md_valid_attrs(struct obd_export *exp, struct ll_fid *fid)
 {
         ENTRY;
         EXP_CHECK_MD_OP(exp, valid_attrs);
         MD_COUNTER_INCREMENT(exp->exp_obd, valid_attrs);
-        return MDP(exp->exp_obd, valid_attrs)(exp, id);
+        return MDP(exp->exp_obd, valid_attrs)(exp, fid);
 }
 
 static inline int md_req2lustre_md(struct obd_export *exp,
@@ -1495,8 +1479,7 @@ static inline int md_store_inode_generation(struct obd_export *exp,
                    reqoff, repoff);
 }
 
-static inline int md_set_lock_data(struct obd_export *exp, __u64 *l,
-                                   void *data)
+static inline int md_set_lock_data(struct obd_export *exp, __u64 *l, void *data)
 {
         ENTRY;
         EXP_CHECK_MD_OP(exp, set_lock_data);
index ad5d653..a3dc652 100644 (file)
@@ -7,4 +7,5 @@
 
 #define OBD_LMV_DEVICENAME "lmv"
 
+
 #endif
diff --git a/lustre/kernel_patches/patches/ext3-dentry-fid.patch b/lustre/kernel_patches/patches/ext3-dentry-fid.patch
deleted file mode 100644 (file)
index 0aa7916..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-diff -rupN linux-2.4.24.orig/fs/ext3/namei.c linux-2.4.24/fs/ext3/namei.c
---- linux-2.4.24.orig/fs/ext3/namei.c  Tue Oct  5 10:34:28 2004
-+++ linux-2.4.24/fs/ext3/namei.c       Tue Oct  5 10:43:12 2004
-@@ -1112,6 +1112,7 @@ static struct dentry *ext3_lookup(struct
-                       dentry->d_flags |= DCACHE_CROSS_REF;
-                       dentry->d_generation = mds[1];
-                       dentry->d_mdsnum = mds[0];
-+                      dentry->d_fid = mds[2];
-                       dentry->d_inum = ino;
-                       d_add(dentry, NULL);
-                       return NULL;
-@@ -1334,7 +1335,8 @@ static int add_dirent_to_buf(handle_t *h
-       if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_MDSNUM)
-                       && (dentry->d_flags & DCACHE_CROSS_REF)
-                       && (dentry->d_mdsnum != EXT3_SB(sb)->s_mdsnum))
--              reclen += 8; /* we need space to store mds num */
-+              reclen += 12; /* we need space to store mds num, 
-+                               * inode num and fid num. */
-       if (!de) {
-               de = (struct ext3_dir_entry_2 *)bh->b_data;
-               top = bh->b_data + dir->i_sb->s_blocksize - reclen;
-@@ -1387,6 +1389,7 @@ static int add_dirent_to_buf(handle_t *h
-                       mds = (__u32 *)((char *)de + EXT3_DIR_REC_LEN(namelen));
-                       mds[0] = cpu_to_le32(dentry->d_mdsnum);
-                       mds[1] = cpu_to_le32(dentry->d_generation);
-+                      mds[2] = cpu_to_le32(dentry->d_fid);
-                       de->inode = cpu_to_le32(dentry->d_inum);
-                       de->file_type = 128;
-               } else {
-diff -rupN linux-2.4.24.orig/include/linux/dcache.h linux-2.4.24/include/linux/dcache.h
---- linux-2.4.24.orig/include/linux/dcache.h   Tue Oct  5 10:34:28 2004
-+++ linux-2.4.24/include/linux/dcache.h        Tue Oct  5 10:43:45 2004
-@@ -123,6 +123,7 @@ struct dentry {
-       unsigned d_inum;                /* for cross-fs references (Lustre) */
-       unsigned d_mdsnum;              /* for cross-fs references (Lustre) */
-       unsigned d_generation;          /* for cross-fs references (Lustre) */
-+        unsigned d_fid;                 /* for cross-fs references (Lustre) */
-       struct dentry * d_parent;       /* parent directory */
-       struct list_head d_hash;        /* lookup hash list */
-       struct list_head d_lru;         /* d_count = 0 LRU list */
-diff -rupN linux-2.4.24.orig/include/linux/ext3_fs.h linux-2.4.24/include/linux/ext3_fs.h
---- linux-2.4.24.orig/include/linux/ext3_fs.h  Tue Oct  5 10:34:28 2004
-+++ linux-2.4.24/include/linux/ext3_fs.h       Tue Oct  5 10:44:29 2004
-@@ -589,7 +589,7 @@ struct ext3_dir_entry_2 {
- #define EXT3_DIR_REC_LEN(name_len)    (((name_len) + 8 + EXT3_DIR_ROUND) & \
-                                        ~EXT3_DIR_ROUND)
- #define EXT3_DIR_REC_LEN_DE(de)               (EXT3_DIR_REC_LEN((de)->name_len) + \
--                                      (((de)->file_type & 128) ? 8 : 0))
-+                                      (((de)->file_type & 128) ? 12 : 0))
- /*
-  * Hash Tree Directory indexing
index 75d4767..c47d1ac 100644 (file)
@@ -170,7 +170,7 @@ Index: linux-2.4.24-b1_4/include/linux/kallsyms.h
 +   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 + */
 +
-+#ident "$Id: kksymoops-2.4.24.vanilla.patch,v 1.8 2004/10/24 16:10:34 yury Exp $"
++#ident "$Id: kksymoops-2.4.24.vanilla.patch,v 1.9 2004/10/24 17:00:18 yury Exp $"
 +
 +#ifndef MODUTILS_KALLSYMS_H
 +#define MODUTILS_KALLSYMS_H 1
index ff01c9c..fd99cca 100644 (file)
@@ -50,4 +50,3 @@ ext3-inode-reuse-2.4.24.patch
 export-zap-page-range-2.4.24.patch
 export_num_siblings-2.4.24.patch
 ext3-nlinks-2.4.24.patch
-ext3-dentry-fid.patch
index 73e3ece..d0e2466 100644 (file)
@@ -417,7 +417,7 @@ out_sem:
         return rc;
 }
 
-int client_disconnect_export(struct obd_export *exp, int flags)
+int client_disconnect_export(struct obd_export *exp, int failover)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct client_obd *cli = &obd->u.cli;
@@ -810,7 +810,6 @@ static void target_release_saved_req(struct ptlrpc_request *req)
         OBD_FREE(req, sizeof *req);
 }
 
-#ifdef __KERNEL__
 static void target_finish_recovery(struct obd_device *obd)
 {
         struct list_head *tmp, *n;
@@ -866,8 +865,6 @@ static void abort_recovery_queue(struct obd_device *obd)
                 target_release_saved_req(req);
         }
 }
-#endif
-
 /* Called from a cleanup function if the device is being cleaned up
    forcefully.  The exports should all have been disconnected already,
    the only thing left to do is
@@ -907,7 +904,6 @@ void target_cleanup_recovery(struct obd_device *obd)
          }
 }
 
-#ifdef __KERNEL__
 static void target_abort_recovery(void *data)
 {
         struct obd_device *obd = data;
@@ -923,7 +919,6 @@ static void target_abort_recovery(void *data)
         target_finish_recovery(obd);
         ptlrpc_run_recovery_over_upcall(obd);
 }
-#endif
 
 static void target_recovery_expired(unsigned long castmeharder)
 {
@@ -945,7 +940,6 @@ void target_cancel_recovery_timer(struct obd_device *obd)
         del_timer(&obd->obd_recovery_timer);
 }
 
-#ifdef __KERNEL__
 static void reset_recovery_timer(struct obd_device *obd)
 {
         spin_lock_bh(&obd->obd_processing_task_lock);
@@ -958,7 +952,7 @@ static void reset_recovery_timer(struct obd_device *obd)
         mod_timer(&obd->obd_recovery_timer, jiffies + OBD_RECOVERY_TIMEOUT);
         spin_unlock_bh(&obd->obd_processing_task_lock);
 }
-#endif
+
 
 /* Only start it the first time called */
 void target_start_recovery_timer(struct obd_device *obd)
@@ -976,7 +970,6 @@ void target_start_recovery_timer(struct obd_device *obd)
         spin_unlock_bh(&obd->obd_processing_task_lock);
 }
 
-#ifdef __KERNEL__
 static int check_for_next_transno(struct obd_device *obd)
 {
         struct ptlrpc_request *req = NULL;
@@ -1050,6 +1043,7 @@ target_next_replay_req(struct obd_device *obd)
         return req;
 }
 
+#ifdef __KERNEL__
 static int target_recovery_thread(void *arg)
 {
         struct obd_device *obd = arg;
@@ -1144,7 +1138,6 @@ void target_stop_recovery_thread(struct obd_device *obd)
         }
 }
 #endif
-
 int target_queue_recovery_request(struct ptlrpc_request *req,
                                   struct obd_device *obd)
 {
index b50e458..3b9b0f6 100644 (file)
@@ -51,7 +51,7 @@ static int llu_dir_do_readpage(struct inode *inode, struct page *page)
 {
         struct llu_inode_info *lli = llu_i2info(inode);
         struct llu_sb_info *sbi = llu_i2sbi(inode);
-        struct lustre_id id;
+        struct ll_fid mdc_fid;
         __u64 offset;
         int rc = 0;
         struct ptlrpc_request *request;
@@ -59,18 +59,18 @@ static int llu_dir_do_readpage(struct inode *inode, struct page *page)
         struct mds_body *body;
         struct lookup_intent it = { .it_op = IT_READDIR };
         struct mdc_op_data data;
-        struct obd_device *obddev = class_exp2obd(sbi->ll_lmv_exp);
+        struct obd_device *obddev = class_exp2obd(sbi->ll_mdc_exp);
         struct ldlm_res_id res_id =
-                { .name = {id_fid(&lli->lli_id), id_group(&lli->lli_id)} };
+                { .name = {lli->lli_st_ino, (__u64)lli->lli_st_generation} };
         ldlm_policy_data_t policy = { .l_inodebits = { MDS_INODELOCK_UPDATE } };
         ENTRY;
 
         rc = ldlm_lock_match(obddev->obd_namespace, LDLM_FL_BLOCK_GRANTED,
                              &res_id, LDLM_IBITS, &policy, LCK_PR, &lockh);
         if (!rc) {
-                llu_prepare_mdc_data(&data, inode, NULL, NULL, 0, 0);
+                llu_prepare_mdc_op_data(&data, inode, NULL, NULL, 0, 0);
 
-                rc = mdc_enqueue(sbi->ll_lmv_exp, LDLM_IBITS, &it, LCK_PR,
+                rc = mdc_enqueue(sbi->ll_mdc_exp, LDLM_IBITS, &it, LCK_PR,
                                  &data, &lockh, NULL, 0,
                                  ldlm_completion_ast, llu_mdc_blocking_ast,
                                  inode);
@@ -84,12 +84,11 @@ static int llu_dir_do_readpage(struct inode *inode, struct page *page)
         }
         ldlm_lock_dump_handle(D_OTHER, &lockh);
 
-        /* FIXME-UMKA: should be here some mds num and mds id? */
-        mdc_pack_id(&id, lli->lli_st_ino, lli->lli_st_generation, 
-                    S_IFDIR, 0, 0);
+        mdc_pack_fid(&mdc_fid, lli->lli_st_ino, lli->lli_st_generation, S_IFDIR);
 
         offset = page->index << PAGE_SHIFT;
-        rc = mdc_readpage(sbi->ll_lmv_exp, &id, offset, page, &request);
+        rc = mdc_readpage(sbi->ll_mdc_exp, &mdc_fid,
+                          offset, page, &request);
         if (!rc) {
                 body = lustre_msg_buf(request->rq_repmsg, 0, sizeof (*body));
                 LASSERT (body != NULL);         /* checked by mdc_readpage() */
index 78b9202..0ceefdb 100644 (file)
 
 #include "llite_lib.h"
 
-void llu_prepare_mdc_data(struct mdc_op_data *data, struct inode *i1,
-                          struct inode *i2, const char *name,
-                          int namelen, int mode)
+void llu_prepare_mdc_op_data(struct mdc_op_data *data,
+                             struct inode *i1,
+                             struct inode *i2,
+                             const char *name,
+                             int namelen,
+                             int mode)
 {
         LASSERT(i1);
         
-        ll_inode2id(&data->id1, i1);
-        if (i2)
-                ll_inode2id(&data->id2, i2);
+        ll_i2uctxt(&data->ctxt, i1, i2);
+        ll_inode2fid(&data->fid1, i1);
+
+        if (i2) {
+                ll_inode2fid(&data->fid2, i2);
+        }
 
-       data->valid = 0;
         data->name = name;
         data->namelen = namelen;
         data->create_mode = mode;
@@ -340,7 +345,7 @@ int llu_file_release(struct inode *inode)
         if (!fd) /* no process opened the file after an mcreate */
                 RETURN(0);
 
-        rc2 = llu_mdc_close(sbi->ll_lmv_exp, inode);
+        rc2 = llu_mdc_close(sbi->ll_mdc_exp, inode);
         if (rc2 && !rc)
                 rc = rc2;
 
index bf006fa..88c92d1 100644 (file)
@@ -99,7 +99,7 @@ int liblustre_process_log(struct config_llog_instance *cfg, int allow_recov)
                 CERROR("Can't parse NAL %s\n", LIBLUSTRE_NAL_NAME);
                 RETURN(-EINVAL);
         }
-        LCFG_INIT(lcfg, LCFG_ADD_UUID, name);
+        LCFG_INIT(lcfg, LCFG_ADD_UUID, NULL);
         lcfg.lcfg_nid = nid;
         lcfg.lcfg_inllen1 = strlen(peer) + 1;
         lcfg.lcfg_inlbuf1 = peer;
@@ -146,8 +146,9 @@ int liblustre_process_log(struct config_llog_instance *cfg, int allow_recov)
         
         ctxt = exp->exp_obd->obd_llog_ctxt[LLOG_CONFIG_REPL_CTXT];
         rc = class_config_process_llog(ctxt, g_zconf_profile, cfg);
-        if (rc)
-                CERROR("class_config_process_llog failed: rc = %d\n", rc);
+        if (rc) {
+                CERROR("class_config_parse_llog failed: rc = %d\n", rc);
+        }
 
         err = obd_disconnect(exp, 0);
 
index 34f1fea..6c0c61d 100644 (file)
@@ -45,8 +45,8 @@ struct ll_file_data {
 struct llu_sb_info
 {
         struct obd_uuid         ll_sb_uuid;
-        struct obd_export      *ll_lmv_exp;
-        struct obd_export      *ll_lov_exp;
+        struct obd_export      *ll_mdc_exp;
+        struct obd_export      *ll_osc_exp;
         obd_id                  ll_rootino;
         int                     ll_flags;
         struct list_head        ll_conn_chain;
@@ -65,7 +65,7 @@ struct llu_sb_info
 
 struct llu_inode_info {
         struct llu_sb_info     *lli_sbi;
-        struct lustre_id        lli_id;
+        struct ll_fid           lli_fid;
 
         struct lov_stripe_md   *lli_smd;
         char                   *lli_symlink_name;
@@ -81,9 +81,10 @@ struct llu_inode_info {
         /* XXX workaround for libsysio readdir */
         loff_t                  lli_dir_pos;
 
-        /* in libsysio we have no chance to store data in file, so place it
-         * here. since it's possible that an file was opened several times
-         * without close, we track an open_count here */
+        /* in libsysio we have no chance to store data in file,
+         * so place it here. since it's possible that an file
+         * was opened several times without close, we track an
+         * open_count here */
         struct ll_file_data    *lli_file_data;
         int                     lli_open_flags;
         int                     lli_open_count;
@@ -125,17 +126,17 @@ static inline struct llu_sb_info *llu_i2sbi(struct inode *inode)
 
 static inline struct obd_export *llu_i2obdexp(struct inode *inode)
 {
-        return llu_i2info(inode)->lli_sbi->ll_lov_exp;
+        return llu_i2info(inode)->lli_sbi->ll_osc_exp;
 }
 
 static inline struct obd_export *llu_i2mdcexp(struct inode *inode)
 {
-        return llu_i2info(inode)->lli_sbi->ll_lmv_exp;
+        return llu_i2info(inode)->lli_sbi->ll_mdc_exp;
 }
 
 static inline int llu_is_root_inode(struct inode *inode)
 {
-        return (llu_i2info(inode)->lli_id.li_stc.u.e3s.l3s_ino ==
+        return (llu_i2info(inode)->lli_fid.id ==
                 llu_i2info(inode)->lli_sbi->ll_rootino);
 }
 
@@ -165,18 +166,17 @@ do {                                                                           \
 #define LL_LOOKUP_POSITIVE 1
 #define LL_LOOKUP_NEGATIVE 2
 
+static inline void ll_inode2fid(struct ll_fid *fid, struct inode *inode)
+{
+        *fid = llu_i2info(inode)->lli_fid;
+}
+
 struct it_cb_data {
         struct inode *icbd_parent;
         struct pnode *icbd_child;
         obd_id hash;
 };
 
-static inline void ll_inode2id(struct lustre_id *id,
-                               struct inode *inode)
-{
-        *id = llu_i2info(inode)->lli_id;
-}
-
 typedef int (*intent_finish_cb)(struct ptlrpc_request *,
                                 struct inode *parent, struct pnode *pnode, 
                                 struct lookup_intent *, int offset, obd_id ino);
@@ -221,10 +221,12 @@ int llu_setattr_raw(struct inode *inode, struct iattr *attr);
 extern struct fssw_ops llu_fssw_ops;
 
 /* file.c */
-void llu_prepare_mdc_data(struct mdc_op_data *data, struct inode *i1,
-                          struct inode *i2, const char *name, int namelen,
-                          int mode);
-                          
+void llu_prepare_mdc_op_data(struct mdc_op_data *data,
+                             struct inode *i1,
+                             struct inode *i2,
+                             const char *name,
+                             int namelen,
+                             int mode);
 int llu_create(struct inode *dir, struct pnode_base *pnode, int mode);
 int llu_iop_open(struct pnode *pnode, int flags, mode_t mode);
 int llu_mdc_close(struct obd_export *mdc_exp, struct inode *inode);
index 04606fd..2a7c5e0 100644 (file)
@@ -148,15 +148,15 @@ int llu_mdc_blocking_ast(struct ldlm_lock *lock,
                 if (inode == NULL)
                         break;
 
-                lli = llu_i2info(inode);
+                lli =  llu_i2info(inode);
 
                 if (bits & MDS_INODELOCK_UPDATE)
                         clear_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &lli->lli_flags);
 
-                if (lock->l_resource->lr_name.name[0] != id_fid(&lli->lli_id) ||
-                    lock->l_resource->lr_name.name[1] != id_group(&lli->lli_id)) {
-                        LDLM_ERROR(lock, "data mismatch with object "DLID4,
-                                   OLID4(&lli->lli_id));
+                if (lock->l_resource->lr_name.name[0] != lli->lli_st_ino ||
+                    lock->l_resource->lr_name.name[1] != lli->lli_st_generation) {
+                        LDLM_ERROR(lock, "data mismatch with ino %lu/%lu",
+                                   lli->lli_st_ino, lli->lli_st_generation);
                 }
                 if (S_ISDIR(lli->lli_st_mode) &&
                     (bits & MDS_INODELOCK_UPDATE)) {
@@ -166,6 +166,11 @@ int llu_mdc_blocking_ast(struct ldlm_lock *lock,
                         llu_invalidate_inode_pages(inode);
                 }
 
+/*
+                if (inode->i_sb->s_root &&
+                    inode != inode->i_sb->s_root->d_inode)
+                        ll_unhash_aliases(inode);
+*/
                 I_RELE(inode);
                 break;
         }
@@ -194,8 +199,8 @@ static int pnode_revalidate_finish(struct ptlrpc_request *req,
         if (it_disposition(it, DISP_LOOKUP_NEG))
                 RETURN(-ENOENT);
 
-        rc = mdc_req2lustre_md(llu_i2sbi(inode)->ll_lmv_exp, req, offset, 
-                               llu_i2sbi(inode)->ll_lov_exp, &md);
+        rc = mdc_req2lustre_md(llu_i2sbi(inode)->ll_mdc_exp, req, offset, 
+                               llu_i2sbi(inode)->ll_osc_exp, &md);
         if (rc)
                 RETURN(rc);
 
@@ -207,8 +212,9 @@ static int pnode_revalidate_finish(struct ptlrpc_request *req,
 int llu_pb_revalidate(struct pnode *pnode, int flags, struct lookup_intent *it)
 {
         struct pnode_base *pb = pnode->p_base;
-        struct lustre_id pid, cid;
+        struct ll_fid pfid, cfid;
         struct it_cb_data icbd;
+        struct ll_uctxt ctxt;
         struct ptlrpc_request *req = NULL;
         struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
         struct obd_export *exp;
@@ -243,8 +249,8 @@ int llu_pb_revalidate(struct pnode *pnode, int flags, struct lookup_intent *it)
         }
 
         exp = llu_i2mdcexp(pb->pb_ino);
-        ll_inode2id(&pid, pnode->p_parent->p_base->pb_ino);
-        ll_inode2id(&cid, pb->pb_ino);
+        ll_inode2fid(&pfid, pnode->p_parent->p_base->pb_ino);
+        ll_inode2fid(&cfid, pb->pb_ino);
         icbd.icbd_parent = pnode->p_parent->p_base->pb_ino;
         icbd.icbd_child = pnode;
 
@@ -253,8 +259,12 @@ int llu_pb_revalidate(struct pnode *pnode, int flags, struct lookup_intent *it)
                 it->it_op_release = ll_intent_release;
         }
 
-        rc = mdc_intent_lock(exp, &pid, pb->pb_name.name, pb->pb_name.len,
-                             NULL, 0, &cid, it, flags, &req, llu_mdc_blocking_ast);
+        ll_i2uctxt(&ctxt, pnode->p_parent->p_base->pb_ino, pb->pb_ino);
+
+        rc = mdc_intent_lock(exp, &ctxt, &pfid,
+                             pb->pb_name.name, pb->pb_name.len,
+                             NULL, 0, &cfid, it, flags, &req,
+                             llu_mdc_blocking_ast);
         /* If req is NULL, then mdc_intent_lock only tried to do a lock match;
          * if all was well, it will return 1 if it found locks, 0 otherwise. */
         if (req == NULL && rc >= 0)
@@ -330,8 +340,8 @@ static int lookup_it_finish(struct ptlrpc_request *request, int offset,
                 struct llu_inode_info *lli;
                 ENTRY;
 
-                rc = mdc_req2lustre_md(sbi->ll_lmv_exp, request, offset, 
-                                       sbi->ll_lov_exp, &md);
+                rc = mdc_req2lustre_md(sbi->ll_mdc_exp, request, offset, 
+                                       sbi->ll_osc_exp, &md);
                 if (rc)
                         RETURN(rc);
 
@@ -339,11 +349,11 @@ static int lookup_it_finish(struct ptlrpc_request *request, int offset,
                 if (!inode || IS_ERR(inode)) {
                         /* free the lsm if we allocated one above */
                         if (md.lsm != NULL)
-                                obd_free_memmd(sbi->ll_lov_exp, &md.lsm);
+                                obd_free_memmd(sbi->ll_osc_exp, &md.lsm);
                         RETURN(inode ? PTR_ERR(inode) : -ENOMEM);
                 } else if (md.lsm != NULL &&
                            llu_i2info(inode)->lli_smd != md.lsm) {
-                        obd_free_memmd(sbi->ll_lov_exp, &md.lsm);
+                        obd_free_memmd(sbi->ll_osc_exp, &md.lsm);
                 }
 
                 lli = llu_i2info(inode);
@@ -396,7 +406,8 @@ struct inode *llu_inode_from_lock(struct ldlm_lock *lock)
 static int llu_lookup_it(struct inode *parent, struct pnode *pnode,
                          struct lookup_intent *it, int flags)
 {
-        struct lustre_id pid;
+        struct ll_fid pfid;
+        struct ll_uctxt ctxt;
         struct it_cb_data icbd;
         struct ptlrpc_request *req = NULL;
         struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
@@ -414,9 +425,10 @@ static int llu_lookup_it(struct inode *parent, struct pnode *pnode,
         icbd.icbd_child = pnode;
         icbd.icbd_parent = parent;
         icbd.icbd_child = pnode;
-        ll_inode2id(&pid, parent);
+        ll_inode2fid(&pfid, parent);
+        ll_i2uctxt(&ctxt, parent, NULL);
 
-        rc = mdc_intent_lock(llu_i2mdcexp(parent), &pid,
+        rc = mdc_intent_lock(llu_i2mdcexp(parent), &ctxt, &pfid,
                              pnode->p_base->pb_name.name,
                              pnode->p_base->pb_name.len,
                              NULL, 0, NULL, it, flags, &req,
index 15be024..8c4c686 100644 (file)
@@ -32,8 +32,9 @@
 #include <fcntl.h>
 #include <sys/uio.h>
 
-#include <fs.h>
+#include <xtio.h>
 #include <sysio.h>
+#include <fs.h>
 #include <mount.h>
 #include <inode.h>
 #include <file.h>
@@ -223,7 +224,7 @@ int llu_glimpse_size(struct inode *inode)
 
         CDEBUG(D_DLMTRACE, "Glimpsing inode %lu\n", lli->lli_st_ino);
 
-        rc = obd_enqueue(sbi->ll_lov_exp, lli->lli_smd, LDLM_EXTENT, &policy,
+        rc = obd_enqueue(sbi->ll_osc_exp, lli->lli_smd, LDLM_EXTENT, &policy,
                          LCK_PR, &flags, llu_extent_lock_callback,
                          ldlm_completion_ast, llu_glimpse_callback, inode,
                          sizeof(struct ost_lvb), lustre_swab_ost_lvb, &lockh);
@@ -239,7 +240,7 @@ int llu_glimpse_size(struct inode *inode)
         CDEBUG(D_DLMTRACE, "glimpse: size: %llu, blocks: %lu\n",
                lli->lli_st_size, lli->lli_st_blocks);
 
-        obd_cancel(sbi->ll_lov_exp, lli->lli_smd, LCK_PR, &lockh);
+        obd_cancel(sbi->ll_osc_exp, lli->lli_smd, LCK_PR, &lockh);
 
         RETURN(rc);
 }
@@ -264,7 +265,7 @@ int llu_extent_lock(struct ll_file_data *fd, struct inode *inode,
         CDEBUG(D_DLMTRACE, "Locking inode %lu, start "LPU64" end "LPU64"\n",
                lli->lli_st_ino, policy->l_extent.start, policy->l_extent.end);
 
-        rc = obd_enqueue(sbi->ll_lov_exp, lsm, LDLM_EXTENT, policy, mode,
+        rc = obd_enqueue(sbi->ll_osc_exp, lsm, LDLM_EXTENT, policy, mode,
                          &ast_flags, llu_extent_lock_callback,
                          ldlm_completion_ast, llu_glimpse_callback, inode,
                          sizeof(struct ost_lvb), lustre_swab_ost_lvb, lockh);
@@ -293,7 +294,7 @@ int llu_extent_unlock(struct ll_file_data *fd, struct inode *inode,
             (sbi->ll_flags & LL_SBI_NOLCK))
                 RETURN(0);
 
-        rc = obd_cancel(sbi->ll_lov_exp, lsm, mode, lockh);
+        rc = obd_cancel(sbi->ll_osc_exp, lsm, mode, lockh);
 
         RETURN(rc);
 }
index 7b5fc95..028c2c8 100644 (file)
 #include <sys/stat.h>
 #include <sys/fcntl.h>
 #include <sys/queue.h>
-
 #ifndef __CYGWIN__
 # include <sys/statvfs.h>
 #else
 # include <sys/statfs.h>
 #endif
 
-#include <fs.h>
 #include <sysio.h>
+#include <fs.h>
 #include <mount.h>
 #include <inode.h>
 #include <file.h>
 
 #undef LIST_HEAD
+
 #include "llite_lib.h"
 
 #ifndef MAY_EXEC
-#  define MAY_EXEC        1
-#  define MAY_WRITE       2
-#  define MAY_READ        4
+#define MAY_EXEC        1
+#define MAY_WRITE       2
+#define MAY_READ        4
 #endif
 
 #define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH)
@@ -85,14 +85,14 @@ static int ll_permission(struct inode *inode, int mask)
 static void llu_fsop_gone(struct filesys *fs)
 {
         struct llu_sb_info *sbi = (struct llu_sb_info *) fs->fs_private;
-        struct obd_device *obd = class_exp2obd(sbi->ll_lmv_exp);
+        struct obd_device *obd = class_exp2obd(sbi->ll_mdc_exp);
         struct lustre_cfg lcfg;
         int next = 0;
         ENTRY;
 
         list_del(&sbi->ll_conn_chain);
-        obd_disconnect(sbi->ll_lov_exp, 0);
-        obd_disconnect(sbi->ll_lmv_exp, 0);
+        obd_disconnect(sbi->ll_osc_exp, 0);
+        obd_disconnect(sbi->ll_mdc_exp, 0);
 
         while ((obd = class_devices_in_group(&sbi->ll_sb_uuid, &next)) != NULL)
         {
@@ -111,12 +111,12 @@ static void llu_fsop_gone(struct filesys *fs)
                 }
         }
 
-        obd_disconnect(sbi->ll_lmv_exp, 0);
         OBD_FREE(sbi, sizeof(*sbi));
+
         EXIT;
 }
 
-struct inode_ops llu_inode_ops;
+static struct inode_ops llu_inode_ops;
 
 void llu_update_inode(struct inode *inode, struct mds_body *body,
                       struct lov_stripe_md *lsm)
@@ -139,19 +139,8 @@ void llu_update_inode(struct inode *inode, struct mds_body *body,
                 }
         }
 
-        /*
-         * updating inode lustre id. We try optimize things a little bit here,
-         * thus do not do it all the time.
-         */
-        if (body->valid & OBD_MD_FID)
-                id_assign_fid(&lli->lli_id, &body->id1);
-        if ((body->valid & OBD_MD_FLID) || (body->valid & OBD_MD_FLGENER))
-                id_assign_stc(&lli->lli_id, &body->id1);
         if (body->valid & OBD_MD_FLID)
-                lli->lli_st_ino = id_ino(&body->id1);
-        if (body->valid & OBD_MD_FLGENER)
-                lli->lli_st_generation = id_gen(&body->id1);
-
+                lli->lli_st_ino = body->ino;
         if (body->valid & OBD_MD_FLATIME)
                 LTIME_S(lli->lli_st_atime) = body->atime;
         if (body->valid & OBD_MD_FLMTIME)
@@ -170,12 +159,22 @@ void llu_update_inode(struct inode *inode, struct mds_body *body,
                 lli->lli_st_flags = body->flags;
         if (body->valid & OBD_MD_FLNLINK)
                 lli->lli_st_nlink = body->nlink;
+        if (body->valid & OBD_MD_FLGENER)
+                lli->lli_st_generation = body->generation;
         if (body->valid & OBD_MD_FLRDEV)
                 lli->lli_st_rdev = body->rdev;
         if (body->valid & OBD_MD_FLSIZE)
                 lli->lli_st_size = body->size;
         if (body->valid & OBD_MD_FLBLOCKS)
                 lli->lli_st_blocks = body->blocks;
+
+        /* fillin fid */
+        if (body->valid & OBD_MD_FLID)
+                lli->lli_fid.id = body->ino;
+        if (body->valid & OBD_MD_FLGENER)
+                lli->lli_fid.generation = body->generation;
+        if (body->valid & OBD_MD_FLTYPE)
+                lli->lli_fid.f_type = body->mode & S_IFMT;
 }
 
 void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid)
@@ -343,7 +342,7 @@ int llu_inode_getattr(struct inode *inode, struct lov_stripe_md *lsm)
 }
 
 static struct inode* llu_new_inode(struct filesys *fs,
-                                   struct lustre_id *id)
+                                   struct ll_fid *fid)
 {
        struct inode *inode;
         struct llu_inode_info *lli;
@@ -360,17 +359,17 @@ static struct inode* llu_new_inode(struct filesys *fs,
         lli->lli_maxbytes = (__u64)(~0UL);
         lli->lli_file_data = NULL;
 
-        lli->lli_sysio_fid.fid_data = &lli->lli_id;
-        lli->lli_sysio_fid.fid_len = sizeof(lli->lli_id);
+        lli->lli_sysio_fid.fid_data = &lli->lli_fid;
+        lli->lli_sysio_fid.fid_len = sizeof(lli->lli_fid);
 
-        memcpy(&lli->lli_id, id, sizeof(*id));
+        memcpy(&lli->lli_fid, fid, sizeof(*fid));
 
         /* file identifier is needed by functions like _sysio_i_find() */
        inode = _sysio_i_new(fs, &lli->lli_sysio_fid,
 #ifndef AUTOMOUNT_FILE_NAME
-                            id->li_stc.u.e3s.l3s_type & S_IFMT,
+                            fid->f_type & S_IFMT,
 #else
-                            id->li_stc.u.e3s.l3s_type, /* all of the bits! */
+                            fid->f_type, /* all of the bits! */
 #endif
                              0, 0,
                             &llu_inode_ops, lli);
@@ -394,9 +393,9 @@ static int llu_have_md_lock(struct inode *inode, __u64 lockpart)
 
         LASSERT(inode);
 
-        obddev = sbi->ll_lmv_exp->exp_obd;
-        res_id.name[0] = id_fid(&lli->lli_id);
-        res_id.name[1] = id_group(&lli->lli_id);
+        obddev = sbi->ll_mdc_exp->exp_obd;
+        res_id.name[0] = lli->lli_st_ino;
+        res_id.name[1] = lli->lli_st_generation;
 
         CDEBUG(D_INFO, "trying to match res "LPU64"\n", res_id.name[0]);
 
@@ -431,24 +430,24 @@ static int llu_inode_revalidate(struct inode *inode)
                 struct lustre_md md;
                 struct ptlrpc_request *req = NULL;
                 struct llu_sb_info *sbi = llu_i2sbi(inode);
-                struct lustre_id id;
+                struct ll_fid fid;
                 unsigned long valid = 0;
                 int rc, ealen = 0;
 
-                /* Why don't we update all valid MDS fields here, if we're doing
-                 * an RPC anyways?  -phil */
+                /* Why don't we update all valid MDS fields here, if we're
+                 * doing an RPC anyways?  -phil */
                 if (S_ISREG(lli->lli_st_mode)) {
-                        ealen = obd_size_diskmd(sbi->ll_lov_exp, NULL);
+                        ealen = obd_size_diskmd(sbi->ll_osc_exp, NULL);
                         valid |= OBD_MD_FLEASIZE;
                 }
-                ll_inode2id(&id, inode);
-                rc = mdc_getattr(sbi->ll_lmv_exp, &id, valid, ealen, &req);
+                ll_inode2fid(&fid, inode);
+                rc = mdc_getattr(sbi->ll_mdc_exp, &fid, valid, ealen, &req);
                 if (rc) {
                         CERROR("failure %d inode %lu\n", rc, lli->lli_st_ino);
                         RETURN(-abs(rc));
                 }
-                rc = mdc_req2lustre_md(sbi->ll_lmv_exp, req, 0
-                                       sbi->ll_lov_exp, &md);
+                rc = mdc_req2lustre_md(sbi->ll_mdc_exp, req, 0, sbi->ll_osc_exp
+                                       &md);
 
                 /* XXX Too paranoid? */
                 if (((md.body->valid ^ valid) & OBD_MD_FLEASIZE) &&
@@ -467,7 +466,7 @@ static int llu_inode_revalidate(struct inode *inode)
 
                 llu_update_inode(inode, md.body, md.lsm);
                 if (md.lsm != NULL && llu_i2info(inode)->lli_smd != md.lsm)
-                        obd_free_memmd(sbi->ll_lov_exp, &md.lsm);
+                        obd_free_memmd(sbi->ll_osc_exp, &md.lsm);
 
                 if (md.body->valid & OBD_MD_FLSIZE)
                         set_bit(LLI_F_HAVE_MDS_SIZE_LOCK,
@@ -546,7 +545,7 @@ static int null_if_equal(struct ldlm_lock *lock, void *data)
 
 void llu_clear_inode(struct inode *inode)
 {
-        struct lustre_id id;
+        struct ll_fid fid;
         struct llu_inode_info *lli = llu_i2info(inode);
         struct llu_sb_info *sbi = llu_i2sbi(inode);
         ENTRY;
@@ -554,16 +553,16 @@ void llu_clear_inode(struct inode *inode)
         CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%lu(%p)\n", lli->lli_st_ino,
                lli->lli_st_generation, inode);
 
-        ll_inode2id(&id, inode);
+        ll_inode2fid(&fid, inode);
         clear_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &(lli->lli_flags));
-        mdc_change_cbdata(sbi->ll_lmv_exp, &id, null_if_equal, inode);
+        mdc_change_cbdata(sbi->ll_mdc_exp, &fid, null_if_equal, inode);
 
         if (lli->lli_smd)
-                obd_change_cbdata(sbi->ll_lov_exp, lli->lli_smd,
+                obd_change_cbdata(sbi->ll_osc_exp, lli->lli_smd,
                                   null_if_equal, inode);
 
         if (lli->lli_smd) {
-                obd_free_memmd(sbi->ll_lov_exp, &lli->lli_smd);
+                obd_free_memmd(sbi->ll_osc_exp, &lli->lli_smd);
                 lli->lli_smd = NULL;
         }
 
@@ -682,11 +681,11 @@ int llu_setattr_raw(struct inode *inode, struct iattr *attr)
          * inode ourselves so we can call obdo_from_inode() always. */
         if (ia_valid & (lsm ? ~(ATTR_SIZE | ATTR_FROM_OPEN | ATTR_RAW) : ~0)) {
                 struct lustre_md md;
-                llu_prepare_mdc_data(&op_data, inode, NULL, NULL, 0, 0);
+                llu_prepare_mdc_op_data(&op_data, inode, NULL, NULL, 0, 0);
+
+                rc = mdc_setattr(sbi->ll_mdc_exp, &op_data,
+                                  attr, NULL, 0, NULL, 0, &request);
 
-                rc = mdc_setattr(sbi->ll_lmv_exp, &op_data,
-                                 attr, NULL, 0, NULL, 0, &request);
-                
                 if (rc) {
                         ptlrpc_req_finished(request);
                         if (rc != -EPERM && rc != -EACCES)
@@ -694,8 +693,8 @@ int llu_setattr_raw(struct inode *inode, struct iattr *attr)
                         RETURN(rc);
                 }
 
-                rc = mdc_req2lustre_md(sbi->ll_lmv_exp, request, 0, 
-                                       sbi->ll_lov_exp, &md);
+                rc = mdc_req2lustre_md(sbi->ll_mdc_exp, request, 0, 
+                                       sbi->ll_osc_exp, &md);
                 if (rc) {
                         ptlrpc_req_finished(request);
                         RETURN(rc);
@@ -772,7 +771,7 @@ int llu_setattr_raw(struct inode *inode, struct iattr *attr)
                 oa.o_valid = OBD_MD_FLID;
                 obdo_from_inode(&oa, inode, OBD_MD_FLTYPE | OBD_MD_FLATIME |
                                             OBD_MD_FLMTIME | OBD_MD_FLCTIME);
-                rc = obd_setattr(sbi->ll_lov_exp, &oa, lsm, NULL);
+                rc = obd_setattr(sbi->ll_osc_exp, &oa, lsm, NULL);
                 if (rc)
                         CERROR("obd_setattr fails: rc=%d\n", rc);
         }
@@ -844,8 +843,8 @@ static int llu_iop_symlink_raw(struct pnode *pno, const char *tgt)
         if (llu_i2info(dir)->lli_st_nlink >= EXT2_LINK_MAX)
                 RETURN(err);
 
-        llu_prepare_mdc_data(&op_data, dir, NULL, name, len, 0);
-        err = mdc_create(sbi->ll_lmv_exp, &op_data,
+        llu_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
+        err = mdc_create(sbi->ll_mdc_exp, &op_data,
                          tgt, strlen(tgt) + 1, S_IFLNK | S_IRWXUGO,
                          current->fsuid, current->fsgid, 0, &request);
         ptlrpc_req_finished(request);
@@ -858,7 +857,7 @@ static int llu_readlink_internal(struct inode *inode,
 {
         struct llu_inode_info *lli = llu_i2info(inode);
         struct llu_sb_info *sbi = llu_i2sbi(inode);
-        struct lustre_id id;
+        struct ll_fid fid;
         struct mds_body *body;
         int rc, symlen = lli->lli_st_size + 1;
         ENTRY;
@@ -871,8 +870,8 @@ static int llu_readlink_internal(struct inode *inode,
                 RETURN(0);
         }
 
-        ll_inode2id(&id, inode);
-        rc = mdc_getattr(sbi->ll_lmv_exp, &id,
+        ll_inode2fid(&fid, inode);
+        rc = mdc_getattr(sbi->ll_mdc_exp, &fid,
                          OBD_MD_LINKNAME, symlen, request);
         if (rc) {
                 CERROR("inode %lu: rc = %d\n", lli->lli_st_ino, rc);
@@ -963,11 +962,11 @@ static int llu_iop_mknod_raw(struct pnode *pno,
         case S_IFBLK:
         case S_IFIFO:
         case S_IFSOCK:
-                llu_prepare_mdc_data(&op_data, dir, NULL,
-                                     pno->p_base->pb_name.name,
-                                     pno->p_base->pb_name.len,
-                                     0);
-                err = mdc_create(sbi->ll_lmv_exp, &op_data, NULL, 0, mode,
+                llu_prepare_mdc_op_data(&op_data, dir, NULL,
+                                        pno->p_base->pb_name.name,
+                                        pno->p_base->pb_name.len,
+                                        0);
+                err = mdc_create(sbi->ll_mdc_exp, &op_data, NULL, 0, mode,
                                  current->fsuid, current->fsgid, dev, &request);
                 ptlrpc_req_finished(request);
                 break;
@@ -995,8 +994,8 @@ static int llu_iop_link_raw(struct pnode *old, struct pnode *new)
         LASSERT(dir);
 
         liblustre_wait_event(0);
-        llu_prepare_mdc_data(&op_data, src, dir, name, namelen, 0);
-        rc = mdc_link(llu_i2sbi(src)->ll_lmv_exp, &op_data, &request);
+        llu_prepare_mdc_op_data(&op_data, src, dir, name, namelen, 0);
+        rc = mdc_link(llu_i2sbi(src)->ll_mdc_exp, &op_data, &request);
         ptlrpc_req_finished(request);
         liblustre_wait_event(0);
 
@@ -1021,12 +1020,13 @@ static int llu_iop_unlink_raw(struct pnode *pno)
         LASSERT(target);
 
         liblustre_wait_event(0);
-        llu_prepare_mdc_data(&op_data, dir, NULL, name, len, 0);
-        rc = mdc_unlink(llu_i2sbi(dir)->ll_lmv_exp, &op_data, &request);
+        llu_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
+        rc = mdc_unlink(llu_i2sbi(dir)->ll_mdc_exp, &op_data, &request);
         if (!rc)
                 rc = llu_objects_destroy(request, dir);
         ptlrpc_req_finished(request);
         liblustre_wait_event(0);
+
         RETURN(rc);
 }
 
@@ -1046,8 +1046,8 @@ static int llu_iop_rename_raw(struct pnode *old, struct pnode *new)
         LASSERT(src);
         LASSERT(tgt);
 
-        llu_prepare_mdc_data(&op_data, src, tgt, NULL, 0, 0);
-        rc = mdc_rename(llu_i2sbi(src)->ll_lmv_exp, &op_data,
+        llu_prepare_mdc_op_data(&op_data, src, tgt, NULL, 0, 0);
+        rc = mdc_rename(llu_i2sbi(src)->ll_mdc_exp, &op_data,
                         oldname, oldnamelen, newname, newnamelen,
                         &request);
         if (!rc) {
@@ -1068,7 +1068,7 @@ static int llu_statfs_internal(struct llu_sb_info *sbi,
         int rc;
         ENTRY;
 
-        rc = obd_statfs(class_exp2obd(sbi->ll_lmv_exp), osfs, max_age);
+        rc = obd_statfs(class_exp2obd(sbi->ll_mdc_exp), osfs, max_age);
         if (rc) {
                 CERROR("mdc_statfs fails: rc = %d\n", rc);
                 RETURN(rc);
@@ -1077,7 +1077,7 @@ static int llu_statfs_internal(struct llu_sb_info *sbi,
         CDEBUG(D_SUPER, "MDC blocks "LPU64"/"LPU64" objects "LPU64"/"LPU64"\n",
                osfs->os_bavail, osfs->os_blocks, osfs->os_ffree,osfs->os_files);
 
-        rc = obd_statfs(class_exp2obd(sbi->ll_lov_exp), &obd_osfs, max_age);
+        rc = obd_statfs(class_exp2obd(sbi->ll_osc_exp), &obd_osfs, max_age);
         if (rc) {
                 CERROR("obd_statfs fails: rc = %d\n", rc);
                 RETURN(rc);
@@ -1162,7 +1162,7 @@ static int llu_iop_statvfs(struct pnode *pno,
         buf->f_files = fs.f_files;  /* Total number serial numbers */
         buf->f_ffree = fs.f_ffree;  /* Number free serial numbers */
         buf->f_favail = fs.f_ffree; /* Number free ser num for non-privileged*/
-        buf->f_fsid = fs.f_fstc.__val[1];
+        buf->f_fsid = fs.f_fsid.__val[1];
         buf->f_flag = 0;            /* No equiv in statfs; maybe use type? */
         buf->f_namemax = fs.f_namelen;
 #endif
@@ -1189,8 +1189,8 @@ static int llu_iop_mkdir_raw(struct pnode *pno, mode_t mode)
                 RETURN(err);
 
         mode = (mode & (S_IRWXUGO|S_ISVTX) & ~current->fs->umask) | S_IFDIR;
-        llu_prepare_mdc_data(&op_data, dir, NULL, name, len, 0);
-        err = mdc_create(llu_i2sbi(dir)->ll_lmv_exp, &op_data, NULL, 0, mode,
+        llu_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
+        err = mdc_create(llu_i2sbi(dir)->ll_mdc_exp, &op_data, NULL, 0, mode,
                          current->fsuid, current->fsgid, 0, &request);
         ptlrpc_req_finished(request);
         RETURN(err);
@@ -1210,8 +1210,8 @@ static int llu_iop_rmdir_raw(struct pnode *pno)
         CDEBUG(D_VFSTRACE, "VFS Op:name=%s,dir=%lu/%lu(%p)\n",
                name, lli->lli_st_ino, lli->lli_st_generation, dir);
 
-        llu_prepare_mdc_data(&op_data, dir, NULL, name, len, S_IFDIR);
-        rc = mdc_unlink(llu_i2sbi(dir)->ll_lmv_exp, &op_data, &request);
+        llu_prepare_mdc_op_data(&op_data, dir, NULL, name, len, S_IFDIR);
+        rc = mdc_unlink(llu_i2sbi(dir)->ll_mdc_exp, &op_data, &request);
         ptlrpc_req_finished(request);
 
         RETURN(rc);
@@ -1237,7 +1237,7 @@ static int llu_iop_fcntl(struct inode *ino, int cmd, va_list ap, int *rtn)
                 flags = va_arg(ap, long);
                 flags &= FCNTL_FLMASK;
                 if (flags & FCNTL_FLMASK_INVALID) {
-                        CERROR("liblustre does not support O_NONBLOCK, O_ASYNC, "
+                        CERROR("liblustre don't support O_NONBLOCK, O_ASYNC, "
                                "and O_DIRECT on file descriptor\n");
                         *rtn = -1;
                         return EINVAL;
@@ -1353,8 +1353,8 @@ struct filesys_ops llu_filesys_ops =
 struct inode *llu_iget(struct filesys *fs, struct lustre_md *md)
 {
         struct inode *inode;
-        struct lustre_id id;
-        struct file_identifier fileid = {&id, sizeof(id)};
+        struct ll_fid fid;
+        struct file_identifier fileid = {&fid, sizeof(fid)};
 
         if ((md->body->valid &
              (OBD_MD_FLGENER | OBD_MD_FLID | OBD_MD_FLTYPE)) !=
@@ -1364,15 +1364,17 @@ struct inode *llu_iget(struct filesys *fs, struct lustre_md *md)
                 return ERR_PTR(-EPERM);
         }
 
-        id = md->body->id1;
-
         /* try to find existing inode */
+        fid.id = md->body->ino;
+        fid.generation = md->body->generation;
+        fid.f_type = md->body->mode & S_IFMT;
+
         inode = _sysio_i_find(fs, &fileid);
         if (inode) {
                 struct llu_inode_info *lli = llu_i2info(inode);
 
                 if (inode->i_zombie ||
-                    lli->lli_st_generation != id_gen(&md->body->id1)) {
+                    lli->lli_st_generation != md->body->generation) {
                         I_RELE(inode);
                 }
                 else {
@@ -1381,13 +1383,15 @@ struct inode *llu_iget(struct filesys *fs, struct lustre_md *md)
                 }
         }
 
-        inode = llu_new_inode(fs, &id);
+        inode = llu_new_inode(fs, &fid);
         if (inode)
                 llu_update_inode(inode, md->body, md->lsm);
         
         return inode;
 }
 
+extern struct list_head lustre_profile_list;
+
 static int
 llu_fsswop_mount(const char *source,
                  unsigned flags,
@@ -1399,18 +1403,18 @@ llu_fsswop_mount(const char *source,
         struct inode *root;
         struct pnode_base *rootpb;
         struct obd_device *obd;
-        struct lustre_id rootid;
+        struct ll_fid rootfid;
         struct llu_sb_info *sbi;
         struct obd_statfs osfs;
         static struct qstr noname = { NULL, 0, 0 };
         struct ptlrpc_request *request = NULL;
-        struct lustre_handle lmv_conn = {0, };
-        struct lustre_handle lov_conn = {0, };
+        struct lustre_handle mdc_conn = {0, };
+        struct lustre_handle osc_conn = {0, };
         struct lustre_md md;
         class_uuid_t uuid;
         struct config_llog_instance cfg;
         struct lustre_profile *lprof;
-        char *lov = NULL, *lmv = NULL;
+        char *osc = NULL, *mdc = NULL;
         int async = 1, err = -EINVAL;
 
         ENTRY;
@@ -1445,23 +1449,23 @@ llu_fsswop_mount(const char *source,
                 CERROR("No profile found: %s\n", g_zconf_profile);
                 GOTO(out_free, err = -EINVAL);
         }
-        if (lov)
-                OBD_FREE(lov, strlen(lov) + 1);
-        OBD_ALLOC(lov, strlen(lprof->lp_lov) + 
+        if (osc)
+                OBD_FREE(osc, strlen(osc) + 1);
+        OBD_ALLOC(osc, strlen(lprof->lp_osc) + 
                   strlen(sbi->ll_instance) + 2);
-        sprintf(lov, "%s-%s", lprof->lp_lov, sbi->ll_instance);
+        sprintf(osc, "%s-%s", lprof->lp_osc, sbi->ll_instance);
 
-        if (lmv)
-                OBD_FREE(lmv, strlen(lmv) + 1);
-        OBD_ALLOC(lmv, strlen(lprof->lp_lmv) + 
+        if (mdc)
+                OBD_FREE(mdc, strlen(mdc) + 1);
+        OBD_ALLOC(mdc, strlen(lprof->lp_mdc) + 
                   strlen(sbi->ll_instance) + 2);
-        sprintf(lmv, "%s-%s", lprof->lp_lmv, sbi->ll_instance);
+        sprintf(mdc, "%s-%s", lprof->lp_mdc, sbi->ll_instance);
 
-        if (!lov) {
+        if (!osc) {
                 CERROR("no osc\n");
                 GOTO(out_free, err = -EINVAL);
         }
-        if (!lmv) {
+        if (!mdc) {
                 CERROR("no mdc\n");
                 GOTO(out_free, err = -EINVAL);
         }
@@ -1472,68 +1476,68 @@ llu_fsswop_mount(const char *source,
                 goto out_free;
         }
 
-        obd = class_name2obd(lmv);
+        obd = class_name2obd(mdc);
         if (!obd) {
-                CERROR("MDC %s: not setup or attached\n", lmv);
+                CERROR("MDC %s: not setup or attached\n", mdc);
                 GOTO(out_free, err = -EINVAL);
         }
         obd_set_info(obd->obd_self_export, strlen("async"), "async",
                      sizeof(async), &async);
 #warning "FIXME ASAP!"
 #if 0
-        if (mdc_init_ea_size(obd, lov))
+        if (mdc_init_ea_size(obd, osc))
                 GOTO(out_free, err = -EINVAL);
 #endif
         /* setup mdc */
-        err = obd_connect(&lmv_conn, obd, &sbi->ll_sb_uuid, 0);
+        err = obd_connect(&mdc_conn, obd, &sbi->ll_sb_uuid, 0);
         if (err) {
-                CERROR("cannot connect to %s: rc = %d\n", lmv, err);
+                CERROR("cannot connect to %s: rc = %d\n", mdc, err);
                 GOTO(out_free, err);
         }
-        sbi->ll_lmv_exp = class_conn2export(&lmv_conn);
+        sbi->ll_mdc_exp = class_conn2export(&mdc_conn);
 
         err = obd_statfs(obd, &osfs, 100000000);
         if (err)
-                GOTO(out_lmv, err);
+                GOTO(out_mdc, err);
 
         /*
          * FIXME fill fs stat data into sbi here!!! FIXME
          */
 
-        /* setup lov */
-        obd = class_name2obd(lov);
+        /* setup osc */
+        obd = class_name2obd(osc);
         if (!obd) {
-                CERROR("OSC %s: not setup or attached\n", lov);
-                GOTO(out_lmv, err = -EINVAL);
+                CERROR("OSC %s: not setup or attached\n", osc);
+                GOTO(out_mdc, err = -EINVAL);
         }
         obd_set_info(obd->obd_self_export, strlen("async"), "async",
                      sizeof(async), &async);
 
-        err = obd_connect(&lov_conn, obd, &sbi->ll_sb_uuid, 0);
+        err = obd_connect(&osc_conn, obd, &sbi->ll_sb_uuid, 0);
         if (err) {
-                CERROR("cannot connect to %s: rc = %d\n", lov, err);
-                GOTO(out_lmv, err);
+                CERROR("cannot connect to %s: rc = %d\n", osc, err);
+                GOTO(out_mdc, err);
         }
-        sbi->ll_lov_exp = class_conn2export(&lov_conn);
+        sbi->ll_osc_exp = class_conn2export(&osc_conn);
 
-        err = mdc_getstatus(sbi->ll_lmv_exp, &rootid);
+        err = mdc_getstatus(sbi->ll_mdc_exp, &rootfid);
         if (err) {
                 CERROR("cannot mds_connect: rc = %d\n", err);
-                GOTO(out_lov, err);
+                GOTO(out_osc, err);
         }
-        CDEBUG(D_SUPER, "rootid "LPU64"\n", rootid.li_stc.u.e3s.l3s_ino);
-        sbi->ll_rootino = rootid.li_stc.u.e3s.l3s_ino;
+        CDEBUG(D_SUPER, "rootfid "LPU64"\n", rootfid.id);
+        sbi->ll_rootino = rootfid.id;
 
         /* fetch attr of root inode */
-        err = mdc_getattr(sbi->ll_lmv_exp, &rootid,
+        err = mdc_getattr(sbi->ll_mdc_exp, &rootfid,
                           OBD_MD_FLNOTOBD|OBD_MD_FLBLOCKS, 0, &request);
         if (err) {
                 CERROR("mdc_getattr failed for root: rc = %d\n", err);
-                GOTO(out_lov, err);
+                GOTO(out_osc, err);
         }
 
-        err = mdc_req2lustre_md(sbi->ll_lmv_exp, request, 0
-                                sbi->ll_lov_exp, &md);
+        err = mdc_req2lustre_md(sbi->ll_mdc_exp, request, 0, sbi->ll_osc_exp
+                                &md);
         if (err) {
                 CERROR("failed to understand root inode md: rc = %d\n",err);
                 GOTO(out_request, err);
@@ -1572,10 +1576,10 @@ out_inode:
         _sysio_i_gone(root);
 out_request:
         ptlrpc_req_finished(request);
-out_lov:
-        obd_disconnect(sbi->ll_lov_exp, 0);
-out_lmv:
-        obd_disconnect(sbi->ll_lmv_exp, 0);
+out_osc:
+        obd_disconnect(sbi->ll_osc_exp, 0);
+out_mdc:
+        obd_disconnect(sbi->ll_mdc_exp, 0);
 out_free:
         OBD_FREE(sbi, sizeof(*sbi));
         return err;
@@ -1585,30 +1589,31 @@ struct fssw_ops llu_fssw_ops = {
         llu_fsswop_mount
 };
 
-struct inode_ops llu_inode_ops = {
-        .inop_lookup         = llu_iop_lookup,
-        .inop_getattr        = llu_iop_getattr,
-        .inop_setattr        = llu_iop_setattr,
-        .inop_getdirentries  = llu_iop_getdirentries,
-        .inop_mkdir          = llu_iop_mkdir_raw,
-        .inop_rmdir          = llu_iop_rmdir_raw,
-        .inop_symlink        = llu_iop_symlink_raw,
-        .inop_readlink       = llu_iop_readlink,
-        .inop_open           = llu_iop_open,
-        .inop_close          = llu_iop_close,
-        .inop_link           = llu_iop_link_raw,
-        .inop_unlink         = llu_iop_unlink_raw,
-        .inop_rename         = llu_iop_rename_raw,
-        .inop_iodone         = llu_iop_iodone,
-        .inop_fcntl          = llu_iop_fcntl,
-        .inop_sync           = llu_iop_sync,
-        .inop_read           = llu_iop_read,
-        .inop_write          = llu_iop_write,
-        .inop_datasync       = llu_iop_datasync,
-        .inop_ioctl          = llu_iop_ioctl,
-        .inop_mknod          = llu_iop_mknod_raw,
+static struct inode_ops llu_inode_ops = {
+        inop_lookup:    llu_iop_lookup,
+        inop_getattr:   llu_iop_getattr,
+        inop_setattr:   llu_iop_setattr,
+        inop_getdirentries:     llu_iop_getdirentries,
+        inop_mkdir:     llu_iop_mkdir_raw,
+        inop_rmdir:     llu_iop_rmdir_raw,
+        inop_symlink:   llu_iop_symlink_raw,
+        inop_readlink:  llu_iop_readlink,
+        inop_open:      llu_iop_open,
+        inop_close:     llu_iop_close,
+        inop_link:      llu_iop_link_raw,
+        inop_unlink:    llu_iop_unlink_raw,
+        inop_rename:    llu_iop_rename_raw,
+        inop_pos:       llu_iop_pos,
+        inop_read:      llu_iop_read,
+        inop_write:     llu_iop_write,
+        inop_iodone:    llu_iop_iodone,
+        inop_fcntl:     llu_iop_fcntl,
+        inop_sync:      llu_iop_sync,
+        inop_datasync:  llu_iop_datasync,
+        inop_ioctl:     llu_iop_ioctl,
+        inop_mknod:     llu_iop_mknod_raw,
 #ifdef _HAVE_STATVFS
-        .inop_statvfs        = llu_iop_statvfs,
+        inop_statvfs:   llu_iop_statvfs,
 #endif
-        .inop_gone           = llu_iop_gone,
+        inop_gone:      llu_iop_gone,
 };
index 7743136..1984bc0 100644 (file)
@@ -169,7 +169,7 @@ int revalidate_it_finish(struct ptlrpc_request *request, int offset,
                 RETURN(-ENOENT);
 
         sbi = ll_i2sbi(de->d_inode);
-        rc = ll_prep_inode(sbi->ll_lov_exp, sbi->ll_lmv_exp,
+        rc = ll_prep_inode(sbi->ll_osc_exp, sbi->ll_mdc_exp,
                            &de->d_inode, request, offset, NULL);
 
         RETURN(rc);
@@ -203,7 +203,6 @@ void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry)
 void ll_frob_intent(struct lookup_intent **itp, struct lookup_intent *deft)
 {
         struct lookup_intent *it = *itp;
-        
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
         if (it) {
                 LASSERTF(it->it_magic == INTENT_MAGIC, "bad intent magic: %x\n",
@@ -221,8 +220,7 @@ int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd,
                      struct lookup_intent *it)
 {
         int rc;
-        struct lustre_id pid;
-        struct lustre_id cid;
+        struct ll_fid pfid, cfid;
         struct it_cb_data icbd;
         struct ptlrpc_request *req = NULL;
         struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
@@ -237,20 +235,18 @@ int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd,
                 RETURN(0);
 
         CDEBUG(D_INODE, "revalidate 0x%p: %*s -> %lu/%lu\n",
-               de, de->d_name.len, de->d_name.name,
-               (unsigned long) de->d_inode->i_ino,
-               (unsigned long) de->d_inode->i_generation);
+                        de, de->d_name.len, de->d_name.name,
+                        (unsigned long) de->d_inode->i_ino,
+                        (unsigned long) de->d_inode->i_generation);
 
-        exp = ll_i2lmvexp(de->d_inode);
-        ll_inode2id(&pid, de->d_parent->d_inode);
-        ll_inode2id(&cid, de->d_inode);
+        exp = ll_i2mdcexp(de->d_inode);
+        ll_inode2fid(&pfid, de->d_parent->d_inode);
+        ll_inode2fid(&cfid, de->d_inode);
         icbd.icbd_parent = de->d_parent->d_inode;
         icbd.icbd_childp = &de;
 
-        /*
-         * never execute intents for mount points. Attributes will be fixed up
-         * in ll_inode_revalidate_it().
-         */
+        /* Never execute intents for mount points.
+         * Attributes will be fixed up in ll_inode_revalidate_it */
         if (d_mountpoint(de))
                 RETURN(1);
 
@@ -262,8 +258,8 @@ int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd,
 
         if (it->it_op == IT_GETATTR) { /* We need to check for LOOKUP lock
                                           as well */
-                rc = md_intent_lock(exp, &pid, de->d_name.name,
-                                    de->d_name.len, NULL, 0, &cid, &lookup_it,
+                rc = md_intent_lock(exp, &pfid, de->d_name.name,
+                                    de->d_name.len, NULL, 0, &cfid, &lookup_it,
                                     flags, &req, ll_mdc_blocking_ast);
                 /* If there was no lookup lock, no point in even checking for
                    UPDATE lock */
@@ -283,13 +279,9 @@ int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd,
                 ll_lookup_finish_locks(&lookup_it, de);
         }
 
-        /* at this point fid should be valid. */
-        LASSERT(id_fid(&cid) != 0);
-        
-        rc = md_intent_lock(exp, &pid, de->d_name.name, de->d_name.len,
-                            NULL, 0, &cid, it, flags, &req,
+        rc = md_intent_lock(exp, &pfid, de->d_name.name, de->d_name.len,
+                            NULL, 0, &cfid, it, flags, &req,
                             ll_mdc_blocking_ast);
-        
         /* If req is NULL, then mdc_intent_lock only tried to do a lock match;
          * if all was well, it will return 1 if it found locks, 0 otherwise. */
         if (req == NULL && rc >= 0)
@@ -370,7 +362,7 @@ int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd,
         unlock_kernel();
 
         handle = (flag) ? &ldd->lld_mnt_och : &ldd->lld_cwd_och;
-        rc = obd_pin(sbi->ll_lmv_exp, inode->i_ino, inode->i_generation,
+        rc = obd_pin(sbi->ll_mdc_exp, inode->i_ino, inode->i_generation,
                      inode->i_mode & S_IFMT, handle, flag);
 
         if (rc) {
@@ -420,7 +412,7 @@ int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd,
                 return;
         }
 
-        rc = obd_unpin(sbi->ll_lmv_exp, &handle, flag);
+        rc = obd_unpin(sbi->ll_mdc_exp, &handle, flag);
         EXIT;
         return;
 }
@@ -444,12 +436,12 @@ static int ll_revalidate_nd(struct dentry *dentry, struct nameidata *nd)
 static void ll_dentry_iput(struct dentry *dentry, struct inode *inode)
 {
         struct ll_sb_info *sbi = ll_i2sbi(inode);
-        struct lustre_id parent, child;
+        struct ll_fid parent, child;
 
         LASSERT(dentry->d_parent && dentry->d_parent->d_inode);
-        ll_inode2id(&parent, dentry->d_parent->d_inode);
-        ll_inode2id(&child, inode);
-        md_change_cbdata_name(sbi->ll_lmv_exp, &parent,
+        ll_inode2fid(&parent, dentry->d_parent->d_inode);
+        ll_inode2fid(&child, inode);
+        md_change_cbdata_name(sbi->ll_mdc_exp, &parent,
                               (char *)dentry->d_name.name, 
                               dentry->d_name.len, &child, 
                               null_if_equal, inode);
index 50d402d..6ac70be 100644 (file)
@@ -61,26 +61,24 @@ typedef struct ext2_dir_entry_2 ext2_dirent;
 static int ll_dir_readpage(struct file *file, struct page *page)
 {
         struct inode *inode = page->mapping->host;
+        struct ll_fid mdc_fid;
+        __u64 offset;
         struct ptlrpc_request *request;
         struct mds_body *body;
-        struct lustre_id id;
-        __u64 offset;
         int rc = 0;
         ENTRY;
 
         CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino,
                inode->i_generation, inode);
 
-        mdc_pack_id(&id, inode->i_ino, inode->i_generation, 
-                    S_IFDIR, id_group(&ll_i2info(inode)->lli_id),
-                    id_fid(&ll_i2info(inode)->lli_id));
-
+        mdc_pack_fid(&mdc_fid, inode->i_ino, inode->i_generation, S_IFDIR);
+        mdc_fid.mds = ll_i2info(inode)->lli_mds;
         offset = page->index << PAGE_SHIFT;
-        rc = md_readpage(ll_i2sbi(inode)->ll_lmv_exp, &id, offset,
-                         page, &request);
+        rc = md_readpage(ll_i2sbi(inode)->ll_mdc_exp, &mdc_fid,
+                         offset, page, &request);
         if (!rc) {
-                body = lustre_msg_buf(request->rq_repmsg, 0, sizeof(*body));
-                LASSERT (body != NULL);          /* checked by md_readpage() */
+                body = lustre_msg_buf(request->rq_repmsg, 0, sizeof (*body));
+                LASSERT (body != NULL);         /* checked by md_readpage() */
                 LASSERT_REPSWABBED (request, 0); /* swabbed by md_readpage() */
 
 #warning "FIXME ASAP!"
@@ -90,7 +88,8 @@ static int ll_dir_readpage(struct file *file, struct page *page)
         ptlrpc_req_finished(request);
 
         unlock_page(page);
-        RETURN(rc);
+        EXIT;
+        return rc;
 }
 
 struct address_space_operations ll_dir_aops = {
@@ -117,6 +116,7 @@ static inline unsigned long dir_pages(struct inode *inode)
         return (inode->i_size+PAGE_CACHE_SIZE-1)>>PAGE_CACHE_SHIFT;
 }
 
+
 static void ext2_check_page(struct page *page)
 {
         struct inode *dir = page->mapping->host;
@@ -208,17 +208,16 @@ fail:
 
 static struct page *ll_get_dir_page(struct inode *dir, unsigned long n)
 {
-        struct ll_inode_info *li = ll_i2info(dir);
         struct ldlm_res_id res_id =
-                { .name = { id_fid(&li->lli_id), id_group(&li->lli_id)} };
+                { .name = { dir->i_ino, (__u64)dir->i_generation} };
         struct lustre_handle lockh;
-        struct obd_device *obddev = class_exp2obd(ll_i2sbi(dir)->ll_lmv_exp);
+        struct obd_device *obddev = class_exp2obd(ll_i2sbi(dir)->ll_mdc_exp);
         struct address_space *mapping = dir->i_mapping;
         struct page *page;
         ldlm_policy_data_t policy = { .l_inodebits = { MDS_INODELOCK_UPDATE } };
         int rc;
 
-        obddev = md_get_real_obd(ll_i2sbi(dir)->ll_lmv_exp, NULL, 0);
+        obddev = md_get_real_obd(ll_i2sbi(dir)->ll_mdc_exp, NULL, 0);
         rc = ldlm_lock_match(obddev->obd_namespace, LDLM_FL_BLOCK_GRANTED,
                              &res_id, LDLM_IBITS, &policy, LCK_PR, &lockh);
         if (!rc) {
@@ -226,9 +225,9 @@ static struct page *ll_get_dir_page(struct inode *dir, unsigned long n)
                 struct ptlrpc_request *request;
                 struct mdc_op_data data;
 
-                ll_prepare_mdc_data(&data, dir, NULL, NULL, 0, 0);
+                ll_prepare_mdc_op_data(&data, dir, NULL, NULL, 0, 0);
 
-                rc = md_enqueue(ll_i2sbi(dir)->ll_lmv_exp, LDLM_IBITS, &it,
+                rc = md_enqueue(ll_i2sbi(dir)->ll_mdc_exp, LDLM_IBITS, &it,
                                 LCK_PR, &data, &lockh, NULL, 0,
                                 ldlm_completion_ast, ll_mdc_blocking_ast, dir);
 
@@ -401,8 +400,8 @@ static int ll_mkdir_stripe(struct inode *inode, unsigned long arg)
 
         mode = lums.lums_mode;
         mode = (mode & (S_IRWXUGO|S_ISVTX) & ~current->fs->umask) | S_IFDIR;
-        ll_prepare_mdc_data(&op_data, inode, NULL, name,lums.lums_namelen,0);
-        err = md_create(sbi->ll_lmv_exp, &op_data, &nstripes, sizeof(nstripes),
+        ll_prepare_mdc_op_data(&op_data, inode, NULL, name,lums.lums_namelen,0);
+        err = md_create(sbi->ll_mdc_exp, &op_data, &nstripes, sizeof(nstripes),
                         mode, current->fsuid, current->fsgid, 0, &request);
         ptlrpc_req_finished(request);
 
@@ -431,7 +430,7 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                 RETURN(ll_iocontrol(inode, file, cmd, arg));
         case IOC_MDC_LOOKUP: {
                 struct ptlrpc_request *request = NULL;
-                struct lustre_id id;
+                struct ll_fid fid;
                 char *buf = NULL;
                 char *filename;
                 int namelen, rc, len = 0;
@@ -451,8 +450,8 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                 }
 
                 valid = OBD_MD_FLID;
-                ll_inode2id(&id, inode);
-                rc = md_getattr_name(sbi->ll_lmv_exp, &id,
+                ll_inode2fid(&fid, inode);
+                rc = md_getattr_name(sbi->ll_mdc_exp, &fid,
                                      filename, namelen, valid, 0, &request);
                 if (rc < 0) {
                         CDEBUG(D_INFO, "md_getattr_name: %d\n", rc);
@@ -477,7 +476,7 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                 struct lov_user_md lum, *lump = (struct lov_user_md *)arg;
                 int rc = 0;
 
-                ll_prepare_mdc_data(&op_data, inode, NULL, NULL, 0, 0);
+                ll_prepare_mdc_op_data(&op_data, inode, NULL, NULL, 0, 0);
 
                 LASSERT(sizeof(lum) == sizeof(*lump));
                 LASSERT(sizeof(lum.lmm_objects[0]) ==
@@ -489,7 +488,7 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                 if (lum.lmm_magic != LOV_USER_MAGIC)
                         RETURN(-EINVAL);
 
-                rc = md_setattr(sbi->ll_lmv_exp, &op_data,
+                rc = md_setattr(sbi->ll_mdc_exp, &op_data,
                                 &attr, &lum, sizeof(lum), NULL, 0, &request);
                 if (rc) {
                         ptlrpc_req_finished(request);
@@ -505,16 +504,16 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                 struct ptlrpc_request *request = NULL;
                 struct lov_user_md *lump = (struct lov_user_md *)arg;
                 struct lov_mds_md *lmm;
-                struct lustre_id id;
+                struct ll_fid fid;
                 struct mds_body *body;
                 unsigned long valid = 0;
                 int rc, lmmsize;
 
                 valid |= OBD_MD_FLDIREA;
 
-                ll_inode2id(&id, inode);
-                rc = md_getattr(sbi->ll_lmv_exp, &id, valid,
-                                obd_size_diskmd(sbi->ll_lov_exp, NULL),
+                ll_inode2fid(&fid, inode);
+                rc = md_getattr(sbi->ll_mdc_exp, &fid, valid,
+                                obd_size_diskmd(sbi->ll_osc_exp, NULL),
                                 &request);
                 if (rc < 0) {
                         CDEBUG(D_INFO, "md_getattr failed: rc = %d\n", rc);
@@ -543,7 +542,7 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
         }
         case IOC_MDC_GETSTRIPE: {
                 struct ptlrpc_request *request = NULL;
-                struct lustre_id id;
+                struct ll_fid fid;
                 struct mds_body *body;
                 struct lov_user_md *lump = (struct lov_user_md *)arg;
                 struct lov_mds_md *lmm;
@@ -554,10 +553,10 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                 if (IS_ERR(filename))
                         RETURN(PTR_ERR(filename));
 
-                ll_inode2id(&id, inode);
-                rc = md_getattr_name(sbi->ll_lmv_exp, &id, filename,
+                ll_inode2fid(&fid, inode);
+                rc = md_getattr_name(sbi->ll_mdc_exp, &fid, filename,
                                      strlen(filename) + 1, OBD_MD_FLEASIZE,
-                                     obd_size_diskmd(sbi->ll_lov_exp, NULL),
+                                     obd_size_diskmd(sbi->ll_osc_exp, NULL),
                                      &request);
                 if (rc < 0) {
                         CDEBUG(D_INFO, "md_getattr_name failed on %s: rc %d\n",
@@ -660,7 +659,7 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                         bufs[1] = NULL;
                 }
                 size = data->ioc_plen1;
-                req = ptlrpc_prep_req(sbi2lmv(sbi)->cl_import,
+                req = ptlrpc_prep_req(sbi2mdc(sbi)->cl_import,
                                       LUSTRE_LOG_VERSION, LLOG_CATINFO,
                                       2, lens, bufs);
                 if (!req)
@@ -679,8 +678,7 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                 RETURN(rc);
         }
         default:
-                return obd_iocontrol(cmd, sbi->ll_lov_exp, 0,
-                                     NULL, (void *)arg);
+                return obd_iocontrol(cmd, sbi->ll_osc_exp,0,NULL,(void *)arg);
         }
 }
 
index e30f5ba..117a08c 100644 (file)
@@ -33,7 +33,7 @@
 #include "llite_internal.h"
 #include <linux/obd_lov.h>
 
-int ll_mdc_close(struct obd_export *lmv_exp, struct inode *inode,
+int ll_mdc_close(struct obd_export *mdc_exp, struct inode *inode,
                  struct file *file)
 {
         struct ll_file_data *fd = file->private_data;
@@ -53,16 +53,16 @@ int ll_mdc_close(struct obd_export *lmv_exp, struct inode *inode,
 
         obdo.o_id = inode->i_ino;
         obdo.o_valid = OBD_MD_FLID;
-        obdo_from_inode(&obdo, inode, (OBD_MD_FLTYPE | OBD_MD_FLMODE |
-                                       OBD_MD_FLSIZE | OBD_MD_FLBLOCKS |
-                                       OBD_MD_FLATIME | OBD_MD_FLMTIME |
-                                       OBD_MD_FLCTIME));
+        obdo_from_inode(&obdo, inode, OBD_MD_FLTYPE | OBD_MD_FLMODE |
+                                      OBD_MD_FLSIZE | OBD_MD_FLBLOCKS |
+                                      OBD_MD_FLATIME | OBD_MD_FLMTIME |
+                                      OBD_MD_FLCTIME);
         if (0 /* ll_is_inode_dirty(inode) */) {
                 obdo.o_flags = MDS_BFLAG_UNCOMMITTED_WRITES;
                 obdo.o_valid |= OBD_MD_FLFLAGS;
         }
-        obdo.o_mds = id_group(&ll_i2info(inode)->lli_id);
-        rc = md_close(lmv_exp, &obdo, och, &req);
+        obdo.o_mds = ll_i2info(inode)->lli_mds;
+        rc = md_close(mdc_exp, &obdo, och, &req);
 
         if (rc == EAGAIN) {
                 /* We are the last writer, so the MDS has instructed us to get
@@ -80,7 +80,7 @@ int ll_mdc_close(struct obd_export *lmv_exp, struct inode *inode,
                                inode->i_ino, rc);
         }
 
-        mdc_clear_open_replay_data(lmv_exp, och);
+        mdc_clear_open_replay_data(mdc_exp, och);
         ptlrpc_req_finished(req);
         och->och_fh.cookie = DEAD_HANDLE_MAGIC;
         file->private_data = NULL;
@@ -101,8 +101,9 @@ int ll_file_release(struct inode *inode, struct file *file)
         int rc;
 
         ENTRY;
-        CDEBUG(D_VFSTRACE, "VFS Op:inode="DLID4"(%p)\n",
-               OLID4(&ll_i2info(inode)->lli_id), inode);
+        CDEBUG(D_VFSTRACE, "VFS Op:inode=%u/%lu/%u(%p)\n",
+               ll_i2info(inode)->lli_mds, inode->i_ino,
+               inode->i_generation, inode);
 
         /* don't do anything for / */
         if (inode->i_sb->s_root == file->f_dentry)
@@ -112,7 +113,7 @@ int ll_file_release(struct inode *inode, struct file *file)
         fd = (struct ll_file_data *)file->private_data;
         LASSERT(fd != NULL);
 
-        rc = ll_mdc_close(sbi->ll_lmv_exp, inode, file);
+        rc = ll_mdc_close(sbi->ll_mdc_exp, inode, file);
         RETURN(rc);
 }
 
@@ -130,9 +131,9 @@ static int ll_intent_file_open(struct file *file, void *lmm,
         if (!parent)
                 RETURN(-ENOENT);
 
-        ll_prepare_mdc_data(&data, parent->d_inode, NULL, name, len, O_RDWR);
+        ll_prepare_mdc_op_data(&data, parent->d_inode, NULL, name, len, O_RDWR);
 
-        rc = md_enqueue(sbi->ll_lmv_exp, LDLM_IBITS, itp, LCK_PR, &data,
+        rc = md_enqueue(sbi->ll_mdc_exp, LDLM_IBITS, itp, LCK_PR, &data,
                         &lockh, lmm, lmmsize, ldlm_completion_ast,
                         ll_mdc_blocking_ast, NULL);
         if (rc == 0) {
@@ -150,7 +151,7 @@ int ll_local_open(struct file *file, struct lookup_intent *it)
 {
         struct ptlrpc_request *req = it->d.lustre.it_data;
         struct ll_inode_info *lli = ll_i2info(file->f_dentry->d_inode);
-        struct obd_export *lmv_exp = ll_i2lmvexp(file->f_dentry->d_inode);
+        struct obd_export *mdc_exp = ll_i2mdcexp(file->f_dentry->d_inode);
         struct ll_file_data *fd;
         struct mds_body *body;
         ENTRY;
@@ -169,7 +170,6 @@ int ll_local_open(struct file *file, struct lookup_intent *it)
 
 
         OBD_SLAB_ALLOC(fd, ll_file_data_slab, SLAB_KERNEL, sizeof *fd);
-        
         /* We can't handle this well without reorganizing ll_file_open and
          * ll_mdc_close, so don't even try right now. */
         LASSERT(fd != NULL);
@@ -181,7 +181,7 @@ int ll_local_open(struct file *file, struct lookup_intent *it)
 
         lli->lli_io_epoch = body->io_epoch;
 
-        mdc_set_open_replay_data(lmv_exp, &fd->fd_mds_och, it->d.lustre.it_data);
+        mdc_set_open_replay_data(mdc_exp, &fd->fd_mds_och, it->d.lustre.it_data);
 
         RETURN(0);
 }
@@ -678,7 +678,7 @@ int ll_glimpse_size(struct inode *inode)
 
         CDEBUG(D_DLMTRACE, "Glimpsing inode %lu\n", inode->i_ino);
 
-        rc = obd_enqueue(sbi->ll_lov_exp, lli->lli_smd, LDLM_EXTENT, &policy,
+        rc = obd_enqueue(sbi->ll_osc_exp, lli->lli_smd, LDLM_EXTENT, &policy,
                          LCK_PR, &flags, ll_extent_lock_callback,
                          ldlm_completion_ast, ll_glimpse_callback, inode,
                          sizeof(struct ost_lvb), lustre_swab_ost_lvb, &lockh);
@@ -694,9 +694,10 @@ int ll_glimpse_size(struct inode *inode)
         inode->i_blocks = lov_merge_blocks(lli->lli_smd);
         //inode->i_mtime = lov_merge_mtime(lli->lli_smd, inode->i_mtime);
 
-        CDEBUG(D_DLMTRACE, "glimpse: size: "LPU64", blocks: "LPU64"\n",
-               (__u64)inode->i_size, (__u64)inode->i_blocks);
-        obd_cancel(sbi->ll_lov_exp, lli->lli_smd, LCK_PR, &lockh);
+        CDEBUG(D_DLMTRACE, "glimpse: size: %llu, blocks: %lu\n",
+               inode->i_size, inode->i_blocks);
+        obd_cancel(sbi->ll_osc_exp, lli->lli_smd, LCK_PR, &lockh);
+
         RETURN(rc);
 }
 
@@ -732,7 +733,8 @@ int ll_extent_lock(struct ll_file_data *fd, struct inode *inode,
                inode->i_ino, policy->l_extent.start, policy->l_extent.end);
 
         do_gettimeofday(&start);
-        rc = obd_enqueue(sbi->ll_lov_exp, lsm, LDLM_EXTENT, policy, mode,
+        
+        rc = obd_enqueue(sbi->ll_osc_exp, lsm, LDLM_EXTENT, policy, mode,
                          &ast_flags, ll_extent_lock_callback,
                          ldlm_completion_ast, ll_glimpse_callback, inode,
                          sizeof(struct ost_lvb), lustre_swab_ost_lvb, lockh);
@@ -773,7 +775,7 @@ int ll_extent_unlock(struct ll_file_data *fd, struct inode *inode,
             (sbi->ll_flags & LL_SBI_NOLCK))
                 RETURN(0);
 
-        rc = obd_cancel(sbi->ll_lov_exp, lsm, mode, lockh);
+        rc = obd_cancel(sbi->ll_osc_exp, lsm, mode, lockh);
 
         RETURN(rc);
 }
@@ -811,6 +813,7 @@ static ssize_t ll_file_read(struct file *file, char *buf, size_t count,
 
         rc = ll_tree_lock(&tree, node, inode, buf, count,
                           file->f_flags & O_NONBLOCK ? LDLM_FL_BLOCK_NOWAIT :0);
+        
         if (rc != 0)
                 RETURN(rc);
 
@@ -841,11 +844,8 @@ static ssize_t ll_file_read(struct file *file, char *buf, size_t count,
         RETURN(retval);
 }
 
-/*
- * Write to a file (through the page cache).
- */
-static ssize_t ll_file_write(struct file *file, const char *buf,
-                             size_t count, loff_t *ppos)
+static ssize_t ll_file_write(struct file *file, const char *buf, size_t count,
+                             loff_t *ppos)
 {
         struct inode *inode = file->f_dentry->d_inode;
         loff_t maxbytes = ll_file_maxbytes(inode);
@@ -958,7 +958,7 @@ static int ll_lov_recreate_obj(struct inode *inode, struct file *file,
         oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP | OBD_MD_FLFLAGS;
         oa->o_flags |= OBD_FL_RECREATE_OBJS;
         obdo_from_inode(oa, inode, OBD_MD_FLTYPE | OBD_MD_FLATIME |
-                        OBD_MD_FLMTIME | OBD_MD_FLCTIME);
+                                   OBD_MD_FLMTIME | OBD_MD_FLCTIME);
 
         oti.oti_objid = NULL;
         memcpy(lsm2, lsm, lsm_size);
@@ -1013,7 +1013,7 @@ static int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file,
         if (rc < 0)
                 GOTO(out, rc);
 
-        rc = mdc_req2lustre_md(ll_i2lmvexp(inode), req, 1, exp, &md);
+        rc = mdc_req2lustre_md(ll_i2mdcexp(inode), req, 1, exp, &md);
         if (rc)
                 GOTO(out, rc);
         ll_update_inode(f->f_dentry->d_inode, &md);
@@ -1276,7 +1276,7 @@ int ll_fsync(struct file *file, struct dentry *dentry, int data)
 {
         struct inode *inode = dentry->d_inode;
         struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd;
-        struct lustre_id id;
+        struct ll_fid fid;
         struct ptlrpc_request *req;
         int rc, err;
         ENTRY;
@@ -1289,8 +1289,8 @@ int ll_fsync(struct file *file, struct dentry *dentry, int data)
          * that IO to finish before calling the osc and mdc sync methods */
         rc = filemap_fdatawait(inode->i_mapping);
 
-        ll_inode2id(&id, inode);
-        err = md_sync(ll_i2sbi(inode)->ll_lmv_exp, &id, &req);
+        ll_inode2fid(&fid, inode);
+        err = md_sync(ll_i2sbi(inode)->ll_mdc_exp, &fid, &req);
         if (!rc)
                 rc = err;
         if (!err)
@@ -1305,11 +1305,11 @@ int ll_fsync(struct file *file, struct dentry *dentry, int data)
                 oa->o_id = lsm->lsm_object_id;
                 oa->o_gr = lsm->lsm_object_gr;
                 oa->o_valid = OBD_MD_FLID;
-                obdo_from_inode(oa, inode, (OBD_MD_FLTYPE | OBD_MD_FLATIME |
-                                            OBD_MD_FLMTIME | OBD_MD_FLCTIME |
-                                            OBD_MD_FLGROUP));
+                obdo_from_inode(oa, inode, OBD_MD_FLTYPE | OBD_MD_FLATIME |
+                                           OBD_MD_FLMTIME | OBD_MD_FLCTIME |
+                                           OBD_MD_FLGROUP);
 
-                err = obd_sync(ll_i2sbi(inode)->ll_lov_exp, oa, lsm,
+                err = obd_sync(ll_i2sbi(inode)->ll_osc_exp, oa, lsm,
                                0, OBD_OBJECT_EOF);
                 if (!rc)
                         rc = err;
@@ -1322,11 +1322,10 @@ int ll_fsync(struct file *file, struct dentry *dentry, int data)
 int ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
 {
         struct inode *inode = file->f_dentry->d_inode;
-        struct ll_inode_info *li = ll_i2info(inode);
         struct ll_sb_info *sbi = ll_i2sbi(inode);
         struct obd_device *obddev;
         struct ldlm_res_id res_id =
-                { .name = {id_fid(&li->lli_id), id_group(&li->lli_id), LDLM_FLOCK} };
+                    { .name = {inode->i_ino, inode->i_generation, LDLM_FLOCK} };
         struct lustre_handle lockh = {0};
         ldlm_policy_data_t flock;
         ldlm_mode_t mode = 0;
@@ -1395,7 +1394,7 @@ int ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
                "start="LPU64", end="LPU64"\n", inode->i_ino, flock.l_flock.pid,
                flags, mode, flock.l_flock.start, flock.l_flock.end);
 
-        obddev = md_get_real_obd(sbi->ll_lmv_exp, NULL, 0);
+        obddev = md_get_real_obd(sbi->ll_mdc_exp, NULL, 0);
         rc = ldlm_cli_enqueue(obddev->obd_self_export, NULL,
                               obddev->obd_namespace,
                               res_id, LDLM_FLOCK, &flock, mode, &flags,
@@ -1409,10 +1408,10 @@ int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it)
         struct inode *inode = dentry->d_inode;
         struct ll_inode_info *lli;
         struct lov_stripe_md *lsm;
-        struct lustre_id id;
         struct ptlrpc_request *req = NULL;
         struct ll_sb_info *sbi = ll_i2sbi(dentry->d_inode);
         struct lookup_intent oit = { .it_op = IT_GETATTR };
+        struct ll_fid  cfid;
         int rc;
         
         ENTRY;
@@ -1421,21 +1420,17 @@ int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it)
                 CERROR("REPORT THIS LINE TO PETER\n");
                 RETURN(0);
         }
-        
-        ll_inode2id(&id, inode);
         lli = ll_i2info(inode);
-        LASSERT(id_fid(&id) != 0);
-
         CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),name=%s,intent=%s\n",
                inode->i_ino, inode->i_generation, inode, dentry->d_name.name,
                LL_IT2STR(it));
-
 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0))
         lprocfs_counter_incr(ll_i2sbi(inode)->ll_stats, LPROC_LL_REVALIDATE);
 #endif
 
-        rc = md_intent_lock(sbi->ll_lmv_exp, &id,
-                            NULL, 0, NULL, 0, &id, &oit, 0, &req,
+        ll_inode2fid(&cfid, dentry->d_inode);
+        rc = md_intent_lock(sbi->ll_mdc_exp, &cfid,
+                            NULL, 0, NULL, 0, &cfid, &oit, 0, &req,
                             ll_mdc_blocking_ast);
         if (rc < 0)
                 GOTO(out, rc);
index 5e0c95b..ce92461 100644 (file)
@@ -35,17 +35,14 @@ struct ll_ra_info {
 };
 
 struct ll_sb_info {
-        /* this protects pglist and max_r_a_pages.  It isn't safe to grab from
-         * interrupt contexts. */
+        /* this protects pglist and ra_info.  It isn't safe to 
+        * grab from interrupt contexts */
         spinlock_t                ll_lock;
-        
         struct obd_uuid           ll_sb_uuid;
-        struct obd_export        *ll_lmv_exp;
-        struct lmv_desc           ll_lmv_desc;
-        struct obd_export        *ll_lov_exp;
-        struct lov_desc           ll_lov_desc;
-        struct proc_dir_entry    *ll_proc_root;
-        struct lustre_id          ll_rootid;     /* root lustre id */
+        struct obd_export        *ll_mdc_exp;
+        struct obd_export        *ll_osc_exp;
+        struct proc_dir_entry*    ll_proc_root;
+        obd_id                    ll_rootino; /* number of root inode */
 
         struct lustre_mount_data *ll_lmd;
         char                     *ll_instance;
@@ -56,7 +53,7 @@ struct ll_sb_info {
         struct hlist_head         ll_orphan_dentry_list; /*please don't ask -p*/
         struct ll_close_queue    *ll_lcq;
 
-        struct lprocfs_stats     *ll_stats;      /* lprocfs stats counter */
+        struct lprocfs_stats     *ll_stats; /* lprocfs stats counter */
 
         unsigned long             ll_pglist_gen;
         struct list_head          ll_pglist;
@@ -156,8 +153,7 @@ struct ll_async_page {
 
 /* llite/lproc_llite.c */
 int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
-                                struct super_block *sb, char *lov,
-                                char *lmv);
+                                struct super_block *sb, char *osc, char *mdc);
 void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi);
 
 /* llite/dir.c */
@@ -206,7 +202,7 @@ int ll_file_release(struct inode *inode, struct file *file);
 int ll_lsm_getattr(struct obd_export *, struct lov_stripe_md *, struct obdo *);
 int ll_glimpse_size(struct inode *inode);
 int ll_local_open(struct file *file, struct lookup_intent *it);
-int ll_mdc_close(struct obd_export *lmv_exp, struct inode *inode,
+int ll_mdc_close(struct obd_export *mdc_exp, struct inode *inode,
                  struct file *file);
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
 int ll_getattr(struct vfsmount *mnt, struct dentry *de,
@@ -355,18 +351,18 @@ static inline __u64 ll_ts2u64(time_t *time)
 /* don't need an addref as the sb_info should be holding one */
 static inline struct obd_export *ll_s2obdexp(struct super_block *sb)
 {
-        return ll_s2sbi(sb)->ll_lov_exp;
+        return ll_s2sbi(sb)->ll_osc_exp;
 }
 
 /* don't need an addref as the sb_info should be holding one */
-static inline struct obd_export *ll_s2lmvexp(struct super_block *sb)
+static inline struct obd_export *ll_s2mdcexp(struct super_block *sb)
 {
-        return ll_s2sbi(sb)->ll_lmv_exp;
+        return ll_s2sbi(sb)->ll_mdc_exp;
 }
 
-static inline struct client_obd *sbi2lmv(struct ll_sb_info *sbi)
+static inline struct client_obd *sbi2mdc(struct ll_sb_info *sbi)
 {
-        struct obd_device *obd = sbi->ll_lmv_exp->exp_obd;
+        struct obd_device *obd = sbi->ll_mdc_exp->exp_obd;
         if (obd == NULL)
                 LBUG();
         return &obd->u.cli;
@@ -383,14 +379,14 @@ static inline struct obd_export *ll_i2obdexp(struct inode *inode)
         return ll_s2obdexp(inode->i_sb);
 }
 
-static inline struct obd_export *ll_i2lmvexp(struct inode *inode)
+static inline struct obd_export *ll_i2mdcexp(struct inode *inode)
 {
-        return ll_s2lmvexp(inode->i_sb);
+        return ll_s2mdcexp(inode->i_sb);
 }
 
 static inline int ll_mds_max_easize(struct super_block *sb)
 {
-        return sbi2lmv(ll_s2sbi(sb))->cl_max_mds_easize;
+        return sbi2mdc(ll_s2sbi(sb))->cl_max_mds_easize;
 }
 
 static inline __u64 ll_file_maxbytes(struct inode *inode)
index bd2774c..4ab2c4a 100644 (file)
@@ -92,148 +92,130 @@ void lustre_free_sbi(struct super_block *sb)
         EXIT;
 }
 
-int lustre_init_lov_desc(struct ll_sb_info *sbi)
+int lustre_init_ea_size(struct ll_sb_info *sbi)
 {
-        int valsize, rc;
-        ENTRY;
+        struct lov_desc desc;
+        int rc, valsize;
         
-        valsize = sizeof(sbi->ll_lov_desc);
-        memset(&sbi->ll_lov_desc, 0, sizeof(sbi->ll_lov_desc));
-        rc = obd_get_info(sbi->ll_lov_exp, strlen("lovdesc") + 1,
-                          "lovdesc", &valsize, &sbi->ll_lov_desc);
-        RETURN(rc);
-}
+        /* OSC may have larger ea size */
+        valsize = sizeof(desc);
+        rc = obd_get_info(sbi->ll_osc_exp, strlen("lovdesc") + 1, "lovdesc", 
+                          &valsize, &desc);
+        if (rc)
+                RETURN(rc);
+        obd_init_ea_size(sbi->ll_mdc_exp, obd_size_diskmd(sbi->ll_osc_exp, NULL),
+                         desc.ld_tgt_count*sizeof(struct llog_cookie));
 
-int lustre_init_lmv_desc(struct ll_sb_info *sbi)
-{
-        int valsize, rc;
-        ENTRY;
-        
-        valsize = sizeof(sbi->ll_lmv_desc);
-        memset(&sbi->ll_lmv_desc, 0, sizeof(sbi->ll_lmv_desc));
-        rc = obd_get_info(sbi->ll_lmv_exp, strlen("lmvdesc") + 1,
-                          "lmvdesc", &valsize, &sbi->ll_lmv_desc);
         RETURN(rc);
 }
 
-int lustre_common_fill_super(struct super_block *sb, char *lmv, char *lov)
+int lustre_common_fill_super(struct super_block *sb, char *mdc, char *osc)
 {
+        struct inode *root = 0;
         struct ll_sb_info *sbi = ll_s2sbi(sb);
-        struct ptlrpc_request *request = NULL;
-        struct lustre_handle lov_conn = {0, };
-        struct lustre_handle lmv_conn = {0, };
-        struct inode *root = NULL;
         struct obd_device *obd;
+        struct ll_fid rootfid;
         struct obd_statfs osfs;
+        struct ptlrpc_request *request = NULL;
+        struct lustre_handle osc_conn = {0, };
+        struct lustre_handle mdc_conn = {0, };
         struct lustre_md md;
         kdev_t devno;
         int err;
 
-        obd = class_name2obd(lmv);
+        obd = class_name2obd(mdc);
         if (!obd) {
-                CERROR("MDC %s: not setup or attached\n", lmv);
+                CERROR("MDC %s: not setup or attached\n", mdc);
                 RETURN(-EINVAL);
         }
 
         if (proc_lustre_fs_root) {
                 err = lprocfs_register_mountpoint(proc_lustre_fs_root, sb,
-                                                  lov, lmv);
+                                                  osc, mdc);
                 if (err < 0)
                         CERROR("could not register mount in /proc/lustre");
         }
 
-        err = obd_connect(&lmv_conn, obd, &sbi->ll_sb_uuid, 0);
+        err = obd_connect(&mdc_conn, obd, &sbi->ll_sb_uuid, 0);
         if (err == -EBUSY) {
                 CERROR("An MDS (mdc %s) is performing recovery, of which this"
                        " client is not a part.  Please wait for recovery to "
-                       "complete, abort, or time out.\n", lmv);
+                       "complete, abort, or time out.\n", mdc);
                 GOTO(out, err);
         } else if (err) {
-                CERROR("cannot connect to %s: rc = %d\n", lmv, err);
+                CERROR("cannot connect to %s: rc = %d\n", mdc, err);
                 GOTO(out, err);
         }
-        sbi->ll_lmv_exp = class_conn2export(&lmv_conn);
+        sbi->ll_mdc_exp = class_conn2export(&mdc_conn);
 
-        lustre_init_lmv_desc(sbi);
-        
         err = obd_statfs(obd, &osfs, jiffies - HZ);
         if (err)
-                GOTO(out_lmv, err);
+                GOTO(out_mdc, err);
 
-        if (!osfs.os_bsize) {
-                CERROR("Invalid block size is detected.");
-                GOTO(out_lmv, err);
-        }
-
-        sb->s_magic = LL_SUPER_MAGIC;
+        LASSERT(osfs.os_bsize);
         sb->s_blocksize = osfs.os_bsize;
         sb->s_blocksize_bits = log2(osfs.os_bsize);
+        sb->s_magic = LL_SUPER_MAGIC;
         sb->s_maxbytes = PAGE_CACHE_MAXBYTES;
        
-        devno = get_uuid2int(sbi->ll_lmv_exp->exp_obd->obd_uuid.uuid, 
-                             strlen(sbi->ll_lmv_exp->exp_obd->obd_uuid.uuid));
+        devno = get_uuid2int(sbi->ll_mdc_exp->exp_obd->obd_uuid.uuid, 
+                             strlen(sbi->ll_mdc_exp->exp_obd->obd_uuid.uuid));
 
         sb->s_dev = devno;
 
-        obd = class_name2obd(lov);
+        obd = class_name2obd(osc);
         if (!obd) {
-                CERROR("OSC %s: not setup or attached\n", lov);
-                GOTO(out_lmv, err);
+                CERROR("OSC %s: not setup or attached\n", osc);
+                GOTO(out_mdc, err);
         }
 
-        err = obd_connect(&lov_conn, obd, &sbi->ll_sb_uuid, 0);
+        err = obd_connect(&osc_conn, obd, &sbi->ll_sb_uuid, 0);
         if (err == -EBUSY) {
                 CERROR("An OST (osc %s) is performing recovery, of which this"
                        " client is not a part.  Please wait for recovery to "
-                       "complete, abort, or time out.\n", lov);
+                       "complete, abort, or time out.\n", osc);
                 GOTO(out, err);
         } else if (err) {
-                CERROR("cannot connect to %s: rc = %d\n", lov, err);
-                GOTO(out_lmv, err);
-        }
-        sbi->ll_lov_exp = class_conn2export(&lov_conn);
-
-        err = lustre_init_lov_desc(sbi);
-        if (err == 0) {
-                int mdsize = obd_size_diskmd(sbi->ll_lov_exp, NULL);
-                obd_init_ea_size(sbi->ll_lmv_exp, mdsize,
-                                 sbi->ll_lov_desc.ld_tgt_count *
-                                 sizeof(struct llog_cookie));
+                CERROR("cannot connect to %s: rc = %d\n", osc, err);
+                GOTO(out_mdc, err);
         }
-        
-        err = md_getstatus(sbi->ll_lmv_exp, &sbi->ll_rootid);
+        sbi->ll_osc_exp = class_conn2export(&osc_conn);
+
+        lustre_init_ea_size(sbi);
+        err = md_getstatus(sbi->ll_mdc_exp, &rootfid);
         if (err) {
                 CERROR("cannot mds_connect: rc = %d\n", err);
-                GOTO(out_lov, err);
+  &nb