Whamcloud - gitweb
- landing b_fid.
authoryury <yury>
Thu, 11 Nov 2004 11:36:49 +0000 (11:36 +0000)
committeryury <yury>
Thu, 11 Nov 2004 11:36:49 +0000 (11:36 +0000)
137 files changed:
lnet/include/linux/kp30.h
lnet/include/lnet/lnetctl.h
lnet/include/lnet/ptlctl.h
lnet/utils/debug.c
lustre/cmobd/Makefile.in
lustre/cmobd/Makefile.mk
lustre/cmobd/autoMakefile.am
lustre/cmobd/cache_manager_obd.c [deleted file]
lustre/cmobd/cm_internal.h [new file with mode: 0644]
lustre/cmobd/cm_mds_reint.c [new file with mode: 0644]
lustre/cmobd/cm_obd.c [new file with mode: 0644]
lustre/cmobd/cm_oss_reint.c [moved from lustre/cmobd/cmobd_oss_reint.c with 82% similarity]
lustre/cmobd/cm_reint.c [moved from lustre/cmobd/cmobd_reint.c with 70% similarity]
lustre/cmobd/cm_write.c [moved from lustre/cmobd/cmobd_write.c with 92% similarity]
lustre/cmobd/cmobd_internal.h [deleted file]
lustre/cmobd/cmobd_mds_reint.c [deleted file]
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/lustre_snap.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/include/lustre/liblustreapi.h
lustre/include/lustre/lustre_user.h
lustre/kernel_patches/patches/dcache-fid-2.6.7.patch [new file with mode: 0644]
lustre/kernel_patches/patches/ext3-dentry-fid-2.4.24.patch [new file with mode: 0644]
lustre/kernel_patches/patches/ext3-fid-2.6.7.patch [new file with mode: 0644]
lustre/kernel_patches/patches/kksymoops-2.4.24.vanilla.patch
lustre/kernel_patches/series/2.6-vanilla.series
lustre/kernel_patches/series/ldiskfs-2.6-vanilla.series
lustre/kernel_patches/series/vanilla-2.4.24
lustre/ldlm/ldlm_lib.c
lustre/ldlm/ldlm_lock.c
lustre/ldlm/ldlm_lockd.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/autoMakefile.am
lustre/lvfs/fsfilt_ext3.c
lustre/lvfs/fsfilt_smfs.c
lustre/lvfs/fsfilt_snap_ext3.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/obdfilter/filter.c
lustre/obdfilter/filter_internal.h
lustre/obdfilter/filter_io.c
lustre/obdfilter/filter_log.c
lustre/osc/osc_request.c
lustre/ost/ost_handler.c
lustre/portals/include/linux/kp30.h
lustre/portals/include/portals/ptlctl.h
lustre/portals/utils/debug.c
lustre/ptlrpc/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_cow.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/cmknod.c
lustre/tests/cmobd.sh [new file with mode: 0644]
lustre/tests/cobd.sh
lustre/tests/cobd_test.sh
lustre/tests/conf-sanity.sh
lustre/tests/local.sh
lustre/tests/replay-single.sh
lustre/tests/sanity.sh
lustre/tests/uml_cobd.sh
lustre/utils/Lustre/lustredb.py
lustre/utils/lconf
lustre/utils/lfs.c
lustre/utils/liblustreapi.c
lustre/utils/lmc
lustre/utils/lustre_cfg.c
lustre/utils/obd.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index 4e24c71..1ec69d5 100644 (file)
@@ -736,4 +736,14 @@ 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 cfddde2..ef52a25 100644 (file)
@@ -31,6 +31,8 @@
 #define PORTALS_DEV_PATH "/dev/portals"
 #define OBD_DEV_ID 1
 #define OBD_DEV_PATH "/dev/obd"
+#define SMFS_DEV_ID  2
+#define SMFS_DEV_PATH "/dev/snapdev"
 
 int ptl_name2nal(char *str);
 int ptl_parse_ipaddr (__u32 *ipaddrp, char *str);
index cfddde2..ef52a25 100644 (file)
@@ -31,6 +31,8 @@
 #define PORTALS_DEV_PATH "/dev/portals"
 #define OBD_DEV_ID 1
 #define OBD_DEV_PATH "/dev/obd"
+#define SMFS_DEV_ID  2
+#define SMFS_DEV_PATH "/dev/snapdev"
 
 int ptl_name2nal(char *str);
 int ptl_parse_ipaddr (__u32 *ipaddrp, char *str);
