Whamcloud - gitweb
* Merged changes from HEAD and b_cray in preparation for
authoreeb <eeb>
Mon, 6 Dec 2004 20:55:57 +0000 (20:55 +0000)
committereeb <eeb>
Mon, 6 Dec 2004 20:55:57 +0000 (20:55 +0000)
    portals separation

14 files changed:
lustre/portals/build.m4
lustre/portals/include/linux/kp30.h
lustre/portals/include/linux/libcfs.h
lustre/portals/include/portals/ptlctl.h
lustre/portals/knals/openibnal/openibnal.c
lustre/portals/knals/openibnal/openibnal.h
lustre/portals/knals/openibnal/openibnal_cb.c
lustre/portals/libcfs/debug.c
lustre/portals/libcfs/module.c
lustre/portals/libcfs/tracefile.c
lustre/portals/router/proc.c
lustre/portals/utils/debug.c
lustre/portals/utils/portals.c
lustre/utils/lconf

index e791fbf..f158396 100644 (file)
@@ -61,6 +61,13 @@ case "$CC_VERSION" in
        "gcc version 2.96 20000731 (Mandrake Linux 8.1 2.96-0.62mdk)")
                bad_cc
                ;;
+       # unpatched 'gcc' on rh9.  miscompiles a
+       #        struct = (type) { .member = value, };
+       # asignment in the iibnal where the struct is a mix
+       # of u64 and u32 bit-fields.
+       "gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)")
+               bad_cc
+               ;;
        *)
                AC_MSG_RESULT([no known problems])
                ;;
