Skip to content

Commit

Permalink
fix offset bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Dalessandro committed Jan 31, 2008
1 parent 05174d6 commit 10c1add
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions src/client/sysint/sys-osd-io.sm
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ static int osd_io_setup_msgpairs(struct PINT_smcb *smcb, job_status_s *js_p)
int i, ret = 0;
struct osd_command *command;
struct bsg_iovec *iov;
int dfile_count = sm_p->u.io.datafile_count;

/* clients offset and length pairs */
PVFS_offset offseta[OSD_INIT_MAX_IOVEC];
Expand All @@ -192,24 +193,25 @@ static int osd_io_setup_msgpairs(struct PINT_smcb *smcb, job_status_s *js_p)
PVFS_offset target_offset[OSD_INIT_MAX_IOVEC];
PVFS_size target_size[OSD_INIT_MAX_IOVEC];

/* total bytes to write across all io servers */
PVFS_size sbytemax = io->mem_req->aggregate_size;
/* total bytes to read/write from each io server */
PVFS_size sbytemax = io->mem_req->aggregate_size / dfile_count;
PVFS_size this_aggregate_size = 0;

/* structures to pass into req proc engine */
PINT_Request_result sresult, cresult;



/* kernel SCSI layer can only handle so many pages at once */
if (sbytemax > KERNEL_BUFSIZE) {
gossip_err("%s: Kernel SCSI buffer too small\n", __func__);
ret = -ENOMEM;
goto out;
gossip_debug(GOSSIP_IO_DEBUG, "%s: SCSI buffer %lld cant handle %lld\n",
__func__, lld(KERNEL_BUFSIZE), lld(sbytemax));
//~ ret = -ENOMEM;
//~ goto out;
sbytemax = KERNEL_BUFSIZE / sm_p->u.io.datafile_count;

}

/* for each datafile/io server/osd write ALL of its data */
for (i = 0; i < sm_p->u.io.datafile_count; i++) {
for (i = 0; i < dfile_count; i++) {
uint8_t *p;
uint32_t len;
PVFS_offset cur_offset;
Expand All @@ -218,6 +220,7 @@ static int osd_io_setup_msgpairs(struct PINT_smcb *smcb, job_status_s *js_p)

datafile_handle = attr->u.meta.dfile_array[io->datafile_index_array[i]];


if (PINT_REQUEST_DONE(&io->file_req_state[i]) || io->short_read[i]) {
gossip_debug(GOSSIP_IO_DEBUG, "%s: Nothing to do for server %d\n",
__func__, i);
Expand Down Expand Up @@ -362,14 +365,14 @@ static int osd_io_setup_msgpairs(struct PINT_smcb *smcb, job_status_s *js_p)
/* Build the command for this server, using physical offset. */
if (io->io_type == PVFS_IO_READ) {
osd_command_set_read(command, PVFS_OSD_DATA_PID, datafile_handle,
len, 0);
len, cur_offset);
command->indata = p;
command->inlen_alloc = len;
command->iov_inlen = csegs_count;

} else if (io->io_type == PVFS_IO_WRITE) {
osd_command_set_write(command, PVFS_OSD_DATA_PID, datafile_handle,
len, 0);
len, cur_offset);
command->outdata = p;
command->outlen = len;
command->iov_outlen = csegs_count;
Expand Down Expand Up @@ -576,11 +579,12 @@ static int osd_io_setup_msgpairs(struct PINT_smcb *smcb, job_status_s *js_p)



gossip_debug(GOSSIP_IO_DEBUG, "%s: Aggreagte Written: %lld\n", __func__,
gossip_debug(GOSSIP_IO_DEBUG, "%s: Aggreagte Transferred: %lld\n", __func__,
lld(this_aggregate_size));

if (this_aggregate_size != sbytemax) {
gossip_err("%s: Did not get correct amount of data\n", __func__);
if (this_aggregate_size != sbytemax * dfile_count) {
gossip_err("%s: Got %lld bytes data and wanted %lld bytes\n",
__func__, lld(this_aggregate_size), lld(sbytemax));
ret = -EINVAL;
}

Expand Down Expand Up @@ -694,8 +698,6 @@ static int osd_io_maybe_xfer_more(struct PINT_smcb *smcb, job_status_s *js_p)
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
struct PINT_client_io_sm *io = &sm_p->u.io;
int i, more = 1;
/* only need to look at the first one */
//~ struct osd_command *command = &sm_p->msgarray[0].osd_command;

gossip_debug(GOSSIP_IO_DEBUG, "%s: total %lld want %lld.\n", __func__,
lld(io->total_size), lld(io->mem_req->aggregate_size));
Expand Down Expand Up @@ -733,7 +735,7 @@ static int osd_io_maybe_xfer_more(struct PINT_smcb *smcb, job_status_s *js_p)
gossip_debug(GOSSIP_IO_DEBUG, "%s: End result is: More %d\n", __func__,
more);

js_p->error_code = more ? LOOP_NEXT_CHUNK : 0;
js_p->error_code = more ? LOOP_NEXT_CHUNK : 0;
return 1;
}

Expand Down Expand Up @@ -772,7 +774,6 @@ static int osd_io_analyze_results(struct PINT_smcb *smcb, job_status_s *js_p)
if (ret)
goto out;
eor = filereq_ub_offset + sm_p->u.io.file_req_offset;

#if 0
/* Now we need to find out the maximum sizes of the bstreams. This
* will be used to see if there is more data in the global file than
Expand Down

0 comments on commit 10c1add

Please sign in to comment.