index 5b65f24..ba73aeb 100644 (file)
@@ -78,7 +78,7 @@ static const char *portal_debug_subsystems[] =
         {"undefined", "mdc", "mds", "osc", "ost", "class", "log", "llite",
          "rpc", "mgmt", "portals", "libcfs", "socknal", "qswnal", "pinger",
          "filter", "ptlbd", "echo", "ldlm", "lov", "gmnal", "router", "cobd",
-         "ibnal", NULL};
+         "ibnal", "lmv", "cmobd", "smfs", NULL};
 static const char *portal_debug_masks[] =
         {"trace", "inode", "super", "ext2", "malloc", "cache", "info", "ioctl",
          "blocks", "net", "warning", "buffs", "other", "dentry", "portals",
@@ -626,6 +626,7 @@ static struct mod_paths {
         {"obdfilter", "lustre/obdfilter"},
         {"extN", "lustre/extN"},
         {"lov", "lustre/lov"},
+        {"lmv", "lustre/lmv"},
         {"fsfilt_ext3", "lustre/lvfs"},
         {"fsfilt_extN", "lustre/lvfs"},
         {"fsfilt_reiserfs", "lustre/lvfs"},
@@ -637,6 +638,8 @@ static struct mod_paths {
         {"ptlbd", "lustre/ptlbd"},
         {"mgmt_svc", "lustre/mgmt"},
         {"mgmt_cli", "lustre/mgmt"},
+        {"cobd", "lustre/cobd"},
+        {"cmobd", "lustre/cmobd"},
         {"conf_obd", "lustre/obdclass"},
         {NULL, NULL}
 };
index 8c16488..51c1902 100644 (file)
@@ -1,4 +1,4 @@
 MODULES := cmobd 
-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
+cmobd-objs := cm_obd.o cm_reint.o cm_write.o 
+cmobd-objs += cm_oss_reint.o cm_mds_reint.o lproc_cm.o
 @INCLUDE_RULES@
index bcc81ec..4fc7cf2 100644 (file)
@@ -6,6 +6,6 @@
 include $(src)/../portals/Kernelenv
 
 obj-y += cmobd.o
-cmobd-objs := cache_manager_obd.o cmobd_reint.o cmobd_write.o \ 
-             cmobd_oss_reint.o cmobd_mds_reint.o lproc_cm.o
+cmobd-objs := cm_obd.o cm_reint.o cm_write.o \ 
+             cm_oss_reint.o cm_mds_reint.o lproc_cm.o
        
index 35dd6ef..59d6abb 100644 (file)
@@ -8,4 +8,4 @@ modulefs_DATA = cmobd$(KMODEXT)
 endif
 
 MOSTLYCLEANFILES = *.o *.ko *.mod.c
-DIST_SOURCES = $(cmobd-objs:%.o=%.c) cmobd_internal.h
+DIST_SOURCES = $(cmobd-objs:%.o=%.c) cm_internal.h
diff --git a/lustre/cmobd/cache_manager_obd.c b/lustre/cmobd/cache_manager_obd.c
deleted file mode 100644 (file)
index 92d850f..0000000
+++ /dev/null
@@ -1,215 +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 "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
new file mode 100644 (file)
index 0000000..5d32eb6
--- /dev/null
@@ -0,0 +1,33 @@
+/* -*- 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
new file mode 100644 (file)
index 0000000..c5368de
--- /dev/null
@@ -0,0 +1,377 @@
+/* -*- 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 = LTIME_S(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
new file mode 100644 (file)
index 0000000..5d6592d
--- /dev/null
@@ -0,0 +1,319 @@
+/* -*- 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);
similarity index 82%
rename from lustre/cmobd/cmobd_oss_reint.c
rename to lustre/cmobd/cm_oss_reint.c
index 41d5369..aec0557 100644 (file)
 #include <linux/lustre_fsfilt.h>
 #include <linux/lustre_smfs.h>
 
-#include "cmobd_internal.h"
+#include "cm_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 smfs_rec_unpack(struct smfs_proc_args *args, char *record, char **pbuf, 
-                    int *opcode);
+
+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);
 
 /* helper functions for cmobd to construct pseudo lsm */
 int cmobd_dummy_lsm(struct lov_stripe_md **lsmp, int stripe_cnt, 
@@ -72,11 +75,11 @@ void cmobd_free_lsm(struct lov_stripe_md **lsmp)
 }
 
 /* reintegration functions */
-int cmobd_reint_setattr(struct obd_device *obd, void *rec)
+static int cmobd_setattr_reint(struct obd_device *obd, void *rec)
 {
-        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 cm_obd *cmobd = &obd->u.cm;
+        struct lov_obd *lov = &cmobd->master_obd->u.lov;
+        struct obd_export *exp = cmobd->master_exp;
         struct lov_stripe_md *lsm;
         struct obdo *oa = (struct obdo*)rec;
         int rc;
@@ -94,11 +97,11 @@ out:
         RETURN(rc);
 }
 
-int cmobd_reint_create(struct obd_device *obd, void *rec)
+static int cmobd_create_reint(struct obd_device *obd, void *rec)
 {
-        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 cm_obd *cmobd = &obd->u.cm;
+        struct lov_obd *lov = &cmobd->master_obd->u.lov;
+        struct obd_export *exp = cmobd->master_exp;
         struct lov_stripe_md *lsm;
         struct obd_trans_info oti = { 0 };
         struct obdo *oa=(struct obdo*)rec;
@@ -109,14 +112,14 @@ int cmobd_reint_create(struct obd_device *obd, void *rec)
                              (__u32)lov->desc.ld_default_stripe_size);
         if (rc)
                 GOTO(out, rc);
-        if (cmobd->cm_master_group != oa->o_gr) {
+        if (cmobd->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->cm_master_group = oa->o_gr;
+                cmobd->master_group = oa->o_gr;
         }
         rc = obd_create(exp, oa, &lsm, &oti);
 
@@ -199,9 +202,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 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 cm_obd *cmobd = &obd->u.cm;
+        struct obd_device *cache = cmobd->cache_obd;
+        struct lov_obd *lov = &cmobd->master_obd->u.lov;
         struct ldlm_res_id res_id;
         ldlm_policy_data_t policy;
         struct lustre_handle lockh_src = { 0 };
@@ -230,7 +233,7 @@ static int cmobd_write_extents(struct obd_device *obd, struct obdo *oa,
         if (rc)
                 GOTO(out_lock, rc);
         
-        rc = obd_enqueue(cmobd->cm_master_exp, lsm, LDLM_EXTENT, &policy, 
+        rc = obd_enqueue(cmobd->master_exp, lsm, LDLM_EXTENT, &policy, 
                          LCK_PW, &flags, master_blocking_ast, 
                          ldlm_completion_ast, NULL,
                          NULL, 0, NULL, &lockh_dst);
@@ -239,12 +242,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->cm_master_exp, lsm, LCK_PW, &lockh_dst);
+        rc = obd_cancel(cmobd->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->cm_master_exp, lsm, 0, NULL);
+        rc = obd_cancel_unused(cmobd->master_exp, lsm, 0, NULL);
         if (err)
                 rc = err;
 out_lsm:
@@ -253,10 +256,11 @@ out_lock:
         ldlm_lock_decref(&lockh_src, LCK_PR);
         RETURN(rc);
 }
-int cmobd_reint_write(struct obd_device *obd, void *rec)
+
+static int cmobd_write_reint(struct obd_device *obd, void *rec)
 {
-        struct cache_manager_obd *cmobd = &obd->u.cmobd;
-        struct obd_device *cache = cmobd->cm_cache_obd;
+        struct cm_obd *cmobd = &obd->u.cm;
+        struct obd_device *cache = cmobd->cache_obd;
         struct obdo *oa = (struct obdo *)rec;
         struct ldlm_extent *extent = NULL; 
         unsigned long csb, ino;
@@ -266,7 +270,7 @@ int cmobd_reint_write(struct obd_device *obd, void *rec)
 
         size = sizeof(csb);
 
-        obd_get_info(cmobd->cm_cache_exp, strlen("cache_sb") + 1,
+        obd_get_info(cmobd->cache_exp, strlen("cache_sb") + 1,
                      "cache_sb", &size, &csb); 
  
         ino = *(int*)(&oa->o_inline[0]);
@@ -284,8 +288,23 @@ int cmobd_reint_write(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/cmobd_reint.c
rename to lustre/cmobd/cm_reint.c
index f68132f..230f6f1 100644 (file)
 #include <linux/lustre_fsfilt.h>
 #include <linux/lustre_smfs.h>
 
-#include "cmobd_internal.h"
+#include "cm_internal.h"
 
-static int cmobd_reint_record(int opcode, struct obd_device *obd, char *record)
+#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)
 {
-        int rc = 0;
+        if (OSS_REINT(opcode))
+                return cmobd_reint_oss(obd, record, opcode);
         
-        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,
+        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,
                           void *data)
 {
         struct obd_device *obd = (struct obd_device*)data;
@@ -72,6 +74,7 @@ static int cmobd_reint_cb(struct llog_handle *llh, struct llog_rec_hdr *rec,
                 CERROR("log is not plain log\n");
                 RETURN(-EINVAL);
         }
+        
         if (rec->lrh_type != SMFS_UPDATE_REC)
                RETURN(-EINVAL);
 
@@ -79,10 +82,12 @@ static int cmobd_reint_cb(struct llog_handle *llh, struct llog_rec_hdr *rec,
         rc = smfs_rec_unpack(NULL, buf, &pbuf, &opcode);
         if (rc)
                 GOTO(out, rc);
-        rc = cmobd_reint_record(opcode, obd, pbuf); 
+
+        rc = cmobd_reint_record(obd, pbuf, opcode); 
         if (rc)
                 GOTO(out, rc);
-        /*delete this record*/
+
+        /* delete this record. */
         rc = LLOG_DEL_RECORD; 
 out:
         RETURN(rc);
@@ -90,7 +95,7 @@ out:
 
 int cmobd_reintegrate(struct obd_device *obd)
 {
-        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+        struct cm_obd *cmobd = &obd->u.cm;
         struct llog_ctxt *ctxt = NULL;
         struct llog_handle *llh;
         int val_size, rc = 0;
@@ -99,7 +104,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->cm_cache_exp, strlen("reint_log") + 1,
+        rc = obd_get_info(cmobd->cache_exp, strlen("reint_log") + 1,
                           "reint_log", &val_size, &ctxt);
         if (rc)
                 RETURN(rc);
@@ -115,5 +120,3 @@ int cmobd_reintegrate(struct obd_device *obd)
 
         RETURN(rc);
 }
-
-
similarity index 92%
rename from lustre/cmobd/cmobd_write.c
rename to lustre/cmobd/cm_write.c
index 815efc6..2908b64 100644 (file)
@@ -34,7 +34,7 @@
 #include <asm/div64.h>
 #include <linux/pagemap.h>
 
-#include "cmobd_internal.h"
+#include "cm_internal.h"
 
 extern kmem_cache_t *cmobd_extent_slab;
 
@@ -108,8 +108,10 @@ 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;
-                mdc_pack_fid(obdo_fid(oa), inode->i_ino, 0, inode->i_mode);
-
+                
+                /* 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);
                 valid_flags |= OBD_MD_FLMTIME | OBD_MD_FLCTIME;
         }
 
@@ -169,8 +171,8 @@ static int cmobd_send_pages(struct obd_device *obd,
                             obd_count oa_bufs,
                             struct cmobd_extent_set *set)
 {
-        struct cache_manager_obd *cmobd = &obd->u.cmobd;
-        struct obd_export *exp = cmobd->cm_master_exp;
+        struct cm_obd *cmobd = &obd->u.cm;
+        struct obd_export *exp = cmobd->master_exp;
         struct cmobd_async_page *cmap = NULL;
         obd_count i;
         int rc = 0;
@@ -259,7 +261,7 @@ static int cmobd_write_extent(struct obd_device *obd,
                               struct cmobd_extent_info *ei)
 {
         struct cmobd_extent_set *set = ei->ei_set;
-        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+        struct cm_obd *cmobd = &obd->u.cm;
         unsigned long flags;
         struct obd_ioobj ioo;
         struct niobuf_local *lnb;
@@ -293,7 +295,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->cm_cache_exp, oa, 1, &ioo, 
+        ret = obd_preprw(OBD_BRW_READ, cmobd->cache_exp, oa, 1, &ioo, 
                          oa_bufs, rnb, lnb, NULL);
         if (ret)
                 GOTO(out, rc = ret);
@@ -302,7 +304,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->cm_cache_exp, oa, 1, &ioo,
+        rc = obd_commitrw(OBD_BRW_READ, cmobd->cache_exp, oa, 1, &ioo,
                           oa_bufs, lnb, NULL, ret);
 
         /* countdown and wake up */
@@ -355,15 +357,14 @@ 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 cache_manager_obd *cmobd = &obd->u.cmobd;
-        struct cmobd_write_service *ws = cmobd->cm_write_srv;
+        struct cm_obd *cmobd = &obd->u.cm;
+        struct cmobd_write_service *ws = cmobd->write_srv;
         struct cmobd_extent_info *extent = NULL;
         unsigned long flags;
         int rc;
         ENTRY;
 
         lock_kernel();
-        
         ptlrpc_daemonize();
 
         SIGNAL_MASK_LOCK(current, flags);
@@ -416,8 +417,8 @@ static int cmobd_write_main(void *arg)
  * ptlrpc threads functions */
 static int cmobd_start_thread(struct obd_device *obd, char *name)
 {
-        struct cache_manager_obd *cmobd = &obd->u.cmobd;
-        struct cmobd_write_service *ws = cmobd->cm_write_srv;
+        struct cm_obd *cmobd = &obd->u.cm;
+        struct cmobd_write_service *ws = cmobd->write_srv;
         struct l_wait_info lwi = { 0 };
         struct ptlrpc_svc_data d;
         struct ptlrpc_thread *thread;
@@ -460,8 +461,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 cache_manager_obd *cmobd = &obd->u.cmobd;
-        struct cmobd_write_service *ws = cmobd->cm_write_srv;
+        struct cm_obd *cmobd = &obd->u.cm;
+        struct cmobd_write_service *ws = cmobd->write_srv;
         struct l_wait_info lwi = { 0 };
         unsigned long flags;
         ENTRY;
@@ -482,8 +483,8 @@ static void cmobd_stop_thread(struct obd_device *obd,
 
 static void cmobd_stop_all_threads(struct obd_device *obd)
 {
-        struct cache_manager_obd *cmobd = &obd->u.cmobd;
-        struct cmobd_write_service *ws = cmobd->cm_write_srv;
+        struct cm_obd *cmobd = &obd->u.cm;
+        struct cmobd_write_service *ws = cmobd->write_srv;
         unsigned long flags;
         struct ptlrpc_thread *thread;
         ENTRY;
@@ -523,33 +524,33 @@ static int cmobd_start_n_threads(struct obd_device *obd, int num_threads,
 
 void cmobd_cleanup_write_srv(struct obd_device *obd)
 {
-        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+        struct cm_obd *cmobd = &obd->u.cm;
         struct list_head *pos, *n;
         struct cmobd_extent_info *ei;
         ENTRY;
         
         cmobd_stop_all_threads(obd);
         
-        list_for_each_safe(pos, n, &cmobd->cm_write_srv->ws_extents) {
+        list_for_each_safe(pos, n, &cmobd->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->cm_write_srv, sizeof(*cmobd->cm_write_srv));
+        OBD_FREE(cmobd->write_srv, sizeof(*cmobd->write_srv));
         EXIT;
 }
 
 int cmobd_init_write_srv(struct obd_device *obd)
 {
-        struct cache_manager_obd *cmobd = &obd->u.cmobd;
+        struct cm_obd *cmobd = &obd->u.cm;
         struct cmobd_write_service *ws;
         int rc;
         ENTRY;
 
-        OBD_ALLOC(cmobd->cm_write_srv, sizeof(*cmobd->cm_write_srv));
-        if (cmobd->cm_write_srv == NULL)
+        OBD_ALLOC(cmobd->write_srv, sizeof(*cmobd->write_srv));
+        if (cmobd->write_srv == NULL)
                 RETURN(-ENOMEM);
-        ws = cmobd->cm_write_srv;
+        ws = cmobd->write_srv;
         
         INIT_LIST_HEAD(&ws->ws_threads);
         spin_lock_init(&ws->ws_thread_lock);
@@ -583,8 +584,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 cache_manager_obd *cmobd = &obd->u.cmobd;
-        struct cmobd_write_service *ws = cmobd->cm_write_srv;
+        struct cm_obd *cmobd = &obd->u.cm;
+        struct cmobd_write_service *ws = cmobd->write_srv;
         struct cmobd_extent_set *set = ex->ei_set;
         unsigned long flags;
         struct l_wait_info lwi = { 0 };
@@ -611,7 +612,7 @@ wait:
         EXIT;
 } 
 
-static obd_size cmobd_fid2size(struct obd_export *exp, obd_id id, obd_gr grp)
+static obd_size cmobd_id2size(struct obd_export *exp, obd_id id, obd_gr grp)
 {
         struct lvfs_run_ctxt saved;
         struct dentry *de = NULL;
@@ -620,7 +621,7 @@ static obd_size cmobd_fid2size(struct obd_export *exp, obd_id id, obd_gr grp)
         
         push_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL);
         
-        de = obd_lvfs_fid2dentry(exp, id, 0, grp);
+        de = obd_lvfs_id2dentry(exp, id, 0, grp);
         LASSERT(de);
 
         size = de->d_inode->i_size;
@@ -649,8 +650,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 cache_manager_obd *cmobd = &obd->u.cmobd;
-        struct lov_obd *lov = &cmobd->cm_master_obd->u.lov;
+        struct cm_obd *cmobd = &obd->u.cm;
+        struct lov_obd *lov = &cmobd->master_obd->u.lov;
         struct lov_stripe_md *lsm = NULL;
         struct cmobd_extent_set set;
         struct cmobd_extent_info *ex;
@@ -671,7 +672,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->cm_master_exp;
+        set.es_exp = cmobd->master_exp;
         set.es_ext_sz = CMOBD_MAX_EXTENT_SZ;
         set.es_count = 0;
         memcpy(&set.es_oa, oa, sizeof(*oa));
@@ -688,8 +689,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_fid2size(cmobd->cm_cache_exp, 
-                                                   oa->o_id, oa->o_gr) - 1;
+                set.es_extent.end = cmobd_id2size(cmobd->cache_exp, 
+                                                  oa->o_id, oa->o_gr) - 1;
                 if (set.es_extent.end <= 0)
                         GOTO(out, rc = 0);
         }
diff --git a/lustre/cmobd/cmobd_internal.h b/lustre/cmobd/cmobd_internal.h
deleted file mode 100644 (file)
index d245015..0000000
+++ /dev/null
@@ -1,28 +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 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
deleted file mode 100644 (file)
index 0fb8e07..0000000
+++ /dev/null
@@ -1,184 +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 "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;
-} 
-
index f4072eb..a081fc1 100644 (file)
@@ -66,22 +66,24 @@ 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;
-//        struct lustre_handle real_conn = {0,}, cache_conn = {0,};
-        struct lustre_handle  cache_conn = {0,};
-        struct obd_device *real;
+#if 0
+        struct lustre_handle master_conn = {0,};
+#endif
+        struct lustre_handle cache_conn = {0,};
+        struct obd_device *master;
         struct obd_device *cache;
         int rc;
         ENTRY;
 
         if (lcfg->lcfg_inllen1 == 0 || lcfg->lcfg_inlbuf1 == NULL) {
-                CERROR("%s: setup requires real device name\n", 
+                CERROR("%s: setup requires master device name\n", 
                        obd->obd_name);
                 RETURN(-EINVAL);
         }
 
-        real = class_name2obd(lcfg->lcfg_inlbuf1);
-        if (real == NULL) {
-                CERROR("%s: unable to find a client for real: %s\n",
+        master = class_name2obd(lcfg->lcfg_inlbuf1);
+        if (master == NULL) {
+                CERROR("%s: unable to find a client for master: %s\n",
                        obd->obd_name, lcfg->lcfg_inlbuf1);
                 RETURN(-EINVAL);
         }
@@ -91,60 +93,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->cobd_real_name, strlen(lcfg->lcfg_inlbuf1) + 1);
-        if (!cobd->cobd_real_name) 
+        OBD_ALLOC(cobd->master_name, strlen(lcfg->lcfg_inlbuf1) + 1);
+        if (!cobd->master_name) 
                 GOTO(exit, rc = -ENOMEM);
-        memcpy(cobd->cobd_real_name, lcfg->lcfg_inlbuf1, 
+        memcpy(cobd->master_name, lcfg->lcfg_inlbuf1, 
                strlen(lcfg->lcfg_inlbuf1));
         
-        OBD_ALLOC(cobd->cobd_cache_name, strlen(lcfg->lcfg_inlbuf2) + 1);
-        if (!cobd->cobd_cache_name) 
+        OBD_ALLOC(cobd->cache_name, strlen(lcfg->lcfg_inlbuf2) + 1);
+        if (!cobd->cache_name) 
                 GOTO(exit, rc = -ENOMEM);
-        memcpy(cobd->cobd_cache_name, lcfg->lcfg_inlbuf2, 
+        memcpy(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->cobd_real_name, &real_conn);
+        /* don't bother checking attached/setup; obd_connect() should, and it
+         * can change underneath us */
+        rc = connect_to_obd(cobd->master_name, &master_conn);
         if (rc != 0)
                 GOTO(exit, rc);
-        cobd->cobd_real_exp = class_conn2export(&real_conn);
+        cobd->master_exp = class_conn2export(&master_conn);
 #endif        
-        rc = connect_to_obd(cobd->cobd_cache_name, &cache_conn);
+        rc = connect_to_obd(cobd->cache_name, &cache_conn);
         if (rc != 0) {
-                obd_disconnect(cobd->cobd_cache_exp, 0);
+                obd_disconnect(cobd->cache_exp, 0);
                 GOTO(exit, rc);
         }
-        cobd->cobd_cache_exp = class_conn2export(&cache_conn);
-        
+        cobd->cache_exp = class_conn2export(&cache_conn);
         cobd->cache_on = 1;
-        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);
+
+        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);
         }
-        /*default write to real obd*/
 exit:
         if (rc) {
-                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_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);
         }
         RETURN(rc);
 }
@@ -157,20 +159,20 @@ static int cobd_cleanup(struct obd_device *obd, int flags)
         if (!list_empty(&obd->obd_exports))
                 return (-EBUSY);
         
-        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_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->cache_on) { 
-                rc = obd_disconnect(cobd->cobd_cache_exp, flags);
+                rc = obd_disconnect(cobd->cache_exp, flags);
                 if (rc != 0)
                         CERROR("error %d disconnecting cache\n", rc);
         }
-        rc = obd_disconnect(cobd->cobd_real_exp, flags);
+        rc = obd_disconnect(cobd->master_exp, flags);
         if (rc != 0)
-                CERROR("error %d disconnecting real\n", rc);
+                CERROR("error %d disconnecting master\n", rc);
         
         return (rc);
 }
@@ -180,25 +182,21 @@ struct obd_export *cobd_get_exp(struct obd_device *obd)
         struct cache_obd  *cobd = &obd->u.cobd;
         
         if (cobd->cache_on)  
-                return cobd->cobd_cache_exp;
+                return cobd->cache_exp;
         else
-                return cobd->cobd_real_exp;
+                return cobd->master_exp;
 }
 
 static int
 cobd_connect(struct lustre_handle *conn, struct obd_device *obd,
              struct obd_uuid *cluuid, unsigned long connect_flags)
 {
-        int rc;
-        rc = class_connect(conn, obd, cluuid);
-        return rc; 
+        return class_connect(conn, obd, cluuid);
 }
 
 static int cobd_disconnect(struct obd_export *exp, int flags)
 {
-        int rc;
-        rc = class_disconnect(exp, 0);
-        return rc; 
+        return class_disconnect(exp, 0);
 }
 
 static int cobd_get_info(struct obd_export *exp, obd_count keylen,
@@ -206,14 +204,15 @@ 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? */
 
+        /* intercept cache utilisation info? */
         return obd_get_info(cobd_exp, keylen, key, vallen, val);
 }
 
@@ -229,8 +228,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);
 }
 
@@ -311,7 +310,7 @@ static int cobd_destroy(struct obd_export *exp, struct obdo *obdo,
 
 static int cobd_precleanup(struct obd_device *obd, int flags)
 {
-        /*FIXME Do we need some cleanup here?*/
+        /* FIXME-WANGDI: do we need some cleanup here? */
         return 0;
 }
 
@@ -331,8 +330,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;
@@ -362,7 +361,8 @@ 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 ll_fid *rootfid)
+static int cobd_md_getstatus(struct obd_export *exp,
+                             struct lustre_id *rootid)
 {
         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, struct ll_fid *rootfid)
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_getstatus(cobd_exp, rootfid);
+        return md_getstatus(cobd_exp, rootid);
 }
 
 static int cobd_brw(int cmd, struct obd_export *exp, struct obdo *oa,
@@ -675,8 +675,7 @@ 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; 
 }
 
@@ -685,7 +684,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 *real_dev = NULL;
+        struct obd_device *master_dev = NULL;
         struct obd_export *cobd_exp;
         int rc = 0;
  
@@ -694,39 +693,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->cobd_real_exp, 0);
+                        rc = obd_disconnect(cobd->master_exp, 0);
                         if (rc != 0)
-                                CERROR("error %d disconnecting real\n", rc);
-                        rc = connect_to_obd(cobd->cobd_cache_name, &cache_conn);
+                                CERROR("error %d disconnecting master\n", rc);
+                        rc = connect_to_obd(cobd->cache_name, &cache_conn);
                         if (rc != 0)
                                 RETURN(rc); 
-                        cobd->cobd_cache_exp = class_conn2export(&cache_conn);
+                        cobd->cache_exp = class_conn2export(&cache_conn);
                         
                         cobd->cache_on = 1;
                 }
                 break;
         case OBD_IOC_COBD_COFF: 
                 if (cobd->cache_on) {
-                        struct lustre_handle real_conn = {0,};
+                        struct lustre_handle master_conn = {0,};
                         struct obd_device *cache_dev = NULL;
                         int m_easize, m_cooksize;
 
-                        cache_dev = class_exp2obd(cobd->cobd_cache_exp); 
+                        cache_dev = class_exp2obd(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->cobd_cache_exp, 0);
+                        rc = obd_disconnect(cobd->cache_exp, 0);
                         if (rc != 0)
-                                CERROR("error %d disconnecting real\n", rc);
+                                CERROR("error %d disconnecting master\n", rc);
 
-                        /*FIXME, should read from real_dev*/
+                        /* FIXME-WANGDI: should we read from master_dev? */
                         
-                        rc = connect_to_obd(cobd->cobd_real_name, &real_conn);
+                        rc = connect_to_obd(cobd->master_name, &master_conn);
                         if (rc != 0)
                                 RETURN(rc); 
-                        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->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->cache_on = 0;
                 }
                 break;
@@ -833,7 +832,7 @@ static int  cobd_import_event(struct obd_device *obd,
         return 0; 
 }
 
-static int cobd_md_getattr(struct obd_export *exp, struct ll_fid *fid,
+static int cobd_md_getattr(struct obd_export *exp, struct lustre_id *id,
                            unsigned long valid, unsigned int ea_size,
                            struct ptlrpc_request **request)
 {
@@ -846,7 +845,7 @@ static int cobd_md_getattr(struct obd_export *exp, struct ll_fid *fid,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_getattr(cobd_exp, fid, valid, ea_size, request);
+        return md_getattr(cobd_exp, id, valid, ea_size, request);
 }
 
 static int cobd_md_req2lustre_md (struct obd_export *mdc_exp, 
@@ -865,7 +864,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 ll_fid *fid, 
+static int cobd_md_change_cbdata(struct obd_export *exp, struct lustre_id *id, 
                                  ldlm_iterator_t it, void *data)
 {
         struct obd_device *obd = class_exp2obd(exp);
@@ -877,14 +876,12 @@ static int cobd_md_change_cbdata(struct obd_export *exp, struct ll_fid *fid,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_change_cbdata(cobd_exp, fid, it, data);
+        return md_change_cbdata(cobd_exp, id, it, data);
 }
 
-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)
+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)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
@@ -895,7 +892,7 @@ static int cobd_md_getattr_name(struct obd_export *exp, struct ll_fid *fid,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_getattr_name(cobd_exp, fid, filename, namelen, valid,
+        return md_getattr_name(cobd_exp, id, filename, namelen, valid,
                                ea_size, request);
 }
 
@@ -932,7 +929,8 @@ 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 ll_fid *fid)
+static int cobd_md_valid_attrs(struct obd_export *exp,
+                               struct lustre_id *id)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct obd_export *cobd_exp;
@@ -943,7 +941,7 @@ static int cobd_md_valid_attrs(struct obd_export *exp, struct ll_fid *fid)
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_valid_attrs(cobd_exp, fid);
+        return md_valid_attrs(cobd_exp, id);
 }
 
 static int cobd_md_rename(struct obd_export *exp, struct mdc_op_data *data,
@@ -993,7 +991,8 @@ 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 ll_fid *mdc_fid,
+static int cobd_md_readpage(struct obd_export *exp,
+                            struct lustre_id *mdc_id,
                             __u64 offset, struct page *page, 
                             struct ptlrpc_request **request)
 {
@@ -1006,7 +1005,7 @@ static int cobd_md_readpage(struct obd_export *exp, struct ll_fid *mdc_fid,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_readpage(cobd_exp, mdc_fid, offset, page, request);
+        return md_readpage(cobd_exp, mdc_id, offset, page, request);
 }
 
 static int cobd_md_close(struct obd_export *exp, struct obdo *obdo,
@@ -1039,7 +1038,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 ll_fid *fid,
+static int cobd_md_sync(struct obd_export *exp, struct lustre_id *id,
                         struct ptlrpc_request **request)
 {
         struct obd_device *obd = class_exp2obd(exp);
@@ -1052,7 +1051,7 @@ static int cobd_md_sync(struct obd_export *exp, struct ll_fid *fid,
         }
         cobd_exp = cobd_get_exp(obd);
         
-        return md_sync(cobd_exp, fid, request);
+        return md_sync(cobd_exp, id, request);
 }
 
 static int cobd_md_set_open_replay_data(struct obd_export *exp,
@@ -1141,10 +1140,9 @@ 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 ll_fid *pfid, const char *name, int len,
-                               void *lmm, int lmmsize,
-                               struct ll_fid *cfid, struct lookup_intent *it,
+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,
                                int lookup_flags, struct ptlrpc_request **reqp,
                                ldlm_blocking_callback cb_blocking)
 {
@@ -1157,12 +1155,12 @@ static int cobd_md_intent_lock(struct obd_export *exp,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_intent_lock(cobd_exp, pfid, name, len, lmm, lmmsize,
-                              cfid, it, lookup_flags, reqp, cb_blocking);
+        return md_intent_lock(cobd_exp, pid, name, len, lmm, lmmsize,
+                              cid, 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;
@@ -1177,8 +1175,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 ll_fid *fid, char *name,
-                                      int namelen, struct ll_fid *fid2,
+                                      struct lustre_id *id, char *name,
+                                      int namelen, struct lustre_id *id2,
                                       ldlm_iterator_t it, void *data)
 {
         struct obd_device *obd = class_exp2obd(exp);
@@ -1190,8 +1188,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, fid, name, namelen, fid2, it, 
-                                     data);
+        return md_change_cbdata_name(cobd_exp, id, name, namelen,
+                                     id2, it, data);
 }
 static struct obd_ops cobd_obd_ops = {
         .o_owner                = THIS_MODULE,
index 25b1e3a..a40f42d 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.cobd_real_exp);
+                        class_exp2obd(cobd->u.cobd.master_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.cobd_cache_exp);
+                        class_exp2obd(cobd->u.cobd.cache_exp);
                 LASSERT(cache != NULL);
                 rc = snprintf(page, count, "%s\n", cache->obd_uuid.uuid);
         }
index 3c602cd..6573517 100644 (file)
@@ -363,6 +363,7 @@ 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)
 
index 0287964..32cd252 100644 (file)
@@ -57,10 +57,24 @@ 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);
 
@@ -125,7 +139,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);
+                                     unsigned long, unsigned long);
         int     (* fs_del_dir_entry)(struct obd_device *, struct dentry *);
         /*snap operations*/
         int     (* fs_is_redirector)(struct inode *inode);
@@ -375,6 +389,7 @@ 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)
@@ -389,6 +404,34 @@ 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)
 {
@@ -459,10 +502,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_rcvd, void *handle, fsfilt_cb_t cb_func,
+                      __u64 last_num, void *handle, fsfilt_cb_t cb_func,
                       void *cb_data)
 {
-        return obd->obd_fsops->fs_add_journal_cb(obd, sb, last_rcvd, handle,
+        return obd->obd_fsops->fs_add_journal_cb(obd, sb, last_num, handle,
                                                  cb_func, cb_data);
 }
 
@@ -658,11 +701,15 @@ 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 mds)
+                     unsigned long generation, unsigned long mds,
+                     unsigned long fid)
 {
         LASSERT(obd->obd_fsops->fs_add_dir_entry);
+        
         return obd->obd_fsops->fs_add_dir_entry(obd, dir, name,
-                                                namelen, ino, generation, mds);
+                                                namelen, ino,
+                                                generation, mds,
+                                                fid);
 }
 
 static inline int 
