Skip to content

Commit

Permalink
DAOS-187 vos: reorganize vos I/O functions
Browse files Browse the repository at this point in the history
Based on recent changes of object model, VOS I/O functions has been
modified for a few times and there are some legacy code.

This patch cleans up those legacy code:
- reorganize code for recx fetch and update
- no data copy in btree member functions anymore, object I/O routines
  will copy in/out data for non-zc I/O.
- eliminate the restriction of iov buffer must align with record size
- return 0 and set record sizes to 0 for nonexistent object/dkey/akey
- cleanup for for recx hole fetching
- release unused spaces for record zc overwrite.
- remove unused checks from vos_tree
- minor fixes for vos tests

Change-Id: I528245734bcb7433127538e7cd4c5b5b4bf0e52d
Signed-off-by: Liang Zhen <[email protected]>
Reviewed-on: https://review.whamcloud.com/24496
Tested-by: Jenkins
Reviewed-by: Johann Lombardi <[email protected]>
  • Loading branch information
gnailzenh authored and johannlombardi committed Jan 5, 2017
1 parent 47cd8d5 commit 0502a9a
Show file tree
Hide file tree
Showing 4 changed files with 417 additions and 406 deletions.
11 changes: 4 additions & 7 deletions src/vos/tests/vts_discard.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,9 @@ io_fetch(struct io_test_args *arg, daos_epoch_t fetch_epoch,
&req->sgl, false);
if (rc)
D_GOTO(exit, rc);
if (!rc && req->rex.rx_rsize == 0)
if (req->rex.rx_rsize == 0)
return -DER_NONEXIST;


assert_memory_equal(req->update_buf, req->fetch_buf, UPDATE_BUF_SIZE);

exit:
Expand Down Expand Up @@ -328,7 +327,6 @@ io_near_epoch_tests(struct io_test_args *arg, char *dkey,
D_ALLOC(reqs, (num * sizeof(struct io_req *)));
D_ALLOC(punch, (num * sizeof(bool)));


for (i = 0; i < num; i++) {
struct daos_uuid l_cookie;

Expand All @@ -344,7 +342,6 @@ io_near_epoch_tests(struct io_test_args *arg, char *dkey,
else
uuid_copy(l_cookie.uuid, cookie[i].uuid);


rc = io_update(arg, epoch[i], &l_cookie, dkey,
akey, &cntrs, &reqs[i], idx[i],
UPDATE_VERBOSE);
Expand Down Expand Up @@ -439,7 +436,7 @@ io_near_epoch_punch(void **state)
int idx[3], rc = 0;
unsigned long flags[3];

memset(&flags, '0', 3 * sizeof(unsigned long));
memset(&flags, 0, 3 * sizeof(unsigned long));
set_key_and_index(&dkey_buf[0], &akey_buf[0], &idx[0]);
set_near_epoch_tests(&cookie[0], &epoch[0], &idx[0], 3);

Expand All @@ -461,7 +458,7 @@ io_discard_punch(void **state)
int idx[3], rc = 0;
unsigned long flags[3];

memset(&flags, '0', 3 * sizeof(unsigned long));
memset(&flags, 0, 3 * sizeof(unsigned long));
set_key_and_index(&dkey_buf[0], &akey_buf[0], &idx[0]);
set_near_epoch_tests(&cookie[0], &epoch[0], &idx[0], 3);

Expand Down Expand Up @@ -890,7 +887,7 @@ static const struct CMUnitTest discard_tests[] = {
io_near_epoch_punch,
io_multikey_discard_setup,
io_multikey_discard_teardown},
{ "VOS302.2: VOS discard punched record test",
{ "VOS302.3: VOS discard punched record test",
io_discard_punch,
io_multikey_discard_setup,
io_multikey_discard_teardown},
Expand Down
33 changes: 13 additions & 20 deletions src/vos/tests/vts_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -841,25 +841,20 @@ io_update_and_fetch_incorrect_dkey(struct io_test_args *arg,
memset(fetch_buf, 0, UPDATE_BUF_SIZE);
daos_iov_set(&val_iov, &fetch_buf[0], UPDATE_BUF_SIZE);

rex.rx_rsize = DAOS_REC_ANY;
/* will be set to zero after fetching a nonexistent key */
rex.rx_rsize = -1;

/* Injecting an incorrect dkey for fetch! */
dts_key_gen(&dkey_buf[0], UPDATE_DKEY_SIZE, UPDATE_DKEY);

rc = io_test_obj_fetch(arg, fetch_epoch, &dkey, &vio, &sgl, true);
if (rc)
goto exit;
assert_memory_equal(update_buf, fetch_buf, UPDATE_BUF_SIZE);
assert_int_equal(rc, 0);
assert_int_equal(rex.rx_rsize, 0);
exit:
return rc;
}

/**
* NB: this test assumes arg->oid is already created and
* used to insert in previous tests..
* If run independently this will be treated as a new object
* and return success
*/
/** fetch from a nonexistent object */
static void
io_fetch_wo_object(void **state)
{
Expand Down Expand Up @@ -897,9 +892,13 @@ io_fetch_wo_object(void **state)
memset(fetch_buf, 0, UPDATE_BUF_SIZE);
daos_iov_set(&val_iov, &fetch_buf[0], UPDATE_BUF_SIZE);

rex.rx_rsize = DAOS_REC_ANY;
/* should be set to zero after fetching a nonexistent object */
rex.rx_rsize = -1;
arg->oid = gen_oid();

rc = io_test_obj_fetch(arg, 1, &dkey, &vio, &sgl, true);
assert_int_equal(rc, -DER_NONEXIST);
assert_int_equal(rc, 0);
assert_int_equal(rex.rx_rsize, 0);
}

static int
Expand Down Expand Up @@ -981,24 +980,18 @@ static void
io_fetch_no_exist_dkey(void **state)
{
struct io_test_args *arg = *state;
int rc;

arg->ta_flags = 0;

rc = io_update_and_fetch_incorrect_dkey(arg, 1, 1);
assert_int_equal(rc, -DER_NONEXIST);
io_update_and_fetch_incorrect_dkey(arg, 1, 1);
}

static void
io_fetch_no_exist_dkey_zc(void **state)
{
struct io_test_args *arg = *state;
int rc;

arg->ta_flags = TF_ZERO_COPY;

rc = io_update_and_fetch_incorrect_dkey(arg, 1, 1);
assert_int_equal(rc, -DER_NONEXIST);
io_update_and_fetch_incorrect_dkey(arg, 1, 1);
}

static void
Expand Down
Loading

0 comments on commit 0502a9a

Please sign in to comment.