#include <inode.h>
#include <file.h>
+/* both sys/queue.h (libsysio require it) and portals/lists.h have definition
+ * of 'LIST_HEAD'. undef it to suppress warnings
+ */
+#undef LIST_HEAD
+
#include <portals/api-support.h> /* needed for ptpctl.h */
#include <portals/ptlctl.h> /* needed for parse_dump */
#include <procbridge.h>
#include "llite_lib.h"
+unsigned int portal_subsystem_debug = ~0 - (S_PORTALS | S_QSWNAL | S_SOCKNAL |
+ S_GMNAL | S_IBNAL);
ptl_handle_ni_t tcpnal_ni;
-struct task_struct *current;
-struct obd_class_user_state ocus;
+struct task_struct *current;
/* portals interfaces */
-ptl_handle_ni_t *
-kportal_get_ni (int nal)
-{
- switch (nal)
- {
- case SOCKNAL:
- return &tcpnal_ni;
- default:
- return NULL;
- }
-}
-
-inline void
-kportal_put_ni (int nal)
-{
- return;
-}
struct ldlm_namespace;
struct ldlm_res_id;
int init_lib_portals()
{
+ int max_interfaces;
int rc;
ENTRY;
- PtlInit();
- rc = PtlNIInit(procbridge_interface, 0, 0, 0, &tcpnal_ni);
- if (rc != 0) {
- CERROR("ksocknal: PtlNIInit failed: error %d\n", rc);
- PtlFini();
- RETURN (rc);
+ rc = PtlInit(&max_interfaces);
+ if (rc != PTL_OK) {
+ CERROR("PtlInit failed: %d\n", rc);
+ RETURN (-ENXIO);
}
- PtlNIDebug(tcpnal_ni, ~0);
- RETURN(rc);
+ RETURN(0);
}
int
-kportal_nal_cmd(struct portals_cfg *pcfg)
+libcfs_nal_cmd(struct portals_cfg *pcfg)
{
/* handle portals command if we want */
return 0;
}
-extern int class_handle_ioctl(struct obd_class_user_state *ocus, unsigned int cmd, unsigned long arg);
+extern int class_handle_ioctl(unsigned int cmd, unsigned long arg);
int lib_ioctl_nalcmd(int dev_id, int opc, void * ptr)
{
ioc->ioc_pbuf1 = ioc->ioc_bulk;
//XXX
- rc = class_handle_ioctl(&ocus, opc, (unsigned long)ptr);
+ rc = class_handle_ioctl(opc, (unsigned long)ptr);
printf ("proccssing ioctl cmd: %x, rc %d\n", opc, rc);
int lllib_init(char *dumpfile)
{
- INIT_LIST_HEAD(&ocus.ocus_conns);
-
if (!g_zconf) {
/* this parse only get my nid from config file
* before initialize portals
} else {
/* XXX need setup mynid before tcpnal initialize */
tcpnal_mynid = ((uint64_t)getpid() << 32) | time(0);
- printf("set tcpnal mynid: %016llx\n", tcpnal_mynid);
+ printf("LibLustre: TCPNAL NID: %016llx\n", tcpnal_mynid);
}
init_current("dummy");
if (init_obdclass() ||
init_lib_portals() ||
ptlrpc_init() ||
- ldlm_init() ||
mdc_init() ||
lov_init() ||
osc_init())
}
#endif
-int liblustre_process_log(struct config_llog_instance *cfg)
+int liblustre_process_log(struct config_llog_instance *cfg, int allow_recov)
{
struct lustre_cfg lcfg;
char *peer = "MDS_PEER_UUID";
CERROR("Can't parse NID %s\n", g_zconf_mdsnid);
RETURN(-EINVAL);
}
+
nal = ptl_name2nal("tcp");
if (nal <= 0) {
CERROR("Can't parse NAL tcp\n");
if (obd == NULL)
GOTO(out_cleanup, err = -EINVAL);
+ /* Disable initial recovery on this import */
+ err = obd_set_info(obd->obd_self_export,
+ strlen("initial_recov"), "initial_recov",
+ sizeof(allow_recov), &allow_recov);
+
err = obd_connect(&mdc_conn, obd, &mdc_uuid);
if (err) {
CERROR("cannot connect to %s: rc = %d\n",
/* env variables */
#define ENV_LUSTRE_MNTPNT "LIBLUSTRE_MOUNT_POINT"
#define ENV_LUSTRE_MNTTGT "LIBLUSTRE_MOUNT_TARGET"
+#define ENV_LUSTRE_TIMEOUT "LIBLUSTRE_TIMEOUT"
#define ENV_LUSTRE_DUMPFILE "LIBLUSTRE_DUMPFILE"
extern int _sysio_native_init();
+extern unsigned int obd_timeout;
+
/* global variables */
int g_zconf = 0; /* zeroconf or dumpfile */
char *g_zconf_mdsname = NULL; /* mdsname, for zeroconf */
{
char *lustre_path = NULL;
char *target = NULL;
+ char *timeout = NULL;
char *dumpfile = NULL;
char *root_driver = "native";
char *lustre_driver = "llite";
int err;
- srand(time(NULL));
+ /* consider tha case of starting multiple liblustre instances
+ * at a same time on single node.
+ */
+ srand(time(NULL) + getpid());
signal(SIGUSR1, sighandler_USR1);
lustre_path, target);
}
+ timeout = getenv(ENV_LUSTRE_TIMEOUT);
+ if (timeout) {
+ obd_timeout = (unsigned int) atoi(timeout);
+ printf("LibLustre: set obd timeout as %u seconds\n",
+ obd_timeout);
+ }
+
if (_sysio_init() != 0) {
perror("init sysio");
exit(1);