index 66e79f1..d9db84e 100644 (file)
@@ -267,7 +267,9 @@ 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 */
 
-#define OBD_INLINESZ    64
+/* this should be sizeof(struct lustre_handle) + sizeof(struct llog_cookie) +
+ * sizeof(struct lustre_id). */
+#define OBD_INLINESZ (80)
 
 /* Note: 64-bit types are 64-bit aligned in structure */
 struct obdo {
@@ -290,6 +292,7 @@ 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 */
 };
@@ -374,13 +377,13 @@ 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_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|\
+#define OBD_MD_REINT    (0x40000000)    /* reintegrate oa */
+#define OBD_MD_FID      (0x80000000)    /* take care about fid component */
+#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| \
                            OBD_MD_MDS))
 
-
 static inline struct lustre_handle *obdo_handle(struct obdo *oa)
 {
         return (struct lustre_handle *)oa->o_inline;
@@ -391,9 +394,9 @@ 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;
         __u64           os_blocks;
@@ -450,6 +453,7 @@ 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 */
 
@@ -523,43 +527,58 @@ 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     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
+#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)
 
 /* INODE LOCK PARTS */
-#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;
+#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 */
 };
 
 struct mea_old {
         __u32 mea_count;
         __u32 mea_master;
-        struct ll_fid mea_fids[0];
+        struct lustre_id mea_ids[0];
 };
 
 #define MEA_MAGIC_LAST_CHAR      0xb2221ca1
@@ -569,11 +588,9 @@ struct mea {
         __u32 mea_magic;
         __u32 mea_count;
         __u32 mea_master;
-        struct ll_fid mea_fids[0];
+        struct lustre_id mea_ids[0];
 };
 
-extern void lustre_swab_ll_fid (struct ll_fid *fid);
-
 #define MDS_STATUS_CONN 1
 #define MDS_STATUS_LOV 2
 
@@ -582,18 +599,20 @@ 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 ll_fid  fid1;
-        struct ll_fid  fid2;
+        struct lustre_id id1;
+        struct lustre_id id2;
         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;
@@ -601,12 +620,10 @@ 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          generation;
+        __u32          nlink;  /* #bytes to read in the case of MDS_READPAGE */
         __u32          eadatasize;
-        __u32          mds;
 };
 
 extern void lustre_swab_mds_body (struct mds_body *b);
@@ -618,31 +635,32 @@ struct lustre_md {
 };
 
 struct mdc_op_data {
-        struct ll_fid fid1;
-        struct ll_fid fid2;
+        struct lustre_id id1;
+        struct lustre_id id2;
         __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 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;
+        __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;
 };
 
 /* Remove this once we declare it in include/linux/fs.h (v21 kernel patch?) */
@@ -666,49 +684,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 ll_fid   cr_fid;
-        struct ll_fid   cr_replayfid;
-        __u64           cr_time;
-        __u64           cr_rdev;
+        __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;
 };
 
 extern void lustre_swab_mds_rec_create (struct mds_rec_create *cr);
 
 struct mds_rec_link {
-        __u32           lk_opcode;
-        __u32           lk_padding;
-        struct ll_fid   lk_fid1;
-        struct ll_fid   lk_fid2;
-        __u64           lk_time;
+        __u32            lk_opcode;
+        __u32            lk_padding;
+        struct lustre_id lk_id1;
+        struct lustre_id lk_id2;
+        __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 ll_fid   ul_fid1;
-        struct ll_fid   ul_fid2;
-        __u64           ul_time;
+        __u32            ul_opcode;
+        __u32            ul_mode;
+        struct lustre_id ul_id1;
+        struct lustre_id ul_id2;
+        __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 ll_fid   rn_fid1;
-        struct ll_fid   rn_fid2;
-        __u64           rn_time;
+        __u32            rn_opcode;
+        __u32            rn_padding;
+        struct lustre_id rn_id1;
+        struct lustre_id rn_id2;
+        __u64            rn_time;
 };
 
 extern void lustre_swab_mds_rec_rename (struct mds_rec_rename *rn);
