Whamcloud - gitweb
add fsname in llog to support several fs configs in the same mgs
authorlincent <lincent>
Wed, 3 Aug 2005 22:06:58 +0000 (22:06 +0000)
committerlincent <lincent>
Wed, 3 Aug 2005 22:06:58 +0000 (22:06 +0000)
lustre/include/linux/lustre_log.h
lustre/obdclass/llog_lvfs.c
lustre/ptlrpc/llog_client.c

index 1a2707d..685ae14 100644 (file)
@@ -163,7 +163,7 @@ struct llog_operations {
         int (*lop_next_block)(struct llog_handle *h, int *curr_idx,
                               int next_idx, __u64 *offset, void *buf, int len);
         int (*lop_create)(struct llog_ctxt *ctxt, struct llog_handle **,
-                          struct llog_logid *logid, char *name);
+                          struct llog_logid *logid, char* fsname, char *name);
         int (*lop_close)(struct llog_handle *handle);
         int (*lop_read_header)(struct llog_handle *handle);
 
index d9db59b..d2f039a 100644 (file)
@@ -421,7 +421,8 @@ static int llog_lvfs_next_block(struct llog_handle *loghandle, int *cur_idx,
         RETURN(-EIO);
 }
 
-static struct file *llog_filp_open(char *name, int flags, int mode)
+static struct file *llog_filp_open(char* fsname, char *name, 
+                                   int flags, int mode)
 {
         char *logname;
         struct file *filp;
@@ -429,9 +430,12 @@ static struct file *llog_filp_open(char *name, int flags, int mode)
 
         OBD_ALLOC(logname, PATH_MAX);
         if (logname == NULL)
-                return ERR_PTR(-ENOMEM);
+                return ERR_PTR(-ENOMEM); 
+        if (fsname)
+              len = snprintf(logname, PATH_MAX, "CONFIGS/%s/%s", fsname, name);
+        else
+              len = snprintf(logname, PATH_MAX, "CONFIGS/%s", name);
 
-        len = snprintf(logname, PATH_MAX, "LOGS/%s", name);
         if (len >= PATH_MAX - 1) {
                 filp = ERR_PTR(-ENAMETOOLONG);
         } else {
@@ -448,7 +452,7 @@ static struct file *llog_filp_open(char *name, int flags, int mode)
 /* This is a callback from the llog_* functions.
  * Assumes caller has already pushed us into the kernel context. */
 static int llog_lvfs_create(struct llog_ctxt *ctxt, struct llog_handle **res,
-                            struct llog_logid *logid, char *name)
+                            struct llog_logid *logid, char* fsname, char *name)
 {
         struct llog_handle *handle;
         struct obd_device *obd;
@@ -499,7 +503,7 @@ static int llog_lvfs_create(struct llog_ctxt *ctxt, struct llog_handle **res,
                 handle->lgh_id = *logid;
 
         } else if (name) {
-                handle->lgh_file = llog_filp_open(name, open_flags, 0644);
+                handle->lgh_file = llog_filp_open(fsname, name, open_flags, 0644);
                 if (IS_ERR(handle->lgh_file))
                         GOTO(cleanup, rc = PTR_ERR(handle->lgh_file));
 
index 5ea8bca..a17aaa2 100644 (file)
 /* This is a callback from the llog_* functions.
  * Assumes caller has already pushed us into the kernel context. */
 static int llog_client_create(struct llog_ctxt *ctxt, struct llog_handle **res,
-                            struct llog_logid *logid, char *name)
+                            struct llog_logid *logid, char* fsname ,char *name)
 {
         struct obd_import *imp;
         struct llogd_body req_body;
         struct llogd_body *body;
         struct llog_handle *handle;
         struct ptlrpc_request *req = NULL;
-        int size[2] = {sizeof(req_body)};
-        char *tmp[2] = {(char*) &req_body};
+        int size[3] = {sizeof(req_body)};
+        char *tmp[3] = {(char*) &req_body};
         int bufcount = 1;
         int repsize[] = {sizeof (req_body)};
         int rc;
@@ -76,13 +76,20 @@ static int llog_client_create(struct llog_ctxt *ctxt, struct llog_handle **res,
                 req_body.lgd_logid = *logid;
         req_body.lgd_ctxt_idx = ctxt->loc_idx - 1;
 
+        if (fsname) {
+                size[bufcount] = strlen(fsname) + 1;
+                tmp[bufcount] = fsname;
+                bufcount++;
+        }
+
         if (name) {
                 size[bufcount] = strlen(name) + 1;
                 tmp[bufcount] = name;
                 bufcount++;
         }
 
-        req = ptlrpc_prep_req(imp, LLOG_ORIGIN_HANDLE_CREATE,bufcount,size,tmp);
+        req = ptlrpc_prep_req(imp, LLOG_ORIGIN_HANDLE_CREATE, 
+                              bufcount, size, tmp);
         if (!req)
                 GOTO(err_free, rc = -ENOMEM);