[Pvfs2-cvs] commit by kunkel in pvfs2/src/apps/kernel/linux: pvfs2-client-core.c pvfs2-client.c

CVS commit program cvs at parl.clemson.edu
Sat Jan 13 05:16:58 EST 2007


Update of /projects/cvsroot/pvfs2/src/apps/kernel/linux
In directory parlweb1:/tmp/cvs-serv19417/src/apps/kernel/linux

Modified Files:
      Tag: kunkel-hint-branch
	pvfs2-client-core.c pvfs2-client.c 
Log Message:
Synchronization with HEAD


Index: pvfs2-client-core.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/kernel/linux/pvfs2-client-core.c,v
diff -p -u -r1.73.2.3 -r1.73.2.4
--- pvfs2-client-core.c	2 Dec 2006 11:22:21 -0000	1.73.2.3
+++ pvfs2-client-core.c	13 Jan 2007 10:16:57 -0000	1.73.2.4
@@ -50,13 +50,6 @@
 #define OP_IN_PROGRESS      0xFFEEFF34
 
 /*
-  the block size to report in statfs as the blocksize (i.e. the
-  optimal i/o transfer size); regardless of this value, the fragment
-  size (underlying fs block size) in the kernel is fixed at 1024
-*/
-#define STATFS_DEFAULT_BLOCKSIZE PVFS2_BUFMAP_DEFAULT_DESC_SIZE
-
-/*
   default timeout value to wait for completion of in progress
   operations
 */
@@ -100,6 +93,11 @@ typedef struct
     int logstamp_type_set;
     int create_request_id;
     int standalone;
+    /* kernel module buffer size settings */
+    unsigned int dev_buffer_count;
+    int dev_buffer_count_set;
+    unsigned int dev_buffer_size;
+    int dev_buffer_size_set;
 } options_t;
 
 /*
@@ -184,10 +182,11 @@ static options_t s_opts;
 static job_context_id s_client_dev_context;
 static int s_client_is_processing = 1;
 
-/* We have 2 set of description buffers, one used for staging I/O and one for readdir/readdirplus */
+/* We have 2 sets of description buffers, one used for staging I/O 
+ * and one for readdir/readdirplus */
 #define NUM_MAP_DESC 2
 static struct PVFS_dev_map_desc s_io_desc[NUM_MAP_DESC];
-static int s_desc_size[NUM_MAP_DESC] = {PVFS2_BUFMAP_TOTAL_SIZE, PVFS2_READDIR_TOTAL_SIZE};
+static struct PINT_dev_params s_desc_params[NUM_MAP_DESC];
 
 static struct PINT_perf_counter* acache_pc = NULL;
 static struct PINT_perf_counter* ncache_pc = NULL;
@@ -207,6 +206,7 @@ static void print_help(char *progname);
 static void reset_acache_timeout(void);
 static char *get_vfs_op_name_str(int op_type);
 static int set_acache_parameters(options_t* s_opts);
+static void set_device_parameters(options_t *s_opts);
 static void reset_ncache_timeout(void);
 static int set_ncache_parameters(options_t* s_opts);
 static int create_request_id(PVFS_hint ** hint, vfs_request_t *vfs_request);
@@ -1491,7 +1491,7 @@ static PVFS_error post_io_readahead_requ
 
     assert((vfs_request->in_upcall.req.io.buf_index > -1) &&
            (vfs_request->in_upcall.req.io.buf_index <
-            PVFS2_BUFMAP_DESC_COUNT));
+            s_desc_params[BM_IO].dev_buffer_count));
 
     vfs_request->io_tmp_buf = malloc(
         vfs_request->in_upcall.req.io.readahead_size);
@@ -1639,7 +1639,7 @@ static PVFS_error post_io_request(vfs_re
 
     assert((vfs_request->in_upcall.req.io.buf_index > -1) &&
            (vfs_request->in_upcall.req.io.buf_index <
-            PVFS2_BUFMAP_DESC_COUNT));
+            s_desc_params[BM_IO].dev_buffer_count));
 
     /* get a shared kernel/userspace buffer for the I/O transfer */
     vfs_request->io_kernel_mapped_buf = 