@@ -852,11 +870,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;
@@ -967,7 +985,7 @@ struct llog_logid_rec {
 
 struct llog_create_rec {
         struct llog_rec_hdr     lcr_hdr;
-        struct ll_fid           lcr_fid;
+        struct lustre_id        lcr_id;
         obd_id                  lcr_oid;
         obd_count               lcr_ogen;
         __u32                   padding;
@@ -992,7 +1010,7 @@ struct llog_unlink_rec {
 
 struct llog_size_change_rec {
         struct llog_rec_hdr     lsc_hdr;
-        struct ll_fid           lsc_fid;
+        struct lustre_id        lsc_id;
         __u32                   lsc_io_epoch;
         __u32                   padding;
         struct llog_rec_tail    lsc_tail;
@@ -1011,8 +1029,8 @@ struct llog_gen_rec {
 
 struct llog_lru_rec {
         struct llog_rec_hdr     llr_hdr;
-        struct ll_fid           llr_cfid;
-        struct ll_fid           llr_pfid;
+        struct lustre_id        llr_cid;
+        struct lustre_id        llr_pid;
         struct llog_rec_tail    llr_tail;
 } __attribute__((packed));
 
@@ -1087,10 +1105,12 @@ 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 ll_fid *obdo_fid(struct obdo *oa)
+static inline struct lustre_id *obdo_id(struct obdo *oa)
 {
-        return (struct ll_fid *)(oa->o_inline + sizeof(struct lustre_handle) +
-                                 sizeof(struct llog_cookie));
+        void *raw_id = oa->o_inline + sizeof(struct lustre_handle) +
+                sizeof(struct llog_cookie);
+        
+        return (struct lustre_id *)raw_id;
 }
 
 #endif
index 7a9d350..a85861b 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
+
+/*
+ * this flag is set in ->it->it_int_flags to show, that inode exists on client
+ * and no fid fetching flags needs to be set in server request.
+ */
+#define LL_IT_EXIST            (1 << 0)
+
 /* target.c */
 struct ptlrpc_request;
 struct recovd_data;
index 1c34c4c..bd8341b 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)
@@ -76,16 +67,17 @@ 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;
@@ -151,31 +143,34 @@ enum {
          LPROC_LL_FILE_OPCODES
 };
 
-static inline void ll_inode2fid(struct ll_fid *fid, struct inode *inode)
+static inline void
+ll_inode2id(struct lustre_id *id, struct inode *inode)
 {
-        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;
+        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));
 }
 
 static inline void 
-ll_prepare_mdc_op_data(struct mdc_op_data *data, struct inode *i1,
-                       struct inode *i2, const char *name, int namelen,
-                       int mode)
+ll_prepare_mdc_data(struct mdc_op_data *data, struct inode *i1,
+                    struct inode *i2, const char *name, int namelen,
+                    int mode)
 {
         LASSERT(i1);
 
-        ll_inode2fid(&data->fid1, i1);
+        ll_inode2id(&data->id1, i1);
 
         /* it could be directory with mea */
         data->mea1 = ll_i2info(i1)->lli_mea;
 
         if (i2) {
-                ll_inode2fid(&data->fid2, i2);
+                ll_inode2id(&data->id2, i2);
                 data->mea2 = ll_i2info(i2)->lli_mea;
         }
 
+       data->valid = 0;
         data->name = name;
         data->namelen = namelen;
         data->create_mode = mode;
index c125662..6379016 100644 (file)
@@ -53,29 +53,29 @@ struct ll_file_data;
 #define LUSTRE_MDC_NAME "mdc"
 
 struct mds_update_record {
-        __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;
+        __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;
         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 REAL_MDS_NUMBER       1 
-#define CACHE_MDS_NUMBER      0 
+#define MDS_MASTER_OBD           1
+#define MDS_CACHE_OBD            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,13 +172,18 @@ int mds_reint_rec(struct mds_update_record *r, int offset,
 
 /* mds/handler.c */
 #ifdef __KERNEL__
-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);
+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);
 int mds_update_server_data(struct obd_device *, int force_sync);
+int mds_update_last_fid(struct obd_device *obd, void *handle, 
+                       int force_sync);
 
 /* mds/mds_fs.c */
 int mds_fs_setup(struct obd_device *obddev, struct vfsmount *mnt);
@@ -192,13 +197,12 @@ 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 ll_fid *fid, 
+int mdc_change_cbdata(struct obd_export *exp, struct lustre_id *id, 
                       ldlm_iterator_t it, void *data);
-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,
+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, 
                     ldlm_blocking_callback cb_blocking);
 int mdc_enqueue(struct obd_export *exp,
                 int lock_type,
@@ -218,11 +222,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 ll_fid *rootfid);
-int mdc_getattr(struct obd_export *exp, struct ll_fid *fid,
+int mdc_getstatus(struct obd_export *exp, struct lustre_id *rootid);
+int mdc_getattr(struct obd_export *exp, struct lustre_id *id,
                 unsigned long valid, unsigned int ea_size,
                 struct ptlrpc_request **request);
-int mdc_getattr_name(struct obd_export *exp, struct ll_fid *fid,
+int mdc_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);
 int mdc_setattr(struct obd_export *exp, struct mdc_op_data *data,
@@ -231,7 +235,9 @@ 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);
@@ -239,7 +245,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 ll_fid *mdc_fid,
+int mdc_readpage(struct obd_export *exp, struct lustre_id *id,
                  __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,
@@ -251,28 +257,23 @@ 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 ll_fid *fid,
+int mdc_sync(struct obd_export *exp, struct lustre_id *id,
              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 *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;
-}
+
+int mdc_llog_process(struct obd_export *, char *, llog_cb_t,
+                     void *);
+
+int mdc_done_writing(struct obd_export *, struct obdo *);
 
 /* 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 f3569c0..3ccee10 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/lustre_ha.h>
 #include <linux/lustre_import.h>
 #include <linux/lprocfs_status.h>
+#include <linux/lustre_compat25.h>
 
 /* MD flags we _always_ use */
 #define PTLRPC_MD_OPTIONS  (PTL_MD_EVENT_START_DISABLE | \
@@ -708,15 +709,94 @@ 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);
+                      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))
+
+#define id_equal_fid(id1, id2)                  \
+        (id_fid((id1)) == id_fid((id2)) &&      \
+         id_group((id1)) == id_group((id2)))
+
+#define id_equal_stc(id1, id2)                  \
+        (id_ino((id1)) == id_ino((id2)) &&      \
+         id_gen((id1)) == id_gen((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 = LTIME_S(CURRENT_TIME);
+}
+#endif
 
 /* ldlm/ldlm_lib.c */
 int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf);
index 62efd3c..b6fd845 100644 (file)
@@ -33,6 +33,10 @@ 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;
@@ -124,11 +128,14 @@ 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
@@ -313,9 +320,10 @@ 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
+                
+                /*
+                 * here we must release the cache_inode, otherwise we will have
+                 * no chance to do it later.
                  */
                 cache_inode->i_state &=~I_LOCK;
                 inode->i_blocks = cache_inode->i_blocks;
@@ -433,6 +441,11 @@ 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 4581468..bc50126 100644 (file)
@@ -112,30 +112,6 @@ struct snap_ea{
                 (v & 0xFF)
                                                                                                                                                                                                      
                                                                                                                                                                                                      
-#define EXT3_EA_TRANS_BLOCKS            EXT3_DATA_TRANS_BLOCKS
-#define EXT3_SETMETA_TRANS_BLOCKS       EXT3_DATA_TRANS_BLOCKS
-#define EXT3_NEWINODE_TRANS_BLOCKS      10
-#define SNAP_INSERTLIST_TRANS_BLOCKS    (2 * EXT3_EA_TRANS_BLOCKS + 1)
-#define SNAP_DELETELIST_TRANS_BLOCKS    (2 * EXT3_EA_TRANS_BLOCKS + 2)
-#define SNAP_COPYBLOCK_TRANS_BLOCKS     (EXT3_DATA_TRANS_BLOCKS)
-#define SNAP_MIGRATEDATA_TRANS_BLOCKS   2
-#define SNAP_SETIND_TRANS_BLOCKS        (SNAP_INSERTLIST_TRANS_BLOCKS + 1)
-#define SNAP_ADDORPHAN_TRANS_BLOCKS     2
-#define SNAP_REMOVEORPHAN_TRANS_BLOCKS  1
-#define SNAP_RESTOREORPHAN_TRANS_BLOCKS (EXT3_EA_TRANS_BLOCKS + \
-                                         SNAP_DELETELIST_TRANS_BLOCKS + \
-                                         EXT3_NEWINODE_TRANS_BLOCKS + \
-                                         2 * SNAP_MIGRATEDATA_TRANS_BLOCKS)
-#define SNAP_BIGCOPY_TRANS_BLOCKS       (2 * EXT3_DATA_TRANS_BLOCKS)
-#define SNAP_CREATEIND_TRANS_BLOCKS     (EXT3_NEWINODE_TRANS_BLOCKS + \
-                                         SNAP_MIGRATEDATA_TRANS_BLOCKS + \
-                                         SNAP_SETIND_TRANS_BLOCKS + \
-                                         SNAP_BIGCOPY_TRANS_BLOCKS + 3)
-#define SNAP_MIGRATEBLK_TRANS_BLOCKS    2
-#define SNAP_DESTROY_TRANS_BLOCKS       (SNAP_DELETELIST_TRANS_BLOCKS + \
-                                         EXT3_EA_TRANS_BLOCKS + 2)
-#define SNAP_RESTORE_TRANS_BLOCKS       (EXT3_NEWINODE_TRANS_BLOCKS + \
-                                         2 * SNAP_MIGRATEDATA_TRANS_BLOCKS + 1)
 /*Snap Table*/
 #define SNAP_MAX               32      
 #define SNAP_MAX_TABLES        32      
@@ -188,6 +164,7 @@ struct snap_super_info {
         struct fsfilt_operations *snap_cache_fsfilt; 
         struct list_head          snap_list;
         int                       snap_table_size;
+        int                       snap_count;
 };
 
 extern int smfs_add_snap_item(struct super_block *sb, char *path_name, 
index 3585660..fcccab4 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <linux/kp30.h>
 
-#define LL_FID_NAMELEN (16 + 1 + 8 + 1)
+#define LL_ID_NAMELEN (16 + 1 + 8 + 1)
 
 #if defined __KERNEL__
 #include <linux/lustre_compat25.h>
@@ -28,7 +28,8 @@ struct lvfs_ucred {
 };
 
 struct lvfs_callback_ops {
-        struct dentry *(*l_fid2dentry)(__u64 id_ino, __u32 gen, __u64 gr, void *data);
+        struct dentry *(*l_id2dentry)(__u64 ino, __u32 gen, 
+                                      __u64 gr, void *data);
 };
 
 #define OBD_RUN_CTXT_MAGIC      0xC0FFEEAA
@@ -58,7 +59,8 @@ struct lvfs_run_ctxt {
 #endif
 
 /* lvfs_common.c */
-struct dentry *lvfs_fid2dentry(struct lvfs_run_ctxt *, __u64, __u32, __u64 ,void *data);
+struct dentry *lvfs_id2dentry(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);
@@ -89,27 +91,25 @@ 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 *fid_name,
-                                               struct dentry *dparent,
-                                               int fid_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 *name, struct dentry *dparent, int namelen)
 {
         struct dentry *dchild;
 #ifdef S_PDIROPS
        struct qstr qstr;
        void *lock;
-       qstr.name = fid_name;
-       qstr.len = fid_namelen;
+       qstr.name = name;
+       qstr.len = namelen;
        lock = lock_dir(dparent->d_inode, &qstr);
 #else
         down(&dparent->d_inode->i_sem);
 #endif
 
-        dchild = lookup_one_len(fid_name, dparent, fid_namelen);
+        dchild = lookup_one_len(name, dparent, namelen);
 
 #ifdef S_PDIROPS
        unlock_dir(dparent->d_inode, lock);
@@ -127,9 +127,10 @@ static inline void ll_sleep(int t)
 }
 #endif
 
-static inline int ll_fid2str(char *str, __u64 id, __u32 generation)
+static inline int ll_id2str(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 ae27f81..5d84673 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_FID_NAMELEN];
+        char            lld_name[LL_ID_NAMELEN];
 };
 struct l_readdir_callback {
         struct l_linux_dirent *lrc_dirent;
index c9cc688..fdeeb97 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,44 +332,49 @@ struct mds_obd {
         struct ptlrpc_service           *mds_readpage_service;
         struct super_block              *mds_sb;
         struct vfsmount                 *mds_vfsmnt;
-        struct dentry                   *mds_fid_de;
+        struct dentry                   *mds_id_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;
+        
+        __u64                            mds_last_fid;
+        struct semaphore                 mds_last_fid_sem;
+       int                              mds_last_fid_changed;
+        
         struct semaphore                 mds_epoch_sem;
-        struct ll_fid                    mds_rootfid;
+        struct lustre_id                 mds_rootid;
         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 llog_handle              *mds_catalog;
-        struct obd_device               *mds_osc_obd; /* XXX lov_obd */
+        struct obd_device               *mds_lov_obd;
         struct obd_uuid                  mds_lov_uuid;
         char                            *mds_profile;
-        struct obd_export               *mds_osc_exp; /* XXX lov_exp */
+        struct obd_export               *mds_lov_exp;
         int                              mds_has_lov_desc;
         struct lov_desc                  mds_lov_desc;
         obd_id                          *mds_lov_objids;
         int                              mds_lov_objids_valid;
         int                              mds_lov_nextid_set;
         struct file                     *mds_lov_objid_filp;
-        spinlock_t                      mds_lov_lock;
+        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; /* XXX lmv_obd */
-        struct obd_export               *mds_lmv_exp; /* XXX lov_exp */
+        struct obd_device               *mds_lmv_obd;
+        struct obd_export               *mds_lmv_exp;
+
         struct ptlrpc_service           *mds_create_service;
         struct semaphore                 mds_lmv_sem;
         uid_t                            mds_squash_uid;
@@ -377,7 +382,8 @@ struct mds_obd {
         ptl_nid_t                        mds_nosquash_nid;
         atomic_t                         mds_real_clients;
         struct obd_uuid                  mds_lmv_uuid;
-        struct dentry                   *mds_fids_dir;
+        struct dentry                   *mds_id_dir;
+        int                              mds_obd_type;
         int                              mds_lmv_connected;
         struct dentry                   *mds_unnamed_dir; /* for mdt_obd_create only */
 };
@@ -426,54 +432,55 @@ 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 *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 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 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;
-        struct semaphore lov_llog_sem;
-        int bufsize;
-        int refcount;
-        int lo_catalog_loaded:1;
-        unsigned long lov_connect_flags;
-        struct lov_tgt_desc *tgts;
+        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;
 };
 
 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;
@@ -492,13 +499,13 @@ struct niobuf_local {
         int rc;
 };
 
-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;
+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;
 };
         
 
@@ -628,34 +635,35 @@ 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 cache_manager_obd cmobd;
+                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;
         } 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           0x0001
-#define OBD_OPT_FAILOVER        0x0002
-#define OBD_OPT_REAL_CLIENT     0x0004
-#define OBD_OPT_MDS_CONNECTION  0x0008
+#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_LLOG_FL_SENDNOW     0x0001
-#define OBD_LLOG_FL_CREATE      0x0002
+#define OBD_LLOG_FL_SENDNOW       (1 << 0)
+#define OBD_LLOG_FL_CREATE        (1 << 1)
 
 struct mdc_op_data;
 
@@ -805,6 +813,11 @@ 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);
 
         /* 
@@ -815,11 +828,11 @@ struct obd_ops {
 };
 
 struct md_ops {
-        int (*m_getstatus)(struct obd_export *, struct ll_fid *);
-        int (*m_change_cbdata)(struct obd_export *, struct ll_fid *,
+        int (*m_getstatus)(struct obd_export *, struct lustre_id *);
+        int (*m_change_cbdata)(struct obd_export *, struct lustre_id *,
                                ldlm_iterator_t, void *);
-        int (*m_change_cbdata_name)(struct obd_export *, struct ll_fid *,
-                                    char *, int, struct ll_fid *,
+        int (*m_change_cbdata_name)(struct obd_export *, struct lustre_id *,
+                                    char *, int, struct lustre_id *,
                                     ldlm_iterator_t, void *);
         int (*m_close)(struct obd_export *, struct obdo *,
                        struct obd_client_handle *,
@@ -832,15 +845,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 ll_fid *,
+        int (*m_getattr)(struct obd_export *, struct lustre_id *,
                          unsigned long, unsigned int,
                          struct ptlrpc_request **);
-        int (*m_getattr_name)(struct obd_export *, struct ll_fid *,
+        int (*m_getattr_name)(struct obd_export *, struct lustre_id *,
                               char *, int, unsigned long,
                               unsigned int, struct ptlrpc_request **);
         int (*m_intent_lock)(struct obd_export *,
-                             struct ll_fid *, const char *, int,
-                             void *, int, struct ll_fid *,
+                             struct lustre_id *, const char *, int,
+                             void *, int, struct lustre_id *,
                              struct lookup_intent *, int,
                              struct ptlrpc_request **,
                              ldlm_blocking_callback);
@@ -852,15 +865,16 @@ 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 ll_fid *,
+        int (*m_sync)(struct obd_export *, struct lustre_id *,
                       struct ptlrpc_request **);
-        int (*m_readpage)(struct obd_export *, struct ll_fid *,
+        int (*m_readpage)(struct obd_export *, struct lustre_id *,
                           __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 ll_fid *);
-        struct obd_device * (*m_get_real_obd)(struct obd_export *,
-                             char *name, int len);
+        int (*m_valid_attrs)(struct obd_export *, struct lustre_id *);
+        
+        struct obd_device *(*m_get_real_obd)(struct obd_export *,
+                                             char *name, int len);
         
         int (*m_req2lustre_md)(struct obd_export *exp, 
                                struct ptlrpc_request *req, unsigned int offset,
@@ -875,24 +889,26 @@ 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 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.
+        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.
          */
 };
 
-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 6a2a682..726c4bd 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_osc;
-        char * lp_mdc;
+        char *lp_profile;
+        char *lp_lov;
+        char *lp_lmv;
 };
 
 struct lustre_profile *class_get_profile(char * prof);
