[Pvfs2-cvs] commit by kunkel in pvfs2/src/server: readdir.sm pvfs2-server.c pvfs2-server.h setparam.sm get-attr.sm remove.sm

CVS commit program cvs at parl.clemson.edu
Sat Dec 2 06:20:42 EST 2006


Update of /projects/cvsroot/pvfs2/src/server
In directory parlweb1:/tmp/cvs-serv18213/src/server

Modified Files:
      Tag: kunkel-hint-branch
	readdir.sm pvfs2-server.c pvfs2-server.h setparam.sm 
	get-attr.sm remove.sm 
Log Message:
Upgrade to current CVS version


Index: readdir.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/readdir.sm,v
diff -p -u -r1.45.4.2 -r1.45.4.3
--- readdir.sm	25 Sep 2006 15:28:38 -0000	1.45.4.2
+++ readdir.sm	2 Dec 2006 11:20:42 -0000	1.45.4.3
@@ -209,9 +209,10 @@ static int readdir_iterate_on_entries(
 
     gossip_debug(
         GOSSIP_READDIR_DEBUG, " - iterating keyvals: [%llu,%d], "
-        "\n\ttoken=0x%x, count=%d\n",
+        "\n\ttoken=%d, count=%d\n",
         llu(s_op->u.readdir.dirent_handle), s_op->req->u.readdir.fs_id,
-        s_op->req->u.readdir.token, s_op->req->u.readdir.dirent_count);
+        s_op->req->u.readdir.token, 
+        s_op->req->u.readdir.dirent_count);
 
     ret = job_trove_keyval_iterate(
         s_op->req->u.readdir.fs_id, s_op->u.readdir.dirent_handle,

Index: pvfs2-server.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/pvfs2-server.c,v
diff -p -u -r1.224.2.5 -r1.224.2.6
--- pvfs2-server.c	27 Sep 2006 09:59:12 -0000	1.224.2.5
+++ pvfs2-server.c	2 Dec 2006 11:20:42 -0000	1.224.2.6
@@ -173,6 +173,8 @@ static void write_pidfile(int fd);
 static void remove_pidfile(void);
 static int parse_port_from_host_id(char* host_id);
 
+static TROVE_method_id trove_coll_to_method_callback(TROVE_coll_id);
+
 /* table of incoming request types and associated parameters */
 struct PINT_server_req_params PINT_server_req_table[] =
 {
@@ -945,7 +947,6 @@ static int server_initialize_subsystems(
     PINT_server_status_flag *server_status_flag)
 {
     int ret = -PVFS_EINVAL;
-    char *method_name = NULL;
     char *cur_merged_handle_range = NULL;
     PINT_llist *cur = NULL;
     struct filesystem_configuration_s *cur_fs;
@@ -1006,12 +1007,8 @@ static int server_initialize_subsystems(
                                    &server_config.db_cache_size_bytes);
     /* this should never fail */
     assert(ret == 0);
-    ret = trove_collection_setinfo(0, 0, TROVE_ALT_AIO_MODE,
-        &server_config.trove_alt_aio_mode);
-    /* this should never fail */
-    assert(ret == 0);
     ret = trove_collection_setinfo(0, 0, TROVE_MAX_CONCURRENT_IO,
-        &server_config.trove_max_concurrent_io);
+                                   &server_config.trove_max_concurrent_io);
     /* this should never fail */
     assert(ret == 0);
 
@@ -1038,8 +1035,11 @@ static int server_initialize_subsystems(
     BMI_set_info(0, BMI_TCP_BUFFER_RECEIVE_SIZE, 
                  (void *)&server_config.tcp_buffer_size_receive);
 
-    ret = trove_initialize(server_config.storage_path,
-                           init_flags, &method_name, 0);
+    ret = trove_initialize(
+        server_config.trove_method, 
+        trove_coll_to_method_callback,
+        server_config.storage_path,
+        init_flags);
     if (ret < 0)
     {
         PVFS_perror_gossip("Error: trove_initialize", ret);
@@ -1095,6 +1095,7 @@ static int server_initialize_subsystems(
 
         orig_fsid = cur_fs->coll_id;
         ret = trove_collection_lookup(
+            cur_fs->trove_method,
             cur_fs->file_system_name, &(cur_fs->coll_id), NULL, NULL);
 
         if (ret < 0)
@@ -1547,7 +1548,7 @@ static int server_shutdown(
     {
         gossip_debug(GOSSIP_SERVER_DEBUG, "[+] halting storage "
                      "interface         [   ...   ]\n");
-        trove_finalize();
+        trove_finalize(server_config.trove_method);
         gossip_debug(GOSSIP_SERVER_DEBUG, "[-]         storage "
                      "interface         [ stopped ]\n");
     }
@@ -2050,6 +2051,19 @@ static int parse_port_from_host_id(char*
     return(port_num);
 }
 
+static TROVE_method_id trove_coll_to_method_callback(TROVE_coll_id coll_id)
+{
+    struct filesystem_configuration_s * fs_conf;
+    
+    fs_conf = PINT_config_find_fs_id(&server_config, coll_id);
+    if(!fs_conf)
+    {
+        return server_config.trove_method;
+    }
+    return fs_conf->trove_method;
+}
+
+#ifndef GOSSIP_DISABLE_DEBUG
 void PINT_server_access_debug(PINT_server_op * s_op,
                               int64_t debug_mask,
                               const char * format,
@@ -2087,6 +2101,7 @@ void PINT_server_access_debug(PINT_serve
         va_end(ap);
     }
 }
+#endif
 
 /*
  * PINT_map_server_op_to_string()

Index: pvfs2-server.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/pvfs2-server.h,v
diff -p -u -r1.138.2.1 -r1.138.2.2
--- pvfs2-server.h	25 Sep 2006 12:39:52 -0000	1.138.2.1
+++ pvfs2-server.h	2 Dec 2006 11:20:42 -0000	1.138.2.2
@@ -135,14 +135,24 @@ typedef struct PINT_server_trove_keys
 } PINT_server_trove_keys_s;
 
 extern PINT_server_trove_keys_s Trove_Common_Keys[];
-
-enum
+/* Reserved keys */
+enum 
 {
     ROOT_HANDLE_KEY      = 0,
     DIR_ENT_KEY          = 1,
     METAFILE_HANDLES_KEY = 2,
     METAFILE_DIST_KEY    = 3,
-    SYMLINK_TARGET_KEY   = 4
+    SYMLINK_TARGET_KEY   = 4,
+};
+
+/* optional; user-settable keys */
+enum 
+{
+    DIST_NAME_KEY        = 0,
+    DIST_PARAMS_KEY      = 1,
+    NUM_DFILES_KEY       = 2,
+    NUM_SPECIAL_KEYS     = 3, /* not an index */
+    METAFILE_HINT_KEY    = 3,
 };
 
 typedef enum
@@ -236,12 +246,11 @@ struct PINT_server_remove_op
                                    * the event that we are removing a
                                    * directory */
     PVFS_size dirent_count;
-    PVFS_ds_keyval * key_array;
+    PVFS_ds_keyval key;
     PVFS_ds_position pos;
     int key_count;
     int index;
     int remove_keyvals_state;
-    PVFS_ds_keyval_handle_info keyval_handle_info;
 };
 
 struct PINT_server_mgmt_remove_dirent_op

Index: setparam.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/setparam.sm,v
diff -p -u -r1.29.4.1 -r1.29.4.2
--- setparam.sm	26 Sep 2006 13:03:12 -0000	1.29.4.1
+++ setparam.sm	2 Dec 2006 11:20:42 -0000	1.29.4.2
@@ -198,6 +198,7 @@ static int check_fs_id(PVFS_fs_id fs_id)
     TROVE_keyval_s name;
     TROVE_coll_id tmp_coll;
     TROVE_op_id tmp_id;
+    struct server_configuration_s * server_config;
 
     name.buffer = malloc(PVFS_NAME_MAX);
     if (!name.buffer)
@@ -207,9 +208,12 @@ static int check_fs_id(PVFS_fs_id fs_id)
     }
     name.buffer_sz = PVFS_NAME_MAX;
 
+    server_config = get_server_config_struct();
+
     while(count == 1)
     {
         ret = trove_collection_iterate(
+            server_config->trove_method,
             &pos, &name, &tmp_coll, &count, 0, 0, NULL, &tmp_id);
 
         if (ret == 0)

Index: get-attr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/get-attr.sm,v
diff -p -u -r1.80.4.2 -r1.80.4.3
--- get-attr.sm	25 Sep 2006 15:28:38 -0000	1.80.4.2
+++ get-attr.sm	2 Dec 2006 11:20:42 -0000	1.80.4.3
@@ -29,19 +29,12 @@
 #include "pint-util.h"
 #include "pvfs2-internal.h"
 
-enum 
-{
-    DIST_NAME_KEY = 0,
-    DIST_PARAMS_KEY = 1,
-    NUM_DFILES_KEY = 2,
-    NUM_SPECIAL_KEYS = 3,
-};
-
 PINT_server_trove_keys_s Trove_Special_Keys[] =
 {
-    {"user.pvfs2.dist_name", 21},
-    {"user.pvfs2.dist_params", 23},
-    {"user.pvfs2.num_dfiles", 22},
+    {"user.pvfs2.dist_name"  , SPECIAL_DIST_NAME_KEYLEN},
+    {"user.pvfs2.dist_params", SPECIAL_DIST_PARAMS_KEYLEN},
+    {"user.pvfs2.num_dfiles" , SPECIAL_NUM_DFILES_KEYLEN},
+    {"user.pvfs2.meta_hint"  , SPECIAL_METAFILE_HINT_KEYLEN},
 };
 
 enum
@@ -73,6 +66,10 @@ static int getattr_read_metafile_datafil
     PINT_server_op *s_op, job_status_s *js_p);
 static int getattr_read_metafile_distribution_if_required(
     PINT_server_op *s_op, job_status_s *js_p);
+static int getattr_read_metafile_hint(
+    PINT_server_op *s_op, job_status_s *js_p);
+static int getattr_interpret_metafile_hint(
+    PINT_server_op *s_op, job_status_s *js_p);
 static int getattr_setup_resp(
     PINT_server_op *s_op, job_status_s *js_p);
 static int getattr_setup_op(
@@ -83,11 +80,13 @@ static int getattr_setup_op(
 nested machine pvfs2_get_attr_work_sm(
     verify_attribs,
     read_symlink_target,
+    read_metafile_hint,
     read_metafile_datafile_handles_if_required,
     read_metafile_distribution_if_required,
     get_dirdata_handle,
     get_dirent_count,
     interpret_dirent_count,
+    interpret_metafile_hint,
     get_dir_hint,
     interpret_dir_hint,
     setup_resp)
@@ -96,7 +95,7 @@ nested machine pvfs2_get_attr_work_sm(
     {
         run getattr_verify_attribs;
         STATE_SYMLINK => read_symlink_target;
-        STATE_METAFILE => read_metafile_datafile_handles_if_required;
+        STATE_METAFILE => read_metafile_hint;
         STATE_DIR => get_dirdata_handle;
         default => setup_resp;
     }
@@ -107,6 +106,19 @@ nested machine pvfs2_get_attr_work_sm(
         default => setup_resp;
     }
 
+    state read_metafile_hint
+    {
+        run getattr_read_metafile_hint;
+        default => interpret_metafile_hint;
+    }
+
+    state interpret_metafile_hint
+    {
+        run getattr_interpret_metafile_hint;
+        STATE_METAFILE => read_metafile_datafile_handles_if_required;
+        default => setup_resp;
+    }
+
     state read_metafile_datafile_handles_if_required
     {
         run getattr_read_metafile_datafile_handles_if_required;
@@ -315,19 +327,7 @@ static int getattr_verify_attribs(
 
             resp_attr->mask &= ~PVFS_ATTR_META_DIST;
         }
-
-        if ((resp_attr->mask & PVFS_ATTR_META_DFILES) ||
-            (resp_attr->mask & PVFS_ATTR_META_DIST))
-        {
-            gossip_debug(GOSSIP_GETATTR_DEBUG, " * client wants extra "
-                         "meta info, about to retrieve it now\n");
-            js_p->error_code = STATE_METAFILE;
-        }
-        else
-        {
-            gossip_debug(GOSSIP_GETATTR_DEBUG, " * client doesn't want "
-                         "extra meta info, preparing response now\n");
-        }
+        js_p->error_code = STATE_METAFILE;
     }
     else if (resp_attr->objtype == PVFS_TYPE_DATAFILE)
     {
@@ -429,7 +429,7 @@ static int getattr_read_symlink_target(
         js_p->error_code = 0;
         return 1;
     }
-
+    
     s_op->key.buffer    = Trove_Common_Keys[SYMLINK_TARGET_KEY].key;
     s_op->key.buffer_sz = Trove_Common_Keys[SYMLINK_TARGET_KEY].size;
 
@@ -453,7 +453,54 @@ static int getattr_read_symlink_target(
 
     ret = job_trove_keyval_read(
         s_op->u.getattr.fs_id, s_op->u.getattr.handle,
-        &(s_op->key), &(s_op->val), 
+        &s_op->key, &s_op->val, 
+        0, 
+        NULL, s_op, 0, js_p,
+        &i, server_job_context,
+        s_op->req->hints
+        );
+
+
+    return ret;
+}
+
+static int getattr_read_metafile_hint(
+    PINT_server_op *s_op, job_status_s *js_p)
+{
+    int ret = -PVFS_EINVAL;
+    job_id_t i;
+    char *buf = NULL;
+
+    assert(s_op->attr.objtype == PVFS_TYPE_METAFILE);
+    buf = (char *) calloc(sizeof(PVFS_metafile_hint) + 1, 1);
+    if (buf == NULL) 
+    {
+        js_p->error_code = -PVFS_ENOMEM;
+        /*If we hit an error the DIST & DFILES are no longer valid*/
+        s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DIST;
+        s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DFILES;
+        return 1;
+    }
+
+    js_p->error_code = 0;
+
+    s_op->key.buffer = Trove_Special_Keys[METAFILE_HINT_KEY].key;
+    s_op->key.buffer_sz = Trove_Special_Keys[METAFILE_HINT_KEY].size;
+
+    s_op->val.buffer = buf;
+    s_op->val.buffer_sz = sizeof(s_op->resp.u.getattr.attr.u.meta.hint) + 1;
+
+    gossip_debug(GOSSIP_GETATTR_DEBUG,
+		 "  reading metafile hint (coll_id = %d, "
+                 "handle = %llu, key = %s (%d), val_buf = %p (%d))\n",
+		 s_op->u.getattr.fs_id,
+		 llu(s_op->u.getattr.handle), (char *)s_op->key.buffer,
+		 s_op->key.buffer_sz, s_op->val.buffer,
+		 s_op->val.buffer_sz);
+
+    ret = job_trove_keyval_read(
+        s_op->u.getattr.fs_id, s_op->u.getattr.handle,
+        &s_op->key, &s_op->val, 
         0, 
         NULL, s_op, 0, js_p,
         &i, server_job_context, s_op->req->hints);
@@ -461,6 +508,46 @@ static int getattr_read_symlink_target(
     return ret;
 }
 
+static int getattr_interpret_metafile_hint(
+    PINT_server_op *s_op, job_status_s *js_p)
+{
+    PVFS_object_attr *resp_attr = NULL;
+
+    resp_attr = &s_op->resp.u.getattr.attr;
+    assert(resp_attr->objtype == PVFS_TYPE_METAFILE);
+    if (js_p->error_code == 0 || js_p->error_code == -TROVE_ENOENT)
+    {
+        if (js_p->error_code == 0)
+        {
+            memcpy(&s_op->resp.u.getattr.attr.u.meta.hint, s_op->val.buffer, 
+                sizeof(s_op->resp.u.getattr.attr.u.meta.hint));
+        }
+        if ((resp_attr->mask & PVFS_ATTR_META_DFILES) ||
+            (resp_attr->mask & PVFS_ATTR_META_DIST))
+        {
+            gossip_debug(GOSSIP_GETATTR_DEBUG, " * client wants extra "
+                         "meta info, about to retrieve it now\n");
+            js_p->error_code = STATE_METAFILE;
+        }
+        else
+        {
+            gossip_debug(GOSSIP_GETATTR_DEBUG, " * client doesn't want "
+                         "extra meta info, preparing response now\n");
+            js_p->error_code = 0;
+        }
+    }
+    else {
+        /*If we hit an error the DIST & DFILES are no longer valid*/
+        s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DIST;
+        s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DFILES;
+    }
+    if (s_op->val.buffer)
+    {
+        free(s_op->val.buffer);
+        s_op->val.buffer = NULL;
+    }
+    return 1;
+}
 
 static int getattr_read_metafile_datafile_handles_if_required(
     PINT_server_op *s_op, job_status_s *js_p)
@@ -531,6 +618,9 @@ static int getattr_read_metafile_datafil
         gossip_err("Cannot allocate dfile array of count %d\n",
                    dfile_count);
 	js_p->error_code = -PVFS_ENOMEM;
+        /*If we hit an error the DIST & DFILES are no longer valid*/
+        s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DIST;
+        s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DFILES;
 	return 1;
     }
 
@@ -587,6 +677,8 @@ static int getattr_read_metafile_distrib
                    "handle %llu,%d\n",llu(s_op->u.getattr.handle),
                    s_op->u.getattr.fs_id);
         js_p->error_code = -PVFS_EINVAL;
+        /*If we hit an error the DIST & DFILES are no longer valid*/
+        s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DIST;
         return 1;
     }
     assert(s_op->resp.u.getattr.attr.u.meta.dist_size > 0);
@@ -601,8 +693,11 @@ static int getattr_read_metafile_distrib
         gossip_err("Cannot allocate dist of size %d\n",
                    s_op->val.buffer_sz);
 	js_p->error_code = -PVFS_ENOMEM;
+        /*If we hit an error the DIST & DFILES are no longer valid*/
+        s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DIST;
 	return 1;
     }
+    s_op->free_val = 1;
 
     ret = job_trove_keyval_read(
         s_op->u.getattr.fs_id, s_op->u.getattr.handle,
@@ -628,10 +723,14 @@ static int getattr_setup_resp(PINT_serve
     }
     if(js_p->error_code < 0)
     {
-        if(s_op->val.buffer)
+        if (s_op->free_val && s_op->val.buffer)
         {
             free(s_op->val.buffer);
+            s_op->free_val = 0;
         }
+        /*If we hit an error the DIST & DFILES are no longer valid*/
+        s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DIST;
+        s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DFILES;
         return 1;
     }
 
@@ -922,7 +1021,6 @@ static int getattr_get_dir_hint(
     {
         js_p->error_code = -PVFS_ENOMEM;
         return 1;
-
     }
     for (i = 0; i < NUM_SPECIAL_KEYS; i++)
     {

Index: remove.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/remove.sm,v
diff -p -u -r1.50.4.2 -r1.50.4.3
--- remove.sm	25 Sep 2006 15:28:38 -0000	1.50.4.2
+++ remove.sm	2 Dec 2006 11:20:42 -0000	1.50.4.3
@@ -289,11 +289,15 @@ static int remove_get_dirent_count(
     }
     js_p->error_code = 0;
 
-    ret = job_trove_keyval_get_handle_info(
+
+    ret = job_trove_keyval_iterate_keys(
         s_op->u.remove.fs_id,
         s_op->u.remove.dirdata_handle,
-        TROVE_KEYVAL_HANDLE_COUNT,
-        &s_op->u.remove.keyval_handle_info,
+        PVFS_ITERATE_START,
+        &s_op->u.remove.key,
+        1,
+        0,
+        NULL,
         s_op,
         0,
         js_p,
@@ -308,15 +312,14 @@ static int remove_check_dirdata_entries(
 {
     if (js_p->error_code == 0)
     {
-        if (s_op->u.remove.keyval_handle_info.count > 0)
+        if(js_p->count > 0)
         {
             gossip_debug(GOSSIP_SERVER_DEBUG, 
                          " detected non-empty "
-                         "directory (fsid: %u, handle: %llu, size %llu) "
+                         "directory (fsid: %u, handle: %llu) "
                          "-- returning error\n",
                          s_op->u.remove.fs_id,
-                         llu(s_op->u.remove.handle),
-                         llu(s_op->u.remove.dirent_count));
+                         llu(s_op->u.remove.handle));
             js_p->error_code = -PVFS_ENOTEMPTY;
         }
     }
@@ -324,11 +327,8 @@ static int remove_check_dirdata_entries(
     {
         /* no entries because count is 0 */
         js_p->error_code = 0;
-        s_op->u.remove.keyval_handle_info.count = 0;
     }
 
-    /* setup position for next state (remove[_dirdata]_keyvals) */
-    s_op->u.remove.pos = PVFS_ITERATE_START;
      return 1;
 }
 
@@ -350,7 +350,7 @@ static int remove_remove_dirdata_dspace(
     ret = job_trove_dspace_remove(
         s_op->u.remove.fs_id,
         s_op->u.remove.dirdata_handle,
-        TROVE_SYNC,
+        0,  /* don't sync here, we do a dspace remove on the dir handle next */
         s_op,
         0,
         js_p,



More information about the Pvfs2-cvs mailing list