@@ -1715,7 +1715,8 @@ static PVFS_error post_iox_request(vfs_r
             (unsigned long) vfs_request->in_upcall.req.iox.count);
 
     if ((vfs_request->in_upcall.req.iox.buf_index < 0) ||
-           (vfs_request->in_upcall.req.iox.buf_index >= PVFS2_BUFMAP_DESC_COUNT))
+           (vfs_request->in_upcall.req.iox.buf_index >= 
+            s_desc_params[BM_IO].dev_buffer_count))
     {
         gossip_err("post_iox_request: invalid buffer index %d\n",
                 vfs_request->in_upcall.req.iox.buf_index);
@@ -2338,7 +2339,7 @@ static inline void package_downcall_memb
             break;
         case PVFS2_VFS_OP_STATFS:
             vfs_request->out_downcall.resp.statfs.block_size =
-                STATFS_DEFAULT_BLOCKSIZE;
+                s_desc_params[BM_IO].dev_buffer_count;
             vfs_request->out_downcall.resp.statfs.blocks_total = (int64_t)
                 (vfs_request->response.statfs.statfs_buf.bytes_total /
                  vfs_request->out_downcall.resp.statfs.block_size);
@@ -2455,7 +2456,7 @@ static inline void package_downcall_memb
                     assert(buf);
 
                     /* copy cached data into the shared user/kernel space */
-                    memcpy(buf, (vfs_request->io_tmp_buf +
+                    memcpy(buf, ((char *) vfs_request->io_tmp_buf +
                                  vfs_request->in_upcall.req.io.offset),
                            vfs_request->in_upcall.req.io.count);
 
@@ -2987,7 +2988,7 @@ static PVFS_error process_vfs_requests(v
                (MAX_NUM_OPS * sizeof(vfs_request_t *)));
 
         ret = PVFS_sys_testsome(
-            op_id_array, &op_count, (void **)vfs_request_array,
+            op_id_array, &op_count, (void *) vfs_request_array,
             error_code_array, PVFS2_CLIENT_DEFAULT_TEST_TIMEOUT_MS);
 
         for(i = 0; i < op_count; i++)
@@ -3243,6 +3244,7 @@ int main(int argc, char **argv)
         PVFS_perror("set_ncache_parameters", ret);
         return(ret);
     }
+    set_device_parameters(&s_opts);
 
     /* start performance counters for acache */
     acache_pc = PINT_perf_initialize(acache_keys);
@@ -3325,7 +3327,7 @@ int main(int argc, char **argv)
 
     /* setup a mapped region for I/O transfers */
     memset(s_io_desc, 0 , NUM_MAP_DESC * sizeof(struct PVFS_dev_map_desc));
-    ret = PINT_dev_get_mapped_regions(NUM_MAP_DESC, s_io_desc, s_desc_size);
+    ret = PINT_dev_get_mapped_regions(NUM_MAP_DESC, s_io_desc, s_desc_params);
     if (ret < 0)
     {
 	PVFS_perror("PINT_dev_get_mapped_region", ret);
@@ -3420,7 +3422,9 @@ static void print_help(char *progname)
     printf("--logstamp=none|usec|datetime overrides the default log message's time stamp\n");
     printf("--gossip-mask=MASK_LIST       gossip logging mask\n");
     printf("--create-request-id           create a id which is transfered to the server\n");
- }
+    printf("--desc-count=VALUE            overrides the default # of kernel buffer descriptors\n");
+    printf("--desc-size=VALUE             overrides the default size of each kernel buffer descriptor\n");
+}
 
 static void parse_args(int argc, char **argv, options_t *opts)
 {
@@ -3440,6 +3444,8 @@ static void parse_args(int argc, char **
         {"acache-soft-limit",1,0,0},
         {"ncache-hard-limit",1,0,0},
         {"ncache-soft-limit",1,0,0},
+        {"desc-count",1,0,0},
+        {"desc-size",1,0,0},
         {"logfile",1,0,0},
         {"logstamp",1,0,0},
         {"create-request-id",0,0,0},
@@ -3471,6 +3477,28 @@ static void parse_args(int argc, char **
                 {
                     goto do_ncache;
                 }
+                else if (strcmp("desc-count", cur_option) == 0) 
+                {
+                    ret = sscanf(optarg, "%u", &opts->dev_buffer_count);
+                    if(ret != 1)
+                    {
+                        gossip_err(
+                            "Error: invalid descriptor count value.\n");
+                        exit(EXIT_FAILURE);
+                    }
+                    opts->dev_buffer_count_set = 1;
+                }
+                else if (strcmp("desc-size", cur_option) == 0)
+                {
+                    ret = sscanf(optarg, "%u", &opts->dev_buffer_size);
+                    if(ret != 1)
+                    {
+                        gossip_err(
+                            "Error: invalid descriptor size value.\n");
+                        exit(EXIT_FAILURE);
+                    }
+                    opts->dev_buffer_size_set = 1;
+                }
                 else if (strcmp("logfile", cur_option) == 0)
                 {
                     goto do_logfile;
@@ -3873,6 +3901,30 @@ static int set_ncache_parameters(options
     }
 
     return(0);
+}
+
+static void set_device_parameters(options_t *s_opts)
+{
+    if (s_opts->dev_buffer_count_set)
+    {
+        s_desc_params[BM_IO].dev_buffer_count = s_opts->dev_buffer_count;
+    }
+    else
+    {
+        s_desc_params[BM_IO].dev_buffer_count = PVFS2_BUFMAP_DEFAULT_DESC_COUNT;
+    }
+    if (s_opts->dev_buffer_size_set)
+    {
+        s_desc_params[BM_IO].dev_buffer_size  = s_opts->dev_buffer_size;
+    }
+    else
+    {
+        s_desc_params[BM_IO].dev_buffer_size = PVFS2_BUFMAP_DEFAULT_DESC_SIZE;
+    }
+    /* No command line options accepted for the readdir buffers */
+    s_desc_params[BM_READDIR].dev_buffer_count = PVFS2_READDIR_DEFAULT_DESC_COUNT;
+    s_desc_params[BM_READDIR].dev_buffer_size  = PVFS2_READDIR_DEFAULT_DESC_SIZE;
+    return;
 }
 
 /*

Index: pvfs2-client.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/kernel/linux/pvfs2-client.c,v
diff -p -u -r1.19.2.2 -r1.19.2.3
--- pvfs2-client.c	2 Dec 2006 11:22:21 -0000	1.19.2.2
+++ pvfs2-client.c	13 Jan 2007 10:16:57 -0000	1.19.2.3
@@ -26,7 +26,11 @@
 #define PVFS2_VERSION "Unknown"
 #endif
 
-#define PVFS2_CLIENT_CORE_NAME  "pvfs2-client-core"
+#define PVFS2_CLIENT_CORE_SUFFIX  "-core"
+#define PVFS2_CLIENT_CORE_NAME "pvfs2-client" PVFS2_CLIENT_CORE_SUFFIX
+#define PVFS2_CLIENT_CORE_THR_SUFFIX "-threaded"
+
+static char s_client_core_path[PATH_MAX];
 
 #define MAX_DEV_INIT_FAILURES 10
 
@@ -54,6 +58,8 @@ typedef struct
     char *logfile;
     char *logstamp;
     int create_request_id;
+    char *dev_buffer_count;
+    char *dev_buffer_size;
     int threaded;
 } options_t;
 
@@ -265,27 +271,22 @@ static int monitor_pvfs2_client(options_
         {
             sleep(1);
 
-            if (opts->verbose)
-            {
-                printf("About to exec %s\n",opts->path);
-            }
-
             if(opts->threaded)
             {
-                arg_list[0] = PVFS2_CLIENT_CORE_NAME "-threaded";
+                arg_list[0] = PVFS2_CLIENT_CORE_NAME PVFS2_CLIENT_CORE_THR_SUFFIX;
             }
             else
             {
                 arg_list[0] = PVFS2_CLIENT_CORE_NAME;
             }
 
-            arg_list[1] = "-a";
-            arg_list[2] = opts->acache_timeout;
-            arg_list[3] = "-n";
-            arg_list[4] = opts->ncache_timeout;
-            arg_list[5] = "-L";
-            arg_list[6] = opts->logfile;
-            arg_index = 7;
+            arg_index = 1;
+            arg_list[arg_index++] = "-a";
+            arg_list[arg_index++] = opts->acache_timeout;
+            arg_list[arg_index++] = "-n";
+            arg_list[arg_index++] = opts->ncache_timeout;
+            arg_list[arg_index++] = "-L";
+            arg_list[arg_index++] = opts->logfile;
             if(opts->acache_hard_limit)
             {
                 arg_list[arg_index] = "--acache-hard-limit";
@@ -351,7 +352,29 @@ static int monitor_pvfs2_client(options_
                 arg_list[arg_index] = "--create-request-id";
                 arg_index+=1;                
             }
+            if(opts->dev_buffer_count)
+            {
+                arg_list[arg_index] = "--desc-count";
+                arg_list[arg_index+1] = opts->dev_buffer_count;
+                arg_index+=2;
+            }
+            if(opts->dev_buffer_size)
+            {
+                arg_list[arg_index] = "--desc-size";
+                arg_list[arg_index+1] = opts->dev_buffer_size;
+                arg_index+=2;
+            }
 
+            if(opts->verbose)
+            {
+                int i;
+                printf("About to exec: %s, with args: ", opts->path);
+                for(i = 0; i < arg_index; ++i)
+                {
+                    printf("%s ", arg_list[i]);
+                }
+                printf("\n");
+            }
             ret = execvp(opts->path, arg_list);
 
             fprintf(stderr, "Could not exec %s, errno is %d\n",
@@ -413,6 +436,8 @@ static void parse_args(int argc, char **
         {"ncache-timeout",1,0,0},
         {"ncache-soft-limit",1,0,0},
         {"ncache-hard-limit",1,0,0},
+        {"desc-count",1,0,0},
+        {"desc-size",1,0,0},
         {"ncache-reclaim-percentage",1,0,0},
         {"perf-time-interval-secs",1,0,0},
         {"perf-history-size",1,0,0},
@@ -500,6 +525,16 @@ static void parse_args(int argc, char **
                     opts->ncache_reclaim_percentage = optarg;
                     break;
                 }
+                else if (strcmp("desc-count", cur_option) == 0) 
+                {
+                    opts->dev_buffer_count = optarg;
+                    break;
+                }
+                else if (strcmp("desc-size", cur_option) == 0)
+                {
+                    opts->dev_buffer_size = optarg;
+                    break;
+                }
                 else if (strcmp("perf-time-interval-secs", cur_option) == 0)
                 {
                     opts->perf_time_interval_secs = optarg;
@@ -588,18 +623,18 @@ static void parse_args(int argc, char **
 
     if (!opts->path)
     {
-        /*
-          since they didn't specify a specific path, we're going to
-          let execlp() sort things out later
-        */
         if(opts->threaded)
         {
-            opts->path = PVFS2_CLIENT_CORE_NAME "-threaded";
+            sprintf(s_client_core_path, 
+                    "%s" PVFS2_CLIENT_CORE_SUFFIX PVFS2_CLIENT_CORE_THR_SUFFIX, 
+                    argv[0]);
         }
         else
         {
-            opts->path = PVFS2_CLIENT_CORE_NAME;
+            sprintf(s_client_core_path, "%s" PVFS2_CLIENT_CORE_SUFFIX,
+                    argv[0]);
         }
+        opts->path = s_client_core_path;
     }
 
     if (!opts->acache_timeout)



More information about the Pvfs2-cvs mailing list