@@ -141,6 +141,7 @@ 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);
@@ -154,9 +155,10 @@ 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 failover);
-void class_disconnect_exports(struct obd_device *obddev, int failover);
-void class_disconnect_stale_exports(struct obd_device *obddev, int failover);
+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);
+
 /* 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);
@@ -698,6 +700,17 @@ 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;
@@ -719,12 +732,13 @@ static inline int obd_destroy_export(struct obd_export *exp)
 }
 
 static inline struct dentry *
-obd_lvfs_fid2dentry(struct obd_export *exp, __u64 id_ino, __u32 gen, __u64 gr)
+obd_lvfs_id2dentry(struct obd_export *exp, __u64 ino, 
+                   __u32 gen, __u64 gr)
 {
         LASSERT(exp->exp_obd);
 
-        return lvfs_fid2dentry(&exp->exp_obd->obd_lvfs_ctxt, id_ino, gen, gr,
-                               exp->exp_obd);
+        return lvfs_id2dentry(&exp->exp_obd->obd_lvfs_ctxt, 
+                              ino, gen, gr, exp->exp_obd);
 }
 
 #ifndef time_before
@@ -1188,20 +1202,21 @@ 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 ll_fid *fid)
+
+static inline int md_getstatus(struct obd_export *exp, struct lustre_id *id)
 {
         int rc;
 
         EXP_CHECK_MD_OP(exp, getstatus);
         MD_COUNTER_INCREMENT(exp->exp_obd, getstatus);
-        rc = MDP(exp->exp_obd, getstatus)(exp, fid);
+        rc = MDP(exp->exp_obd, getstatus)(exp, id);
         RETURN(rc);
 }
 
-/* this function notifies MDC, that inode described by @fid gets removed from
+/* this function notifies MDC, that inode described by @id gets removed from
  * memory.*/
 static inline int md_delete_object(struct obd_export *exp,
-                                   struct ll_fid *fid)
+                                   struct lustre_id *id)
 {
         int rc;
         ENTRY;
@@ -1213,11 +1228,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, fid);
+        rc = MDP(exp->exp_obd, delete_object)(exp, id);
         RETURN(rc);
 }
 
-static inline int md_getattr(struct obd_export *exp, struct ll_fid *fid,
+static inline int md_getattr(struct obd_export *exp, struct lustre_id *id,
                              unsigned long valid, unsigned int ea_size,
                              struct ptlrpc_request **request)
 {
@@ -1225,24 +1240,24 @@ static inline int md_getattr(struct obd_export *exp, struct ll_fid *fid,
         ENTRY;
         EXP_CHECK_MD_OP(exp, getattr);
         MD_COUNTER_INCREMENT(exp->exp_obd, getattr);
-        rc = MDP(exp->exp_obd, getattr)(exp, fid, valid, ea_size, request);
+        rc = MDP(exp->exp_obd, getattr)(exp, id, valid, ea_size, request);
         RETURN(rc);
 }
 
-static inline int md_change_cbdata(struct obd_export *exp, struct ll_fid *fid,
+static inline int md_change_cbdata(struct obd_export *exp, struct lustre_id *id,
                                    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, fid, it, data);
+        rc = MDP(exp->exp_obd, change_cbdata)(exp, id, it, data);
         RETURN(rc);
 }
 
 static inline int md_change_cbdata_name(struct obd_export *exp,
-                                        struct ll_fid *fid, char *name,
-                                        int namelen, struct ll_fid *fid2,
+                                        struct lustre_id *id, char *name,
+                                        int namelen, struct lustre_id *id2,
                                         ldlm_iterator_t it, void *data)
 {
         int rc;
@@ -1254,8 +1269,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, fid, name, namelen,
-                                                   fid2, it, data);
+        rc = MDP(exp->exp_obd, change_cbdata_name)(exp, id, name, namelen,
+                                                   id2, it, data);
         RETURN(rc);
 }
 
@@ -1315,7 +1330,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 ll_fid *fid,
+static inline int 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)
@@ -1324,15 +1339,15 @@ static inline int md_getattr_name(struct obd_export *exp, struct ll_fid *fid,
         ENTRY;
         EXP_CHECK_MD_OP(exp, getattr_name);
         MD_COUNTER_INCREMENT(exp->exp_obd, getattr_name);
-        rc = MDP(exp->exp_obd, getattr_name)(exp, fid, filename, namelen,
+        rc = MDP(exp->exp_obd, getattr_name)(exp, id, filename, namelen,
                                              valid, ea_size, request);
         RETURN(rc);
 }
 
 static inline int md_intent_lock(struct obd_export *exp,
-                                 struct ll_fid *pfid, const char *name,
+                                 struct lustre_id *pid, const char *name,
                                  int len, void *lmm, int lmmsize,
-                                 struct ll_fid *cfid, struct lookup_intent *it,
+                                 struct lustre_id *cid, struct lookup_intent *it,
                                  int flags, struct ptlrpc_request **reqp,
                                  ldlm_blocking_callback cb_blocking)
 {
@@ -1340,8 +1355,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, pfid, name, len,
-                                            lmm, lmmsize, cfid, it, flags,
+        rc = MDP(exp->exp_obd, intent_lock)(exp, pid, name, len,
+                                            lmm, lmmsize, cid, it, flags,
                                             reqp, cb_blocking);
         RETURN(rc);
 }
@@ -1385,18 +1400,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 ll_fid *fid,
+static inline int md_sync(struct obd_export *exp, struct lustre_id *id,
                                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, fid, request);
+        rc = MDP(exp->exp_obd, sync)(exp, id, request);
         RETURN(rc);
 }
 
-static inline int md_readpage(struct obd_export *exp, struct ll_fid *fid,
+static inline int md_readpage(struct obd_export *exp, struct lustre_id *id,
                               __u64 offset, struct page *page,
                               struct ptlrpc_request **request)
 {
@@ -1404,7 +1419,7 @@ static inline int md_readpage(struct obd_export *exp, struct ll_fid *fid,
         ENTRY;
         EXP_CHECK_MD_OP(exp, readpage);
         MD_COUNTER_INCREMENT(exp->exp_obd, readpage);
-        rc = MDP(exp->exp_obd, readpage)(exp, fid, offset, page, request);
+        rc = MDP(exp->exp_obd, readpage)(exp, id, offset, page, request);
         RETURN(rc);
 }
 
@@ -1429,12 +1444,13 @@ 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 ll_fid *fid)
+static inline int md_valid_attrs(struct obd_export *exp,
+                                 struct lustre_id *id)
 {
         ENTRY;
         EXP_CHECK_MD_OP(exp, valid_attrs);
         MD_COUNTER_INCREMENT(exp->exp_obd, valid_attrs);
-        return MDP(exp->exp_obd, valid_attrs)(exp, fid);
+        return MDP(exp->exp_obd, valid_attrs)(exp, id);
 }
 
 static inline int md_req2lustre_md(struct obd_export *exp,
@@ -1479,7 +1495,8 @@ 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 a3dc652..ad5d653 100644 (file)
@@ -7,5 +7,4 @@
 
 #define OBD_LMV_DEVICENAME "lmv"
 
-
 #endif
index 350bd09..d639751 100644 (file)
@@ -33,7 +33,7 @@ extern int llapi_file_create(char *name, long stripe_size, int stripe_offset,
                              int stripe_count, int stripe_pattern);
 extern int llapi_file_get_stripe(char *path, struct lov_user_md *lum);
 extern int llapi_find(char *path, struct obd_uuid *obduuid, int recursive,
-                      int verbose, int quiet);
+                      int verbose, int quiet, int showfid);
 extern int llapi_target_check(int num_types, char **obd_types, char *dir);
 extern int llapi_catinfo(char *dir, char *keyword, char *node_name);
 extern int llapi_lov_get_uuids(int fd, struct obd_uuid *uuidp, int *ost_count);
index ab573c1..e1e758f 100644 (file)
@@ -35,6 +35,7 @@
 
 #define IOC_MDC_TYPE         'i'
 #define IOC_MDC_GETSTRIPE    _IOWR(IOC_MDC_TYPE, 21, struct lov_mds_md *)
+#define IOC_MDC_SHOWFID      _IOWR(IOC_MDC_TYPE, 23, struct lustre_id *)
 
 #ifndef EXT3_IOC_GETFLAGS
 #define        EXT3_IOC_GETFLAGS               _IOR('f', 1, long)
diff --git a/lustre/kernel_patches/patches/dcache-fid-2.6.7.patch b/lustre/kernel_patches/patches/dcache-fid-2.6.7.patch
new file mode 100644 (file)
index 0000000..2d310b0
--- /dev/null
@@ -0,0 +1,11 @@
+diff -rupN linux-2.6.7.old/include/linux/dcache.h linux-2.6.7/include/linux/dcache.h
+--- linux-2.6.7.old/include/linux/dcache.h     2004-11-05 16:48:26.224926856 +0200
++++ linux-2.6.7/include/linux/dcache.h 2004-11-04 09:21:03.000000000 +0200
+@@ -97,6 +97,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) */
+       /*
+        * The next three fields are touched by __d_lookup.  Place them here
+        * so they all fit in a 16-byte range, with 16-byte alignment.
diff --git a/lustre/kernel_patches/patches/ext3-dentry-fid-2.4.24.patch b/lustre/kernel_patches/patches/ext3-dentry-fid-2.4.24.patch
new file mode 100644 (file)
index 0000000..0aa7916
--- /dev/null
@@ -0,0 +1,52 @@
+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
diff --git a/lustre/kernel_patches/patches/ext3-fid-2.6.7.patch b/lustre/kernel_patches/patches/ext3-fid-2.6.7.patch
new file mode 100644 (file)
index 0000000..d39b036
--- /dev/null
@@ -0,0 +1,40 @@
+diff -rupN linux-2.6.7.old/fs/ext3/namei.c linux-2.6.7/fs/ext3/namei.c
+--- linux-2.6.7.old/fs/ext3/namei.c    2004-11-05 16:44:21.000000000 +0200
++++ linux-2.6.7/fs/ext3/namei.c        2004-11-05 16:57:12.858866328 +0200
+@@ -1163,6 +1163,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;
+                       ext3_unlock_htree(dir, lock);
+                       d_add(dentry, NULL);
+@@ -1391,7 +1392,7 @@ 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 */
+       if (!de) {
+               de = (struct ext3_dir_entry_2 *)bh->b_data;
+               top = bh->b_data + dir->i_sb->s_blocksize - reclen;
+@@ -1444,6 +1445,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.6.7.old/include/linux/ext3_fs.h linux-2.6.7/include/linux/ext3_fs.h
+--- linux-2.6.7.old/include/linux/ext3_fs.h    2004-11-05 16:44:21.000000000 +0200
++++ linux-2.6.7/include/linux/ext3_fs.h        2004-11-05 16:56:17.183330296 +0200
+@@ -616,7 +616,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 5ea2c92..ad05611 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.10 2004/10/29 15:04:35 eeb Exp $"
++#ident "$Id: kksymoops-2.4.24.vanilla.patch,v 1.11 2004/11/11 11:34:26 yury Exp $"
 +
 +#ifndef MODUTILS_KALLSYMS_H
 +#define MODUTILS_KALLSYMS_H 1
index 6a9d4cf..fb5f213 100644 (file)
@@ -16,3 +16,4 @@ lookup_bdev_init_intent.patch
 dcache-mds-num-2.6.7.patch
 dynamic-locks-2.6.7.patch
 vfs-pdirops-2.6.7.patch
+dcache-fid-2.6.7.patch
index 3b561e4..e04c886 100644 (file)
@@ -14,3 +14,4 @@ ext3-extents-in-ea-ioctl-2.6.7.patch
 ext3-extents-in-ea-exports-symbol-2.6.7.patch
 ext3-mds-num-2.6.7.patch
 ext3-inode-reuse-2.6.7.patch
+ext3-fid-2.6.7.patch
index fd99cca..ba9c372 100644 (file)
@@ -50,3 +50,4 @@ 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-2.4.24.patch
index f384e96..50f2f97 100644 (file)
@@ -417,7 +417,7 @@ out_sem:
         return rc;
 }
 
-int client_disconnect_export(struct obd_export *exp, int failover)
+int client_disconnect_export(struct obd_export *exp, int flags)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct client_obd *cli = &obd->u.cli;
@@ -810,6 +810,7 @@ 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;
@@ -865,6 +866,8 @@ 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
@@ -904,6 +907,7 @@ void target_cleanup_recovery(struct obd_device *obd)
          }
 }
 
+#ifdef __KERNEL__
 static void target_abort_recovery(void *data)
 {
         struct obd_device *obd = data;
@@ -919,6 +923,7 @@ 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)
 {
@@ -940,6 +945,7 @@ 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);
@@ -952,7 +958,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)
@@ -970,6 +976,7 @@ 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;
@@ -1043,7 +1050,6 @@ target_next_replay_req(struct obd_device *obd)
         return req;
 }
 
-#ifdef __KERNEL__
 static int target_recovery_thread(void *arg)
 {
         struct obd_device *obd = arg;
@@ -1138,6 +1144,7 @@ void target_stop_recovery_thread(struct obd_device *obd)
         }
 }
 #endif