index 55524f2..d49baeb 100644 (file)
@@ -735,4 +735,13 @@ 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 b1844a2..8f8d6fe 100644 (file)
@@ -109,10 +109,13 @@ struct ptldebug_header {
 #define S_SM          0x00800000
 #define S_ASOBD       0x01000000
 #define S_CONFOBD     0x02000000
-#define S_LONAL       0x04000000
-
-/* If you change these values, please keep portals/utils/debug.c
- * up to date! */
+#define S_LMV         0x04000000
+#define S_CMOBD       0x08000000
+#define S_LONAL       0x10000000
+/* If you change these values, please keep these files up to date...
+ *    portals/utils/debug.c
+ *    utils/lconf
+ */
 
 /* Debugging masks (32 bits, non-overlapping) */
 #define D_TRACE       0x00000001 /* ENTRY/EXIT markers */
@@ -138,6 +141,12 @@ struct ptldebug_header {
 #define D_RPCTRACE    0x00100000 /* for distributed debugging */
 #define D_VFSTRACE    0x00200000
 #define D_READA       0x00400000 /* read-ahead */
+#define D_MMAP        0x00800000
+#define D_CONFIG      0x01000000
+/* If you change these values, please keep these files up to date...
+ *    portals/utils/debug.c
+ *    utils/lconf
+ */
 
 #ifdef __KERNEL__
 # include <linux/sched.h> /* THREAD_SIZE */
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 38013d1..652eb34 100644 (file)
@@ -47,7 +47,7 @@ static ctl_table kibnal_top_ctl_table[] = {
 #endif
 
 void
-print_service(tTS_IB_COMMON_ATTRIB_SERVICE service, char *tag, int rc)
+print_service(struct ib_common_attrib_service *service, char *tag, int rc)
 {
         char name[32];
 
@@ -71,7 +71,7 @@ print_service(tTS_IB_COMMON_ATTRIB_SERVICE service, char *tag, int rc)
 
 void
 kibnal_service_setunset_done (tTS_IB_CLIENT_QUERY_TID tid, int status,
-                               tTS_IB_COMMON_ATTRIB_SERVICE service, void *arg)
+                               struct ib_common_attrib_service *service, void *arg)
 {
         *(int *)arg = status;
         up (&kibnal_data.kib_nid_signal);
@@ -81,7 +81,7 @@ kibnal_service_setunset_done (tTS_IB_CLIENT_QUERY_TID tid, int status,
 void
 kibnal_check_advert (void)
 {
-        tTS_IB_COMMON_ATTRIB_SERVICE svc;
+        struct ib_common_attrib_service *svc;
         __u64   tid;
         int     rc;
         int     rc2;
@@ -118,7 +118,7 @@ kibnal_check_advert (void)
 int
 kibnal_advertise (void)
 {
-        tTS_IB_COMMON_ATTRIB_SERVICE svc;
+        struct ib_common_attrib_service *svc;
         __u64   tid;
         int     rc;
         int     rc2;
@@ -192,7 +192,7 @@ kibnal_advertise (void)
 void
 kibnal_unadvertise (int expect_success)
 {
-        tTS_IB_COMMON_ATTRIB_SERVICE svc;
+        struct ib_common_attrib_service *svc;
         __u64   tid;
         int     rc;
         int     rc2;
index b5c5f91..f0610f2 100644 (file)
@@ -320,7 +320,7 @@ typedef struct kib_connreq
         struct kib_conn                    *cr_conn;
         kib_wire_connreq_t                  cr_wcr;
         __u64                               cr_tid;
-        tTS_IB_COMMON_ATTRIB_SERVICE_STRUCT cr_service;
+        struct ib_common_attrib_service     cr_service;
         tTS_IB_GID                          cr_gid;
         struct ib_path_record               cr_path;
         struct ib_cm_active_param           cr_connparam;
@@ -413,7 +413,7 @@ kibnal_queue_tx_locked (kib_tx_t *tx, kib_conn_t *conn)
                                   IB_SA_SERVICE_COMP_MASK_DATA8_8)
 
 static inline __u64*
-kibnal_service_nid_field(tTS_IB_COMMON_ATTRIB_SERVICE srv)
+kibnal_service_nid_field(struct ib_common_attrib_service *srv)
 {
         /* must be consistent with KIBNAL_SERVICE_KEY_MASK */
         return (__u64 *)srv->service_data8;
@@ -421,7 +421,7 @@ kibnal_service_nid_field(tTS_IB_COMMON_ATTRIB_SERVICE srv)
 
 
 static inline void
-kibnal_set_service_keys(tTS_IB_COMMON_ATTRIB_SERVICE srv, ptl_nid_t nid)
+kibnal_set_service_keys(struct ib_common_attrib_service *srv, ptl_nid_t nid)
 {
         LASSERT (strlen (IBNAL_SERVICE_NAME) < sizeof(srv->service_name));
         memset (srv->service_name, 0, sizeof(srv->service_name));
index b05487d..d774853 100644 (file)
@@ -2191,7 +2191,7 @@ kibnal_pathreq_callback (tTS_IB_CLIENT_QUERY_TID tid, int status,
 
 void
 kibnal_service_get_callback (tTS_IB_CLIENT_QUERY_TID tid, int status,
-                             tTS_IB_COMMON_ATTRIB_SERVICE resp, void *arg)
+                             struct ib_common_attrib_service *resp, void *arg)
 {
         kib_conn_t *conn = arg;
         
index 8b4b335..cd77438 100644 (file)
@@ -291,7 +291,7 @@ char *portals_id2str(int nal, ptl_process_id_t id, char *str)
         
         portals_nid2str(nal, id.nid, str);
         len = strlen(str);
-        snprintf(str + len, PTL_NALFMT_SIZE, "-%u", id.pid);
+        snprintf(str + len, PTL_NALFMT_SIZE - len, "-%u", id.pid);
         return str;
 }
 
index c627622..2a8e6f6 100644 (file)
@@ -316,6 +316,10 @@ EXPORT_SYMBOL(libcfs_nal_cmd_unregister);
 int
 libcfs_nal_cmd(struct portals_cfg *pcfg)
 {
+#if CRAY_PORTALS
+        /* pretend success */
+        RETURN(0);
+#else
         struct nal_cmd_handler *cmd;
         __u32 nal = pcfg->pcfg_nal;
         int   rc = -EINVAL;
@@ -333,6 +337,7 @@ libcfs_nal_cmd(struct portals_cfg *pcfg)
         up(&nal_cmd_sem);
 
         RETURN(rc);
+#endif
 }
 EXPORT_SYMBOL(libcfs_nal_cmd);
 
index a064605..aca4c41 100644 (file)
@@ -789,7 +789,7 @@ int trace_write_debug_mb(struct file *file, const char *buffer,
                        "%d MB, which is more than 80%% of physical RAM "
                        "(%lu).\n", max * smp_num_cpus,
                        (num_physpages >> (20 - 2 - PAGE_SHIFT)) / 5);
-                return count;
+                return -EINVAL;
         }
 
         for (i = 0; i < NR_CPUS; i++) {
@@ -809,7 +809,7 @@ int trace_read_debug_mb(char *page, char **start, off_t off, int count,
 
         tcd = trace_get_tcd(flags);
         rc = snprintf(page, count, "%lu\n",
-                      tcd->tcd_max_pages * smp_num_cpus << (20 - PAGE_SHIFT));
+                      (tcd->tcd_max_pages >> (20 - PAGE_SHIFT)) * smp_num_cpus);
         trace_put_tcd(tcd, flags);
 
         return rc;
index 9a3d4f2..61b6880 100644 (file)
@@ -44,6 +44,8 @@ struct name2num {
         { "tcp",         SOCKNAL},
         { "gm",          GMNAL},
         { "ib",          OPENIBNAL},
+        { "iib",         IIBNAL},
+        { "lo",          LONAL},
         { NULL,          -1}
 };
 
index afbf1cb..6fb4576 100644 (file)
@@ -81,14 +81,16 @@ static const char *portal_debug_subsystems[] =
          "qswnal", "pinger", "filter", "ptlbd", 
          "echo", "ldlm", "lov", "gmnal",
          "router", "cobd", "ibnal", "sm",
-         "asobd", "confobd", NULL};
+         "asobd", "confobd", "lmv", "cmobd",
+         "lonal", NULL};
 static const char *portal_debug_masks[] =
         {"trace", "inode", "super", "ext2", 
          "malloc", "cache", "info", "ioctl",
          "blocks", "net", "warning", "buffs", 
          "other", "dentry", "portals", "page", 
          "dlmtrace", "error", "emerg", "ha", 
-         "rpctrace", "vfstrace", "reada", NULL};
+         "rpctrace", "vfstrace", "reada", "mmap",
+         "config", NULL};
 
 struct debug_daemon_cmd {
         char *cmd;
@@ -419,9 +421,6 @@ int jt_dbg_debug_kernel(int argc, char **argv)
 
         in = fopen(filename, "r");
         if (in == NULL) {
-                if (errno == ENOENT) /* no dump file created */
-                        return 0;
-
                 fprintf(stderr, "fopen(%s) failed: %s\n", filename,
                         strerror(errno));
                 return 1;
@@ -496,11 +495,21 @@ int jt_dbg_debug_file(int argc, char **argv)
         return parse_buffer(in, out);
 }
 
+static int
+dbg_write_cmd(int fd, char *str)
+{
+        int    len = strlen(str);
+        int    rc  = write(fd, str, len);
+        
+        return (rc == len ? 0 : 1);
+}
+
 const char debug_daemon_usage[] = "usage: %s {start file [MB]|stop}\n";
 #define DAEMON_FILE "/proc/sys/portals/daemon_file"
 int jt_dbg_debug_daemon(int argc, char **argv)
 {
-        int rc = 1, fd;
+        int  rc;
+        int  fd;
 
         if (argc <= 1) {
                 fprintf(stderr, debug_daemon_usage, argv[0]);
@@ -511,7 +520,11 @@ int jt_dbg_debug_daemon(int argc, char **argv)
         if (fd < 0) {
                 fprintf(stderr, "open %s failed: %s\n", DAEMON_FILE,
                         strerror(errno));
-        } else if (strcasecmp(argv[1], "start") == 0) {
+                return -1;
+        }
+        
+        rc = -1;
+        if (strcasecmp(argv[1], "start") == 0) {
                 if (argc < 3 || argc > 4 ||
                     (argc == 4 && strlen(argv[3]) > 5)) {
                         fprintf(stderr, debug_daemon_usage, argv[0]);
@@ -519,46 +532,59 @@ int jt_dbg_debug_daemon(int argc, char **argv)
                 }
 
                 if (argc == 4) {
-                        char size[12] = "size=";
-                        long sizecheck;
-
-                        sizecheck = strtoul(argv[3], NULL, 0);
-                        if (sizecheck < 10 || sizecheck > 20480) {
+                        char       buf[12];
+                        const long min_size = 10;
+                        const long max_size = 20480;
+                        long       size;
+                        char      *end;
+
+                        size = strtoul(argv[3], &end, 0);
+                        if (size < min_size || 
+                            size > max_size ||
+                            *end != 0) {
                                 fprintf(stderr, "size %s invalid, must be in "
-                                        "the range 20-20480 MB\n", argv[3]);
-                        } else {
-                                strncat(size, argv[3], sizeof(size) - 6);
-                                rc = write(fd, size, strlen(size));
-                                if (rc != strlen(size)) {
-                                        fprintf(stderr, "set %s failed: %s\n",
-                                                size, strerror(errno));
-                                }
+                                        "the range %d-%d MB\n", argv[3],
+                                        min_size, max_size);
+                                goto out;
+                        }
+
+                        snprintf(buf, sizeof(buf), "size=%ld", size);
+                        rc = dbg_write_cmd(fd, buf);
+                        if (rc != 0) {
+                                fprintf(stderr, "set %s failed: %s\n",
+                                        buf, strerror(errno));
+                                goto out;
                         }
                 }
-                rc = write(fd, argv[2], strlen(argv[2]));
-                if (rc != strlen(argv[2])) {
+
+                rc = dbg_write_cmd(fd, "start");
+                if (rc != 0) {
                         fprintf(stderr, "start debug_daemon on %s failed: %s\n",
                                 argv[2], strerror(errno));
                         goto out;
                 }
 
                 rc = 0;
-        } else if (strcasecmp(argv[1], "stop") == 0) {
-                rc = write(fd, "stop", 4);
-                if (rc != 4) {
+                goto out;
+        }
+        
+        if (strcasecmp(argv[1], "stop") == 0) {
+                rc = dbg_write_cmd(fd, "stop");
+                if (rc != 0) {
                         fprintf(stderr, "stopping debug_daemon failed: %s\n",
                                 strerror(errno));
                         goto out;
                 }
+
                 rc = 0;
-        } else {
-                fprintf(stderr, debug_daemon_usage, argv[0]);
-                rc = 1;
+                goto out;
         }
 
+        fprintf(stderr, debug_daemon_usage, argv[0]);
+        rc = -1;
 out:
         close(fd);
-        return 0;
+        return rc;
 }
 
 int jt_dbg_clear_debug_buf(int argc, char **argv)
@@ -646,12 +672,14 @@ static struct mod_paths {
         {"mds", "lustre/mds"},
         {"mdc", "lustre/mdc"},
         {"llite", "lustre/llite"},
+        {"ldiskfs", "lustre/ldiskfs"},
         {"smfs", "lustre/smfs"},
         {"obdecho", "lustre/obdecho"},
         {"ldlm", "lustre/ldlm"},
         {"obdfilter", "lustre/obdfilter"},
         {"extN", "lustre/extN"},
         {"lov", "lustre/lov"},
+        {"lmv", "lustre/lmv"},
         {"fsfilt_ext3", "lustre/lvfs"},
         {"fsfilt_extN", "lustre/lvfs"},
         {"fsfilt_reiserfs", "lustre/lvfs"},
@@ -663,6 +691,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 07fada2..abe3f98 100644 (file)
 #include <time.h>
 #include <stdarg.h>
 #include <endian.h>
+#if CRAY_PORTALS
+#ifdef REDSTORM
+#define __QK__
+#endif
+#include <portals/ipmap.h>
+#endif
 
 #ifdef __CYGWIN__
 
@@ -66,12 +72,18 @@ typedef struct
 
 static name2num_t nalnames[] = {
         {"any",         0},
+#if !CRAY_PORTALS
         {"tcp",                SOCKNAL},
         {"elan",       QSWNAL},
         {"gm",         GMNAL},
         {"openib",      OPENIBNAL},
         {"iib",         IIBNAL},
         {"lo",          LONAL},
+#else
+        {"cray_kern_nal", CRAY_KERN_NAL},
+        {"cray_user_nal", CRAY_USER_NAL},
+        {"cray_qk_nal",   CRAY_QK_NAL},
+#endif
         {NULL,         -1}
 };
 
@@ -363,7 +375,11 @@ ptl_parse_nid (ptl_nid_t *nidp, char *str)
         }
 
         if (ptl_parse_ipaddr (&ipaddr, str) == 0) {
+#if !CRAY_PORTALS
                 *nidp = (ptl_nid_t)ipaddr;
+#else
+                *nidp = (((ptl_nid_t)ipaddr & PNAL_HOSTID_MASK) << PNAL_VNODE_SHIFT);
+#endif
                 return (0);
         }
 
index 6b796ab..276a2b2 100755 (executable)
@@ -88,6 +88,8 @@ ptldebug_names = {
     "rpctrace" :  (1 << 20),
     "vfstrace" :  (1 << 21),
     "reada" :     (1 << 22),
+    "mmap" :      (1 << 23),
+    "config" :    (1 << 24),
     }
 
 subsystem_names = {
@@ -117,7 +119,9 @@ subsystem_names = {
     "sm" :           (1 << 23),
     "asobd" :        (1 << 24),
     "confobd" :      (1 << 25),
-    "lonal" :        (1 << 26),
+    "lmv" :          (1 << 26),
+    "cmobd" :        (1 << 27),
+    "lonal" :        (1 << 28),
     }
 
 
@@ -131,7 +135,7 @@ def cleanup_error(rc):
 # debugging and error funcs
 
 def fixme(msg = "this feature"):
-    raise Lustre.LconfError, msg + ' not implmemented yet.'
+    raise Lustre.LconfError, msg + ' not implemented yet.'
 
 def panic(*args):
     msg = string.join(map(str,args))