[Pvfs2-cvs] commit by slang in pvfs2/src/apps/kernel/linux:
pvfs2-client-core.c pvfs2-client.c
CVS commit program
cvs at parl.clemson.edu
Mon Dec 4 01:18:25 EST 2006
Update of /projects/cvsroot/pvfs2/src/apps/kernel/linux
In directory parlweb1:/tmp/cvs-serv2372/src/apps/kernel/linux
Modified Files:
pvfs2-client-core.c pvfs2-client.c
Log Message:
merge of murali's kernel buffer size tuning options to HEAD.
Index: pvfs2-client-core.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/kernel/linux/pvfs2-client-core.c,v
diff -p -u -r1.77 -r1.78
--- pvfs2-client-core.c 25 Oct 2006 15:02:46 -0000 1.77
+++ pvfs2-client-core.c 4 Dec 2006 06:18:24 -0000 1.78
@@ -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
*/
@@ -99,6 +92,11 @@ typedef struct
int logstamp_type;
int logstamp_type_set;
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;
/*
@@ -182,10 +180,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;
@@ -204,6 +203,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);
@@ -1414,7 +1414,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));
+ pvfs2_bufmap_desc_count));
vfs_request->io_tmp_buf = malloc(
vfs_request->in_upcall.req.io.readahead_size);
@@ -1561,7 +1561,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_size));
/* get a shared kernel/userspace buffer for the I/O transfer */
vfs_request->io_kernel_mapped_buf =
@@ -1636,7 +1636,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_size))
{
gossip_err("post_iox_request: invalid buffer index %d\n",
vfs_request->in_upcall.req.iox.buf_index);
@@ -2253,7 +2254,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);
@@ -3147,6 +3148,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);
@@ -3229,7 +3231,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);
@@ -3323,7 +3325,9 @@ static void print_help(char *progname)
printf("--logfile=VALUE override the default log file\n");
printf("--logstamp=none|usec|datetime overrides the default log message's time stamp\n");
printf("--gossip-mask=MASK_LIST gossip logging mask\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)
{
@@ -3343,6 +3347,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},
{"standalone",0,0,0},
@@ -3373,6 +3379,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;
@@ -3771,6 +3799,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.21 -r1.22
--- pvfs2-client.c 13 Oct 2006 23:38:28 -0000 1.21
+++ pvfs2-client.c 4 Dec 2006 06:18:24 -0000 1.22
@@ -53,6 +53,8 @@ typedef struct
char *path;
char *logfile;
char *logstamp;
+ char *dev_buffer_count;
+ char *dev_buffer_size;
int threaded;
} options_t;
@@ -345,6 +347,18 @@ static int monitor_pvfs2_client(options_
arg_list[arg_index+1] = opts->logstamp;
arg_index+=2;
}
+ 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;
+ }
ret = execvp(opts->path, arg_list);
@@ -406,6 +420,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},
@@ -490,6 +506,16 @@ static void parse_args(int argc, char **
else if (strcmp("ncache-reclaim-percentage", cur_option) == 0)
{
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)
More information about the Pvfs2-cvs
mailing list