+
 int target_queue_recovery_request(struct ptlrpc_request *req,
                                   struct obd_device *obd)
 {
index b423708..8a81f04 100644 (file)
@@ -1102,15 +1102,24 @@ struct ldlm_resource *ldlm_lock_convert(struct ldlm_lock *lock, int new_mode,
         struct ldlm_resource *res;
         struct ldlm_namespace *ns;
         int granted = 0;
+        int old_mode, rc;
+        ldlm_error_t err;
         ENTRY;
 
-        LBUG();
+        if (new_mode == lock->l_granted_mode) { // No changes? Just return.
+                *flags |= LDLM_FL_BLOCK_GRANTED;
+                RETURN(lock->l_resource);
+        }
+                                                                                                                                                                                                     
+        LASSERTF(new_mode == LCK_PW && lock->l_granted_mode == LCK_PR,
+                 "new_mode %u, granted %u\n", new_mode, lock->l_granted_mode);
 
         res = lock->l_resource;
         ns = res->lr_namespace;
 
         l_lock(&ns->ns_lock);
 
+        old_mode = lock->l_req_mode;
         lock->l_req_mode = new_mode;
         ldlm_resource_unlink_lock(lock);
 
@@ -1121,6 +1130,8 @@ struct ldlm_resource *ldlm_lock_convert(struct ldlm_lock *lock, int new_mode,
                 } else {
                         /* This should never happen, because of the way the
                          * server handles conversions. */
+                        LDLM_ERROR(lock, "Erroneous flags %d on local lock\n",
+                                   *flags);
                         LBUG();
 
                         res->lr_tmp = &rpc_list;
@@ -1132,10 +1143,20 @@ struct ldlm_resource *ldlm_lock_convert(struct ldlm_lock *lock, int new_mode,
                                 lock->l_completion_ast(lock, 0, NULL);
                 }
         } else {
-                /* FIXME: We should try the conversion right away and possibly
-                 * return success without the need for an extra AST */
-                ldlm_resource_add_lock(res, &res->lr_converting, lock);
-                *flags |= LDLM_FL_BLOCK_CONV;
+                int pflags = 0;
+                ldlm_processing_policy policy;
+                policy = ldlm_processing_policy_table[res->lr_type];
+                res->lr_tmp = &rpc_list;
+                rc = policy(lock, &pflags, 0, &err);
+                res->lr_tmp = NULL;
+                if (rc == LDLM_ITER_STOP) {
+                        lock->l_req_mode = old_mode;
+                        ldlm_resource_add_lock(res, &res->lr_granted, lock);
+                        res = NULL;
+                } else {
+                        *flags |= LDLM_FL_BLOCK_GRANTED;
+                        granted = 1;
+                }
         }
 
         l_unlock(&ns->ns_lock);
index cdf0d9e..fa963ab 100644 (file)
@@ -700,8 +700,8 @@ int ldlm_handle_convert(struct ptlrpc_request *req)
         int rc, size = sizeof(*dlm_rep);
         ENTRY;
 
-        dlm_req = lustre_swab_reqbuf (req, 0, sizeof (*dlm_req),
-                                      lustre_swab_ldlm_request);
+        dlm_req = lustre_swab_reqbuf(req, 0, sizeof (*dlm_req),
+                                     lustre_swab_ldlm_request);
         if (dlm_req == NULL) {
                 CERROR ("Can't unpack dlm_req\n");
                 RETURN (-EFAULT);
@@ -719,12 +719,19 @@ int ldlm_handle_convert(struct ptlrpc_request *req)
         if (!lock) {
                 req->rq_status = EINVAL;
         } else {
+                void *res = NULL;
+                
                 LDLM_DEBUG(lock, "server-side convert handler START");
-                ldlm_lock_convert(lock, dlm_req->lock_desc.l_req_mode,
-                                  &dlm_rep->lock_flags);
-                if (ldlm_del_waiting_lock(lock))
-                        CDEBUG(D_DLMTRACE, "converted waiting lock %p\n", lock);
-                req->rq_status = 0;
+                res = ldlm_lock_convert(lock, dlm_req->lock_desc.l_req_mode,
+                                        &dlm_rep->lock_flags);
+
+                if (res) {
+                        if (ldlm_del_waiting_lock(lock))
+                                CDEBUG(D_DLMTRACE, "converted waiting lock %p\n", lock);
+                        req->rq_status = 0;
+                } else {
+                        req->rq_status = EDEADLOCK;
+                }
         }
 
         if (lock) {
index 3b9b0f6..b50e458 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 ll_fid mdc_fid;
+        struct lustre_id id;
         __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_mdc_exp);
+        struct obd_device *obddev = class_exp2obd(sbi->ll_lmv_exp);
         struct ldlm_res_id res_id =
-                { .name = {lli->lli_st_ino, (__u64)lli->lli_st_generation} };
+                { .name = {id_fid(&lli->lli_id), id_group(&lli->lli_id)} };
         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_op_data(&data, inode, NULL, NULL, 0, 0);
+                llu_prepare_mdc_data(&data, inode, NULL, NULL, 0, 0);
 
-                rc = mdc_enqueue(sbi->ll_mdc_exp, LDLM_IBITS, &it, LCK_PR,
+                rc = mdc_enqueue(sbi->ll_lmv_exp, LDLM_IBITS, &it, LCK_PR,
                                  &data, &lockh, NULL, 0,
                                  ldlm_completion_ast, llu_mdc_blocking_ast,
                                  inode);
@@ -84,11 +84,12 @@ static int llu_dir_do_readpage(struct inode *inode, struct page *page)
         }
         ldlm_lock_dump_handle(D_OTHER, &lockh);
 
-        mdc_pack_fid(&mdc_fid, lli->lli_st_ino, lli->lli_st_generation, S_IFDIR);
+        /* 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);
 
         offset = page->index << PAGE_SHIFT;
-        rc = mdc_readpage(sbi->ll_mdc_exp, &mdc_fid,
-                          offset, page, &request);
+        rc = mdc_readpage(sbi->ll_lmv_exp, &id, offset, page, &request);
         if (!rc) {
                 body = lustre_msg_buf(request->rq_repmsg, 0, sizeof (*body));
                 LASSERT (body != NULL);         /* checked by mdc_readpage() */
index 0ceefdb..78b9202 100644 (file)
 
 #include "llite_lib.h"
 
-void llu_prepare_mdc_op_data(struct mdc_op_data *data,
-                             struct inode *i1,
-                             struct inode *i2,
-                             const char *name,
-                             int namelen,
-                             int mode)
+void llu_prepare_mdc_data(struct mdc_op_data *data, struct inode *i1,
+                          struct inode *i2, const char *name,
+                          int namelen, int mode)
 {
         LASSERT(i1);
         
-        ll_i2uctxt(&data->ctxt, i1, i2);
-        ll_inode2fid(&data->fid1, i1);
-
-        if (i2) {
-                ll_inode2fid(&data->fid2, i2);
-        }
+        ll_inode2id(&data->id1, i1);
+        if (i2)
+                ll_inode2id(&data->id2, i2);
 
+       data->valid = 0;
         data->name = name;
         data->namelen = namelen;
         data->create_mode = mode;
@@ -345,7 +340,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_mdc_exp, inode);
+        rc2 = llu_mdc_close(sbi->ll_lmv_exp, inode);
         if (rc2 && !rc)
                 rc = rc2;
 
index 88c92d1..bf006fa 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, NULL);
+        LCFG_INIT(lcfg, LCFG_ADD_UUID, name);
         lcfg.lcfg_nid = nid;
         lcfg.lcfg_inllen1 = strlen(peer) + 1;
         lcfg.lcfg_inlbuf1 = peer;
@@ -146,9 +146,8 @@ 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_parse_llog failed: rc = %d\n", rc);
-        }
+        if (rc)
+                CERROR("class_config_process_llog failed: rc = %d\n", rc);
 
         err = obd_disconnect(exp, 0);
 
index 6c0c61d..34f1fea 100644 (file)
@@ -45,8 +45,8 @@ struct ll_file_data {
 struct llu_sb_info
 {
         struct obd_uuid         ll_sb_uuid;
-        struct obd_export      *ll_mdc_exp;
-        struct obd_export      *ll_osc_exp;
+        struct obd_export      *ll_lmv_exp;
+        struct obd_export      *ll_lov_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 ll_fid           lli_fid;
+        struct lustre_id        lli_id;
 
         struct lov_stripe_md   *lli_smd;
         char                   *lli_symlink_name;
@@ -81,10 +81,9 @@ 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;
@@ -126,17 +125,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_osc_exp;
+        return llu_i2info(inode)->lli_sbi->ll_lov_exp;
 }
 
 static inline struct obd_export *llu_i2mdcexp(struct inode *inode)
 {
-        return llu_i2info(inode)->lli_sbi->ll_mdc_exp;
+        return llu_i2info(inode)->lli_sbi->ll_lmv_exp;
 }
 
 static inline int llu_is_root_inode(struct inode *inode)
 {
-        return (llu_i2info(inode)->lli_fid.id ==
+        return (llu_i2info(inode)->lli_id.li_stc.u.e3s.l3s_ino ==
                 llu_i2info(inode)->lli_sbi->ll_rootino);
 }
 
@@ -166,17 +165,18 @@ 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,12 +221,10 @@ int llu_setattr_raw(struct inode *inode, struct iattr *attr);
 extern struct fssw_ops llu_fssw_ops;
 
 /* file.c */
-void llu_prepare_mdc_op_data(struct mdc_op_data *data,
-                             struct inode *i1,
-                             struct inode *i2,
-                             const char *name,
-                             int namelen,
-                             int mode);
+void llu_prepare_mdc_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 2a7c5e0..04606fd 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] != 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 (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 (S_ISDIR(lli->lli_st_mode) &&
                     (bits & MDS_INODELOCK_UPDATE)) {
@@ -166,11 +166,6 @@ 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;
         }
@@ -199,8 +194,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_mdc_exp, req, offset, 
-                               llu_i2sbi(inode)->ll_osc_exp, &md);
+        rc = mdc_req2lustre_md(llu_i2sbi(inode)->ll_lmv_exp, req, offset, 
+                               llu_i2sbi(inode)->ll_lov_exp, &md);
         if (rc)
                 RETURN(rc);
 
@@ -212,9 +207,8 @@ 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 ll_fid pfid, cfid;
+        struct lustre_id pid, cid;
         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;
@@ -249,8 +243,8 @@ int llu_pb_revalidate(struct pnode *pnode, int flags, struct lookup_intent *it)
         }
 
         exp = llu_i2mdcexp(pb->pb_ino);
-        ll_inode2fid(&pfid, pnode->p_parent->p_base->pb_ino);
-        ll_inode2fid(&cfid, pb->pb_ino);
+        ll_inode2id(&pid, pnode->p_parent->p_base->pb_ino);
+        ll_inode2id(&cid, pb->pb_ino);
         icbd.icbd_parent = pnode->p_parent->p_base->pb_ino;
         icbd.icbd_child = pnode;
 
@@ -259,12 +253,8 @@ int llu_pb_revalidate(struct pnode *pnode, int flags, struct lookup_intent *it)
                 it->it_op_release = ll_intent_release;
         }
 
-        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);
+        rc = mdc_intent_lock(exp, &pid, pb->pb_name.name, pb->pb_name.len,
+                             NULL, 0, &cid, 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)
@@ -340,8 +330,8 @@ static int lookup_it_finish(struct ptlrpc_request *request, int offset,
                 struct llu_inode_info *lli;
                 ENTRY;
 
-                rc = mdc_req2lustre_md(sbi->ll_mdc_exp, request, offset, 
-                                       sbi->ll_osc_exp, &md);
+                rc = mdc_req2lustre_md(sbi->ll_lmv_exp, request, offset, 
+                                       sbi->ll_lov_exp, &md);
                 if (rc)
                         RETURN(rc);
 
@@ -349,11 +339,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_osc_exp, &md.lsm);
+                                obd_free_memmd(sbi->ll_lov_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_osc_exp, &md.lsm);
+                        obd_free_memmd(sbi->ll_lov_exp, &md.lsm);
                 }
 
                 lli = llu_i2info(inode);
@@ -406,8 +396,7 @@ 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 ll_fid pfid;
-        struct ll_uctxt ctxt;
+        struct lustre_id pid;
         struct it_cb_data icbd;
         struct ptlrpc_request *req = NULL;
         struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
@@ -425,10 +414,9 @@ static int llu_lookup_it(struct inode *parent, struct pnode *pnode,
         icbd.icbd_child = pnode;
         icbd.icbd_parent = parent;
         icbd.icbd_child = pnode;
-        ll_inode2fid(&pfid, parent);
-        ll_i2uctxt(&ctxt, parent, NULL);
+        ll_inode2id(&pid, parent);
 
-        rc = mdc_intent_lock(llu_i2mdcexp(parent), &ctxt, &pfid,
+        rc = mdc_intent_lock(llu_i2mdcexp(parent), &pid,
                              pnode->p_base->pb_name.name,
                              pnode->p_base->pb_name.len,
                              NULL, 0, NULL, it, flags, &req,
index 8c4c686..15be024 100644 (file)
@@ -32,9 +32,8 @@
 #include <fcntl.h>
 #include <sys/uio.h>
 
-#include <xtio.h>
-#include <sysio.h>
 #include <fs.h>
+#include <sysio.h>
 #include <mount.h>
 #include <inode.h>
 #include <file.h>
@@ -224,7 +223,7 @@ int llu_glimpse_size(struct inode *inode)
 
         CDEBUG(D_DLMTRACE, "Glimpsing inode %lu\n", lli->lli_st_ino);
 
-        rc = obd_enqueue(sbi->ll_osc_exp, lli->lli_smd, LDLM_EXTENT, &policy,
+        rc = obd_enqueue(sbi->ll_lov_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);
@@ -240,7 +239,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_osc_exp, lli->lli_smd, LCK_PR, &lockh);
+        obd_cancel(sbi->ll_lov_exp, lli->lli_smd, LCK_PR, &lockh);
 
         RETURN(rc);
 }
@@ -265,7 +264,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_osc_exp, lsm, LDLM_EXTENT, policy, mode,
+        rc = obd_enqueue(sbi->ll_lov_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);
@@ -294,7 +293,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_osc_exp, lsm, mode, lockh);
+        rc = obd_cancel(sbi->ll_lov_exp, lsm, mode, lockh);
 
         RETURN(rc);
 }
index 028c2c8..7b5fc95 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 <sysio.h>
 #include <fs.h>
+#include <sysio.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_mdc_exp);
+        struct obd_device *obd = class_exp2obd(sbi->ll_lmv_exp);
         struct lustre_cfg lcfg;
         int next = 0;
         ENTRY;
 
         list_del(&sbi->ll_conn_chain);
-        obd_disconnect(sbi->ll_osc_exp, 0);
-        obd_disconnect(sbi->ll_mdc_exp, 0);
+        obd_disconnect(sbi->ll_lov_exp, 0);
+        obd_disconnect(sbi->ll_lmv_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;
 }
 
-static struct inode_ops llu_inode_ops;
+struct inode_ops llu_inode_ops;
 
 void llu_update_inode(struct inode *inode, struct mds_body *body,
                       struct lov_stripe_md *lsm)
@@ -139,8 +139,19 @@ 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 = body->ino;
+                lli->lli_st_ino = id_ino(&body->id1);
+        if (body->valid & OBD_MD_FLGENER)
+                lli->lli_st_generation = id_gen(&body->id1);
+
         if (body->valid & OBD_MD_FLATIME)
                 LTIME_S(lli->lli_st_atime) = body->atime;
         if (body->valid & OBD_MD_FLMTIME)
@@ -159,22 +170,12 @@ 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)
@@ -342,7 +343,7 @@ int llu_inode_getattr(struct inode *inode, struct lov_stripe_md *lsm)
 }
 
 static struct inode* llu_new_inode(struct filesys *fs,
-                                   struct ll_fid *fid)
+                                   struct lustre_id *id)
 {
        struct inode *inode;
         struct llu_inode_info *lli;
@@ -359,17 +360,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_fid;
-        lli->lli_sysio_fid.fid_len = sizeof(lli->lli_fid);
+        lli->lli_sysio_fid.fid_data = &lli->lli_id;
+        lli->lli_sysio_fid.fid_len = sizeof(lli->lli_id);
 
-        memcpy(&lli->lli_fid, fid, sizeof(*fid));
+        memcpy(&lli->lli_id, id, sizeof(*id));
 
         /* file identifier is needed by functions like _sysio_i_find() */
        inode = _sysio_i_new(fs, &lli->lli_sysio_fid,
 #ifndef AUTOMOUNT_FILE_NAME
-                            fid->f_type & S_IFMT,
+                            id->li_stc.u.e3s.l3s_type & S_IFMT,
 #else
-                            fid->f_type, /* all of the bits! */
+                            id->li_stc.u.e3s.l3s_type, /* all of the bits! */
 #endif
                              0, 0,
                             &llu_inode_ops, lli);
@@ -393,9 +394,9 @@ static int llu_have_md_lock(struct inode *inode, __u64 lockpart)
 
         LASSERT(inode);
 
-        obddev = sbi->ll_mdc_exp->exp_obd;
-        res_id.name[0] = lli->lli_st_ino;
-        res_id.name[1] = lli->lli_st_generation;
+        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);
 
         CDEBUG(D_INFO, "trying to match res "LPU64"\n", res_id.name[0]);
 
@@ -430,24 +431,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 ll_fid fid;
+                struct lustre_id id;
                 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_osc_exp, NULL);
+                        ealen = obd_size_diskmd(sbi->ll_lov_exp, NULL);
                         valid |= OBD_MD_FLEASIZE;
                 }
-                ll_inode2fid(&fid, inode);
-                rc = mdc_getattr(sbi->ll_mdc_exp, &fid, valid, ealen, &req);
+                ll_inode2id(&id, inode);
+                rc = mdc_getattr(sbi->ll_lmv_exp, &id, 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_mdc_exp, req, 0, sbi->ll_osc_exp
-                                       &md);
+                rc = mdc_req2lustre_md(sbi->ll_lmv_exp, req, 0
+                                       sbi->ll_lov_exp, &md);
 
                 /* XXX Too paranoid? */
                 if (((md.body->valid ^ valid) & OBD_MD_FLEASIZE) &&
@@ -466,7 +467,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_osc_exp, &md.lsm);
+                        obd_free_memmd(sbi->ll_lov_exp, &md.lsm);
 
                 if (md.body->valid & OBD_MD_FLSIZE)
                         set_bit(LLI_F_HAVE_MDS_SIZE_LOCK,
@@ -545,7 +546,7 @@ static int null_if_equal(struct ldlm_lock *lock, void *data)
 
 void llu_clear_inode(struct inode *inode)
 {
-        struct ll_fid fid;
+        struct lustre_id id;
         struct llu_inode_info *lli = llu_i2info(inode);
         struct llu_sb_info *sbi = llu_i2sbi(inode);
         ENTRY;
@@ -553,16 +554,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_inode2fid(&fid, inode);
+        ll_inode2id(&id, inode);
         clear_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &(lli->lli_flags));
-        mdc_change_cbdata(sbi->ll_mdc_exp, &fid, null_if_equal, inode);
+        mdc_change_cbdata(sbi->ll_lmv_exp, &id, null_if_equal, inode);
 
         if (lli->lli_smd)
-                obd_change_cbdata(sbi->ll_osc_exp, lli->lli_smd,
+                obd_change_cbdata(sbi->ll_lov_exp, lli->lli_smd,
                                   null_if_equal, inode);
 
         if (lli->lli_smd) {
-                obd_free_memmd(sbi->ll_osc_exp, &lli->lli_smd);
+                obd_free_memmd(sbi->ll_lov_exp, &lli->lli_smd);
                 lli->lli_smd = NULL;
         }
 
@@ -681,11 +682,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_op_data(&op_data, inode, NULL, NULL, 0, 0);
-
-                rc = mdc_setattr(sbi->ll_mdc_exp, &op_data,
-                                  attr, NULL, 0, NULL, 0, &request);
+                llu_prepare_mdc_data(&op_data, inode, NULL, NULL, 0, 0);
 
+                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)
@@ -693,8 +694,8 @@ int llu_setattr_raw(struct inode *inode, struct iattr *attr)
                         RETURN(rc);
                 }
 
-                rc = mdc_req2lustre_md(sbi->ll_mdc_exp, request, 0, 
-                                       sbi->ll_osc_exp, &md);
+                rc = mdc_req2lustre_md(sbi->ll_lmv_exp, request, 0, 
+                                       sbi->ll_lov_exp, &md);
                 if (rc) {
                         ptlrpc_req_finished(request);
                         RETURN(rc);
@@ -771,7 +772,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_osc_exp, &oa, lsm, NULL);
+                rc = obd_setattr(sbi->ll_lov_exp, &oa, lsm, NULL);
                 if (rc)
                         CERROR("obd_setattr fails: rc=%d\n", rc);
         }
@@ -843,8 +844,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_op_data(&op_data, dir, NULL, name, len, 0);
-        err = mdc_create(sbi->ll_mdc_exp, &op_data,
+        llu_prepare_mdc_data(&op_data, dir, NULL, name, len, 0);
+        err = mdc_create(sbi->ll_lmv_exp, &op_data,
                          tgt, strlen(tgt) + 1, S_IFLNK | S_IRWXUGO,
                          current->fsuid, current->fsgid, 0, &request);
         ptlrpc_req_finished(request);
@@ -857,7 +858,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 ll_fid fid;
+        struct lustre_id id;
         struct mds_body *body;
         int rc, symlen = lli->lli_st_size + 1;
         ENTRY;
@@ -870,8 +871,8 @@ static int llu_readlink_internal(struct inode *inode,
                 RETURN(0);
         }
 
-        ll_inode2fid(&fid, inode);
-        rc = mdc_getattr(sbi->ll_mdc_exp, &fid,
+        ll_inode2id(&id, inode);
+        rc = mdc_getattr(sbi->ll_lmv_exp, &id,
                          OBD_MD_LINKNAME, symlen, request);
         if (rc) {
                 CERROR("inode %lu: rc = %d\n", lli->lli_st_ino, rc);
@@ -962,11 +963,11 @@ static int llu_iop_mknod_raw(struct pnode *pno,
         case S_IFBLK:
         case S_IFIFO:
         case S_IFSOCK:
-                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,
+                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,
                                  current->fsuid, current->fsgid, dev, &request);
                 ptlrpc_req_finished(request);
                 break;
@@ -994,8 +995,8 @@ static int llu_iop_link_raw(struct pnode *old, struct pnode *new)
         LASSERT(dir);
 
         liblustre_wait_event(0);
-        llu_prepare_mdc_op_data(&op_data, src, dir, name, namelen, 0);
-        rc = mdc_link(llu_i2sbi(src)->ll_mdc_exp, &op_data, &request);
+        llu_prepare_mdc_data(&op_data, src, dir, name, namelen, 0);
+        rc = mdc_link(llu_i2sbi(src)->ll_lmv_exp, &op_data, &request);
         ptlrpc_req_finished(request);
         liblustre_wait_event(0);
 
@@ -1020,13 +1021,12 @@ static int llu_iop_unlink_raw(struct pnode *pno)
         LASSERT(target);
 
         liblustre_wait_event(0);
-        llu_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
-        rc = mdc_unlink(llu_i2sbi(dir)->ll_mdc_exp, &op_data, &request);
+        llu_prepare_mdc_data(&op_data, dir, NULL, name, len, 0);
+        rc = mdc_unlink(llu_i2sbi(dir)->ll_lmv_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_op_data(&op_data, src, tgt, NULL, 0, 0);
-        rc = mdc_rename(llu_i2sbi(src)->ll_mdc_exp, &op_data,
+        llu_prepare_mdc_data(&op_data, src, tgt, NULL, 0, 0);
+        rc = mdc_rename(llu_i2sbi(src)->ll_lmv_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_mdc_exp), osfs, max_age);
+        rc = obd_statfs(class_exp2obd(sbi->ll_lmv_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_osc_exp), &obd_osfs, max_age);
+        rc = obd_statfs(class_exp2obd(sbi->ll_lov_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_fsid.__val[1];
+        buf->f_fsid = fs.f_fstc.__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_op_data(&op_data, dir, NULL, name, len, 0);
-        err = mdc_create(llu_i2sbi(dir)->ll_mdc_exp, &op_data, NULL, 0, mode,
+        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,
                          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_op_data(&op_data, dir, NULL, name, len, S_IFDIR);
-        rc = mdc_unlink(llu_i2sbi(dir)->ll_mdc_exp, &op_data, &request);
+        llu_prepare_mdc_data(&op_data, dir, NULL, name, len, S_IFDIR);
+        rc = mdc_unlink(llu_i2sbi(dir)->ll_lmv_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 don't support O_NONBLOCK, O_ASYNC, "
+                        CERROR("liblustre does not 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 ll_fid fid;
-        struct file_identifier fileid = {&fid, sizeof(fid)};
+        struct lustre_id id;
+        struct file_identifier fileid = {&id, sizeof(id)};
 
         if ((md->body->valid &
              (OBD_MD_FLGENER | OBD_MD_FLID | OBD_MD_FLTYPE)) !=
@@ -1364,17 +1364,15 @@ struct inode *llu_iget(struct filesys *fs, struct lustre_md *md)
                 return ERR_PTR(-EPERM);
         }
 
-        /* try to find existing inode */
-        fid.id = md->body->ino;
-        fid.generation = md->body->generation;
-        fid.f_type = md->body->mode & S_IFMT;
+        id = md->body->id1;
 
+        /* try to find existing inode */
         inode = _sysio_i_find(fs, &fileid);
         if (inode) {
                 struct llu_inode_info *lli = llu_i2info(inode);
 
                 if (inode->i_zombie ||
-                    lli->lli_st_generation != md->body->generation) {
+                    lli->lli_st_generation != id_gen(&md->body->id1)) {
                         I_RELE(inode);
                 }
                 else {
@@ -1383,15 +1381,13 @@ struct inode *llu_iget(struct filesys *fs, struct lustre_md *md)
                 }
         }
 
-        inode = llu_new_inode(fs, &fid);
+        inode = llu_new_inode(fs, &id);
         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,
@@ -1403,18 +1399,18 @@ llu_fsswop_mount(const char *source,
         struct inode *root;
         struct pnode_base *rootpb;
         struct obd_device *obd;
-        struct ll_fid rootfid;
+        struct lustre_id rootid;
         struct llu_sb_info *sbi;
         struct obd_statfs osfs;
         static struct qstr noname = { NULL, 0, 0 };
         struct ptlrpc_request *request = NULL;
-        struct lustre_handle mdc_conn = {0, };
-        struct lustre_handle osc_conn = {0, };
+        struct lustre_handle lmv_conn = {0, };
+        struct lustre_handle lov_conn = {0, };
         struct lustre_md md;
         class_uuid_t uuid;
         struct config_llog_instance cfg;
         struct lustre_profile *lprof;
-        char *osc = NULL, *mdc = NULL;
+        char *lov = NULL, *lmv = NULL;
         int async = 1, err = -EINVAL;
 
         ENTRY;
@@ -1449,23 +1445,23 @@ llu_fsswop_mount(const char *source,
                 CERROR("No profile found: %s\n", g_zconf_profile);
                 GOTO(out_free, err = -EINVAL);
         }
-        if (osc)
-                OBD_FREE(osc, strlen(osc) + 1);
-        OBD_ALLOC(osc, strlen(lprof->lp_osc) + 
+        if (lov)
+                OBD_FREE(lov, strlen(lov) + 1);
+        OBD_ALLOC(lov, strlen(lprof->lp_lov) + 
                   strlen(sbi->ll_instance) + 2);
-        sprintf(osc, "%s-%s", lprof->lp_osc, sbi->ll_instance);
+        sprintf(lov, "%s-%s", lprof->lp_lov, sbi->ll_instance);
 
-        if (mdc)
-                OBD_FREE(mdc, strlen(mdc) + 1);
-        OBD_ALLOC(mdc, strlen(lprof->lp_mdc) + 
+        if (lmv)
+                OBD_FREE(lmv, strlen(lmv) + 1);
+        OBD_ALLOC(lmv, strlen(lprof->lp_lmv) + 
                   strlen(sbi->ll_instance) + 2);
-        sprintf(mdc, "%s-%s", lprof->lp_mdc, sbi->ll_instance);
+        sprintf(lmv, "%s-%s", lprof->lp_lmv, sbi->ll_instance);
 
-        if (!osc) {
+        if (!lov) {
                 CERROR("no osc\n");
                 GOTO(out_free, err = -EINVAL);
         }
-        if (!mdc) {
+        if (!lmv) {
                 CERROR("no mdc\n");
                 GOTO(out_free, err = -EINVAL);
         }
@@ -1476,68 +1472,68 @@ llu_fsswop_mount(const char *source,
                 goto out_free;
         }
 
-        obd = class_name2obd(mdc);
+        obd = class_name2obd(lmv);
         if (!obd) {
-                CERROR("MDC %s: not setup or attached\n", mdc);
+                CERROR("MDC %s: not setup or attached\n", lmv);
                 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, osc))
+        if (mdc_init_ea_size(obd, lov))
                 GOTO(out_free, err = -EINVAL);
 #endif
         /* setup mdc */
-        err = obd_connect(&mdc_conn, obd, &sbi->ll_sb_uuid, 0);
+        err = obd_connect(&lmv_conn, obd, &sbi->ll_sb_uuid, 0);
         if (err) {
-                CERROR("cannot connect to %s: rc = %d\n", mdc, err);
+                CERROR("cannot connect to %s: rc = %d\n", lmv, err);
                 GOTO(out_free, err);
         }
-        sbi->ll_mdc_exp = class_conn2export(&mdc_conn);
+        sbi->ll_lmv_exp = class_conn2export(&lmv_conn);
 
         err = obd_statfs(obd, &osfs, 100000000);
         if (err)
-                GOTO(out_mdc, err);
+                GOTO(out_lmv, err);
 
         /*
          * FIXME fill fs stat data into sbi here!!! FIXME
          */
 
-        /* setup osc */
-        obd = class_name2obd(osc);
+        /* setup lov */
+        obd = class_name2obd(lov);
         if (!obd) {
-                CERROR("OSC %s: not setup or attached\n", osc);
-                GOTO(out_mdc, err = -EINVAL);
+                CERROR("OSC %s: not setup or attached\n", lov);
+                GOTO(out_lmv, err = -EINVAL);
         }
         obd_set_info(obd->obd_self_export, strlen("async"), "async",
                      sizeof(async), &async);
 
-        err = obd_connect(&osc_conn, obd, &sbi->ll_sb_uuid, 0);
+        err = obd_connect(&lov_conn, obd, &sbi->ll_sb_uuid, 0);
         if (err) {
-                CERROR("cannot connect to %s: rc = %d\n", osc, err);
-                GOTO(out_mdc, err);
+                CERROR("cannot connect to %s: rc = %d\n", lov, err);
+                GOTO(out_lmv, err);
         }
-        sbi->ll_osc_exp = class_conn2export(&osc_conn);
+        sbi->ll_lov_exp = class_conn2export(&lov_conn);
 
-        err = mdc_getstatus(sbi->ll_mdc_exp, &rootfid);
+        err = mdc_getstatus(sbi->ll_lmv_exp, &rootid);
         if (err) {
                 CERROR("cannot mds_connect: rc = %d\n", err);
-                GOTO(out_osc, err);
+                GOTO(out_lov, err);
         }
-        CDEBUG(D_SUPER, "rootfid "LPU64"\n", rootfid.id);
-        sbi->ll_rootino = rootfid.id;
+        CDEBUG(D_SUPER, "rootid "LPU64"\n", rootid.li_stc.u.e3s.l3s_ino);
+        sbi->ll_rootino = rootid.li_stc.u.e3s.l3s_ino;
 
         /* fetch attr of root inode */
-        err = mdc_getattr(sbi->ll_mdc_exp, &rootfid,
+        err = mdc_getattr(sbi->ll_lmv_exp, &rootid,
                           OBD_MD_FLNOTOBD|OBD_MD_FLBLOCKS, 0, &request);
         if (err) {
                 CERROR("mdc_getattr failed for root: rc = %d\n", err);
-                GOTO(out_osc, err);
+                GOTO(out_lov, err);
         }
 
-        err = mdc_req2lustre_md(sbi->ll_mdc_exp, request, 0, sbi->ll_osc_exp
-                                &md);
+        err = mdc_req2lustre_md(sbi->ll_lmv_exp, request, 0
+                                sbi->ll_lov_exp, &md);
         if (err) {
                 CERROR("failed to understand root inode md: rc = %d\n",err);
                 GOTO(out_request, err);
@@ -1576,10 +1572,10 @@ out_inode:
         _sysio_i_gone(root);
 out_request:
         ptlrpc_req_finished(request);
-out_osc:
-        obd_disconnect(sbi->ll_osc_exp, 0);
-out_mdc:
-        obd_disconnect(sbi->ll_mdc_exp, 0);
+out_lov:
+        obd_disconnect(sbi->ll_lov_exp, 0);
+out_lmv:
+        obd_disconnect(sbi->ll_lmv_exp, 0);
 out_free:
         OBD_FREE(sbi, sizeof(*sbi));
         return err;
@@ -1589,31 +1585,30 @@ struct fssw_ops llu_fssw_ops = {
         llu_fsswop_mount
 };
 
-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,
+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,
 #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 1984bc0..912c513 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_osc_exp, sbi->ll_mdc_exp,
+        rc = ll_prep_inode(sbi->ll_lov_exp, sbi->ll_lmv_exp,
                            &de->d_inode, request, offset, NULL);
 
         RETURN(rc);
@@ -188,11 +188,14 @@ void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry)
         }
 
         /* drop lookup or getattr locks immediately */
-        if (it->it_op == IT_LOOKUP || it->it_op == IT_GETATTR || it->it_op == IT_CHDIR) {
+        if (it->it_op == IT_LOOKUP || it->it_op == IT_GETATTR ||
+            it->it_op == IT_CHDIR) {
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
-                /* on 2.6 there are situation when several lookups and
+                /*
+                 * on 2.6 there are situations when several lookups and
                  * revalidations may be requested during single operation.
-                 * therefore, we don't release intent here -bzzz */
+                 * Therefore, we don't release intent here -bzzz
+                 */
                 ll_intent_drop_lock(it);
 #else
                 ll_intent_release(it);
@@ -203,6 +206,7 @@ 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",
@@ -219,15 +223,16 @@ void ll_frob_intent(struct lookup_intent **itp, struct lookup_intent *deft)
 int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd,
                      struct lookup_intent *it)
 {
-        int rc;
-        struct ll_fid pfid, cfid;
-        struct it_cb_data icbd;
-        struct ptlrpc_request *req = NULL;
         struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
+        struct ptlrpc_request *req = NULL;
+        struct it_cb_data icbd;
         struct obd_export *exp;
-
+        struct lustre_id pid;
+        struct lustre_id cid;
+        int rc;
         ENTRY;
-        CDEBUG(D_VFSTRACE, "VFS Op:name=%s,intent=%s\n", de->d_name.name,
+
+        CDEBUG(D_VFSTRACE, "VFS Op:name=%s, intent=%s\n", de->d_name.name,
                LL_IT2STR(it));
 
         /* Cached negative dentries are unsafe for now - look them up again */
@@ -235,18 +240,22 @@ 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);
+        LASSERT(id_fid(&cid) != 0);
 
-        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);
 
@@ -254,12 +263,20 @@ int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd,
                 nd->mnt->mnt_last_used = jiffies;
 
         ll_frob_intent(&it, &lookup_it);
-        LASSERT(it);
+        LASSERT(it != NULL);
 
-        if (it->it_op == IT_GETATTR) { /* We need to check for LOOKUP lock
-                                          as well */
-                rc = md_intent_lock(exp, &pfid, de->d_name.name,
-                                    de->d_name.len, NULL, 0, &cfid, &lookup_it,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+        /*
+         * to show, that client already has inode and it needs to revalidate,
+         * all fields but fid. mdc_intent_lock() will use this flag.
+         */
+        it->d.lustre.it_int_flags |= LL_IT_EXIST;
+#endif
+
+        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,
                                     flags, &req, ll_mdc_blocking_ast);
                 /* If there was no lookup lock, no point in even checking for
                    UPDATE lock */
@@ -279,9 +296,10 @@ int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd,
                 ll_lookup_finish_locks(&lookup_it, de);
         }
 
-        rc = md_intent_lock(exp, &pfid, de->d_name.name, de->d_name.len,
-                            NULL, 0, &cfid, it, flags, &req,
+        rc = md_intent_lock(exp, &pid, de->d_name.name, de->d_name.len,
+                            NULL, 0, &cid, 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)
@@ -289,7 +307,7 @@ int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd,
 
         if (rc < 0) {
                 if (rc != -ESTALE) {
-                        CDEBUG(D_INFO, "ll_intent_lock: rc %d : it->it_status "
+                        CDEBUG(D_INFO, "ll_intent_lock(): rc %d : it->it_status "
                                "%d\n", rc, it->d.lustre.it_status);
                 }
                 GOTO(out, rc = 0);
@@ -310,7 +328,7 @@ int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd,
         spin_unlock(&dcache_lock);
 
         GOTO(out, rc);
- out:
+out:
         if (req != NULL && rc == 1)
                 ptlrpc_req_finished(req);
         if (rc == 0) {
@@ -362,7 +380,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_mdc_exp, inode->i_ino, inode->i_generation,
+        rc = obd_pin(sbi->ll_lmv_exp, inode->i_ino, inode->i_generation,
                      inode->i_mode & S_IFMT, handle, flag);
 
         if (rc) {
@@ -412,9 +430,8 @@ int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd,
                 return;
         }
 
-        rc = obd_unpin(sbi->ll_mdc_exp, &handle, flag);
+        rc = obd_unpin(sbi->ll_lmv_exp, &handle, flag);
         EXIT;
-        return;
 }
 
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
@@ -436,12 +453,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 ll_fid parent, child;
+        struct lustre_id parent, child;
 
         LASSERT(dentry->d_parent && dentry->d_parent->d_inode);
-        ll_inode2fid(&parent, dentry->d_parent->d_inode);
-        ll_inode2fid(&child, inode);
-        md_change_cbdata_name(sbi->ll_mdc_exp, &parent,
+        ll_inode2id(&parent, dentry->d_parent->d_inode);
+        ll_inode2id(&child, inode);
+        md_change_cbdata_name(sbi->ll_lmv_exp, &parent,
                               (char *)dentry->d_name.name, 
                               dentry->d_name.len, &child, 
                               null_if_equal, inode);
@@ -451,12 +468,12 @@ static void ll_dentry_iput(struct dentry *dentry, struct inode *inode)
 static void ll_dentry_iput(struct dentry *dentry, struct inode *inode)
 {
         struct ll_sb_info *sbi = ll_i2sbi(inode);
-        struct ll_fid parent, child;
+        struct lustre_id parent, child;
 
         LASSERT(dentry->d_parent && dentry->d_parent->d_inode);
-        ll_inode2fid(&parent, dentry->d_parent->d_inode);
-        ll_inode2fid(&child, inode);
-        md_change_cbdata_name(sbi->ll_mdc_exp, &parent,
+        ll_inode2id(&parent, dentry->d_parent->d_inode);
+        ll_inode2id(&child, inode);
+        md_change_cbdata_name(sbi->ll_lmv_exp, &parent,
                               (char *)dentry->d_name.name, 
                               dentry->d_name.len, &child, 
                               null_if_equal, inode);
index 6ac70be..b2f5912 100644 (file)
@@ -61,24 +61,26 @@ 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_fid(&mdc_fid, inode->i_ino, inode->i_generation, S_IFDIR);
-        mdc_fid.mds = ll_i2info(inode)->lli_mds;
+        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));
+
         offset = page->index << PAGE_SHIFT;
-        rc = md_readpage(ll_i2sbi(inode)->ll_mdc_exp, &mdc_fid,
-                         offset, page, &request);
+        rc = md_readpage(ll_i2sbi(inode)->ll_lmv_exp, &id, 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!"
@@ -88,8 +90,7 @@ static int ll_dir_readpage(struct file *file, struct page *page)
         ptlrpc_req_finished(request);
 
         unlock_page(page);
-        EXIT;
-        return rc;
+        RETURN(rc);
 }
 
 struct address_space_operations ll_dir_aops = {
@@ -116,7 +117,6 @@ 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,16 +208,17 @@ 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 = { dir->i_ino, (__u64)dir->i_generation} };
+                { .name = { id_fid(&li->lli_id), id_group(&li->lli_id)} };
         struct lustre_handle lockh;
-        struct obd_device *obddev = class_exp2obd(ll_i2sbi(dir)->ll_mdc_exp);
+        struct obd_device *obddev = class_exp2obd(ll_i2sbi(dir)->ll_lmv_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_mdc_exp, NULL, 0);
+        obddev = md_get_real_obd(ll_i2sbi(dir)->ll_lmv_exp, NULL, 0);
         rc = ldlm_lock_match(obddev->obd_namespace, LDLM_FL_BLOCK_GRANTED,
                              &res_id, LDLM_IBITS, &policy, LCK_PR, &lockh);
         if (!rc) {
@@ -225,9 +226,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_op_data(&data, dir, NULL, NULL, 0, 0);
+                ll_prepare_mdc_data(&data, dir, NULL, NULL, 0, 0);
 
-                rc = md_enqueue(ll_i2sbi(dir)->ll_mdc_exp, LDLM_IBITS, &it,
+                rc = md_enqueue(ll_i2sbi(dir)->ll_lmv_exp, LDLM_IBITS, &it,
                                 LCK_PR, &data, &lockh, NULL, 0,
                                 ldlm_completion_ast, ll_mdc_blocking_ast, dir);
 
@@ -400,8 +401,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_op_data(&op_data, inode, NULL, name,lums.lums_namelen,0);
-        err = md_create(sbi->ll_mdc_exp, &op_data, &nstripes, sizeof(nstripes),
+        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),
                         mode, current->fsuid, current->fsgid, 0, &request);
         ptlrpc_req_finished(request);
 
@@ -430,7 +431,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 ll_fid fid;
+                struct lustre_id id;
                 char *buf = NULL;
                 char *filename;
                 int namelen, rc, len = 0;
@@ -450,8 +451,8 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                 }
 
                 valid = OBD_MD_FLID;
-                ll_inode2fid(&fid, inode);
-                rc = md_getattr_name(sbi->ll_mdc_exp, &fid,
+                ll_inode2id(&id, inode);
+                rc = md_getattr_name(sbi->ll_lmv_exp, &id,
                                      filename, namelen, valid, 0, &request);
                 if (rc < 0) {
                         CDEBUG(D_INFO, "md_getattr_name: %d\n", rc);
@@ -476,7 +477,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_op_data(&op_data, inode, NULL, NULL, 0, 0);
+                ll_prepare_mdc_data(&op_data, inode, NULL, NULL, 0, 0);
 
                 LASSERT(sizeof(lum) == sizeof(*lump));
                 LASSERT(sizeof(lum.lmm_objects[0]) ==
@@ -488,7 +489,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_mdc_exp, &op_data,
+                rc = md_setattr(sbi->ll_lmv_exp, &op_data,
                                 &attr, &lum, sizeof(lum), NULL, 0, &request);
                 if (rc) {
                         ptlrpc_req_finished(request);
@@ -504,16 +505,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 ll_fid fid;
+                struct lustre_id id;
                 struct mds_body *body;
                 unsigned long valid = 0;
                 int rc, lmmsize;
 
                 valid |= OBD_MD_FLDIREA;
 
-                ll_inode2fid(&fid, inode);
-                rc = md_getattr(sbi->ll_mdc_exp, &fid, valid,
-                                obd_size_diskmd(sbi->ll_osc_exp, NULL),
+                ll_inode2id(&id, inode);
+                rc = md_getattr(sbi->ll_lmv_exp, &id, valid,
+                                obd_size_diskmd(sbi->ll_lov_exp, NULL),
                                 &request);
                 if (rc < 0) {
                         CDEBUG(D_INFO, "md_getattr failed: rc = %d\n", rc);
@@ -540,12 +541,37 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                 ptlrpc_req_finished(request);
                 RETURN(rc);
         }
+        case IOC_MDC_SHOWFID: {
+                struct lustre_id *idp = (struct lustre_id *)arg;
+                struct lustre_id id;
+                char *filename;
+                int rc;
+
+                filename = getname((const char *)arg);
+                if (IS_ERR(filename))
+                        RETURN(PTR_ERR(filename));
+
+                ll_inode2id(&id, inode);
+
+                rc = ll_get_fid(sbi->ll_lmv_exp, &id, filename, &id);
+                if (rc < 0)
+                        GOTO(out_filename, rc);
+
+                rc = copy_to_user(idp, &id, sizeof(*idp));
+                if (rc)
+                        GOTO(out_filename, rc = -EFAULT);
+
+                EXIT;
+        out_filename:
+                putname(filename);
+                return rc;
+        }
         case IOC_MDC_GETSTRIPE: {
-                struct ptlrpc_request *request = NULL;
-                struct ll_fid fid;
-                struct mds_body *body;
                 struct lov_user_md *lump = (struct lov_user_md *)arg;
+                struct ptlrpc_request *request = NULL;
                 struct lov_mds_md *lmm;
+                struct mds_body *body;
+                struct lustre_id id;
                 char *filename;
                 int rc, lmmsize;
 
@@ -553,10 +579,10 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                 if (IS_ERR(filename))
                         RETURN(PTR_ERR(filename));
 
-                ll_inode2fid(&fid, inode);
-                rc = md_getattr_name(sbi->ll_mdc_exp, &fid, filename,
+                ll_inode2id(&id, inode);
+                rc = md_getattr_name(sbi->ll_lmv_exp, &id, filename,
                                      strlen(filename) + 1, OBD_MD_FLEASIZE,
-                                     obd_size_diskmd(sbi->ll_osc_exp, NULL),
+                                     obd_size_diskmd(sbi->ll_lov_exp, NULL),
                                      &request);
                 if (rc < 0) {
                         CDEBUG(D_INFO, "md_getattr_name failed on %s: rc %d\n",
@@ -659,7 +685,7 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                         bufs[1] = NULL;
                 }
                 size = data->ioc_plen1;
-                req = ptlrpc_prep_req(sbi2mdc(sbi)->cl_import,
+                req = ptlrpc_prep_req(sbi2lmv(sbi)->cl_import,
                                       LUSTRE_LOG_VERSION, LLOG_CATINFO,
                                       2, lens, bufs);
                 if (!req)
@@ -678,7 +704,8 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                 RETURN(rc);
         }
         default:
-                return obd_iocontrol(cmd, sbi->ll_osc_exp,0,NULL,(void *)arg);
+                return obd_iocontrol(cmd, sbi->ll_lov_exp, 0,
+                                     NULL, (void *)arg);
         }
 }
 
index 117a08c..a0fc7df 100644 (file)
@@ -33,7 +33,7 @@
 #include "llite_internal.h"
 #include <linux/obd_lov.h>
 
-int ll_mdc_close(struct obd_export *mdc_exp, struct