Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
LU-6142 uapi: Get rid of lustre_fid typedef
[fs/lustre-release.git]
/
lustre
/
tests
/
llapi_layout_test.c
diff --git
a/lustre/tests/llapi_layout_test.c
b/lustre/tests/llapi_layout_test.c
index
401003d
..
603cdb2
100644
(file)
--- a/
lustre/tests/llapi_layout_test.c
+++ b/
lustre/tests/llapi_layout_test.c
@@
-200,7
+200,7
@@
void test3(void)
{
int rc;
struct llapi_layout *layout;
-
lustre
_fid fid;
+
struct lu
_fid fid;
char fidstr[4096];
char path[PATH_MAX];
@@
-709,7
+709,9
@@
void test16(void)
rc = llapi_layout_stripe_count_get(filelayout, &fcount);
ASSERTF(rc == 0, "errno = %d", errno);
- ASSERTF(fcount == dcount, "%"PRIu64" != %"PRIu64, fcount, dcount);
+ ASSERTF(fcount == dcount || dcount == LLAPI_LAYOUT_DEFAULT ||
+ dcount == LLAPI_LAYOUT_WIDE,
+ "%"PRIu64" != %"PRIu64, fcount, dcount);
rc = llapi_layout_stripe_size_get(filelayout, &fsize);
ASSERTF(rc == 0, "errno = %d", errno);
@@
-730,7
+732,9
@@
void test16(void)
ASSERTF(rc == 0, "errno = %d", errno);
rc = llapi_layout_stripe_size_get(filelayout, &fsize);
ASSERTF(rc == 0, "errno = %d", errno);
- ASSERTF(fcount == dcount, "%"PRIu64" != %"PRIu64, fcount, dcount);
+ ASSERTF(fcount == dcount || dcount == LLAPI_LAYOUT_DEFAULT ||
+ dcount == LLAPI_LAYOUT_WIDE,
+ "%"PRIu64" != %"PRIu64, fcount, dcount);
ASSERTF(fsize == dsize, "%"PRIu64" != %"PRIu64, fsize, dsize);
llapi_layout_free(filelayout);
@@
-888,7
+892,9
@@
void test20(void)
ASSERTF(rc == 0, "errno = %d", errno);
rc = llapi_layout_stripe_count_get(deflayout, &dcount);
ASSERTF(rc == 0, "errno = %d", errno);
- ASSERTF(fcount == dcount, "%"PRIu64" != %"PRIu64, fcount, dcount);
+ ASSERTF(fcount == dcount || dcount == LLAPI_LAYOUT_DEFAULT ||
+ dcount == LLAPI_LAYOUT_WIDE,
+ "%"PRIu64" != %"PRIu64, fcount, dcount);
rc = llapi_layout_stripe_size_get(filelayout, &fsize);
ASSERTF(rc == 0, "errno = %d", errno);
@@
-1380,7
+1386,7
@@
void test30(void)
ASSERTF(s == start[2] && e == end[2],
"s: %"PRIu64", e: %"PRIu64"", s, e);
- rc = llapi_layout_comp_
move(layout, LLAPI_LAYOUT_COMP_POS
_FIRST);
+ rc = llapi_layout_comp_
use(layout, LLAPI_LAYOUT_COMP_USE
_FIRST);
ASSERTF(rc == 0, "rc %d, errno %d", rc, errno);
/* delete non-tail component will fail */
@@
-1392,7
+1398,7
@@
void test30(void)
ASSERTF(s == start[0] && e == end[0],
"s: %"PRIu64", e: %"PRIu64"", s, e);
- rc = llapi_layout_comp_
move(layout, LLAPI_LAYOUT_COMP_POS
_NEXT);
+ rc = llapi_layout_comp_
use(layout, LLAPI_LAYOUT_COMP_USE
_NEXT);
ASSERTF(rc == 0, "rc %d, errno %d", rc, errno);
rc = llapi_layout_comp_extent_get(layout, &s, &e);
@@
-1400,7
+1406,7
@@
void test30(void)
ASSERTF(s == start[1] && e == end[1],
"s: %"PRIu64", e: %"PRIu64"", s, e);
- rc = llapi_layout_comp_
move(layout, LLAPI_LAYOUT_COMP_POS
_NEXT);
+ rc = llapi_layout_comp_
use(layout, LLAPI_LAYOUT_COMP_USE
_NEXT);
ASSERTF(rc == 0, "rc %d, errno %d", rc, errno);
rc = llapi_layout_comp_del(layout);
@@
-1465,7
+1471,7
@@
void test31(void)
layout = llapi_layout_get_by_path(path, 0);
ASSERTF(layout != NULL, "errno = %d", errno);
- rc = llapi_layout_comp_
move(layout, LLAPI_LAYOUT_COMP_POS
_FIRST);
+ rc = llapi_layout_comp_
use(layout, LLAPI_LAYOUT_COMP_USE
_FIRST);
ASSERTF(rc == 0, "rc %d, errno %d", rc, errno);
i = 0;
do {
@@
-1478,26
+1484,40
@@
void test31(void)
ASSERTF(rc == 0 && id[i] != 0, "i %d, errno %d, id %d",
i, errno, id[i]);
- rc = llapi_layout_comp_move(layout, LLAPI_LAYOUT_COMP_POS_NEXT);
- ASSERTF(rc >= 0, "i %d, rc %d, errno %d", i, rc, errno);
-
+ rc = llapi_layout_comp_use(layout, LLAPI_LAYOUT_COMP_USE_NEXT);
+ ASSERTF(rc == 0 || i == 1, "i=%d rc=%d errno=%d", i, rc, errno);
i++;
} while (rc == 0);
+ /* Verify reverse iteration gives the same IDs as forward iteration */
+ rc = llapi_layout_comp_use(layout, LLAPI_LAYOUT_COMP_USE_LAST);
+ ASSERTF(rc == 0, "rc %d, errno %d", rc, errno);
+ do {
+ __u32 comp_id;
+
+ --i;
+ rc = llapi_layout_comp_id_get(layout, &comp_id);
+ ASSERTF(rc == 0 && comp_id == id[i],
+ "i %d, errno %d, id[] %u/%u", i, errno, id[i], comp_id);
+
+ rc = llapi_layout_comp_use(layout, LLAPI_LAYOUT_COMP_USE_PREV);
+ ASSERTF(rc == 0 || i == 0, "i=%d rc=%d errno=%d", i, rc, errno);
+ } while (rc == 0);
+
llapi_layout_free(layout);
/* delete non-tail component will fail */
- rc = llapi_layout_file_comp_del(path, id[0]);
+ rc = llapi_layout_file_comp_del(path, id[0]
, 0
);
ASSERTF(rc < 0 && errno == EINVAL, "rc %d, errno %d", rc, errno);
- rc = llapi_layout_file_comp_del(path, id[1]);
+ rc = llapi_layout_file_comp_del(path, id[1]
, 0
);
ASSERTF(rc == 0, "rc %d, errno %d", rc, errno);
/* verify the composite layout after deleting */
layout = llapi_layout_get_by_path(path, 0);
ASSERTF(layout != NULL, "errno = %d", errno);
- rc = llapi_layout_comp_
move(layout, LLAPI_LAYOUT_COMP_POS
_FIRST);
+ rc = llapi_layout_comp_
use(layout, LLAPI_LAYOUT_COMP_USE
_FIRST);
ASSERTF(rc == 0, "rc %d, errno %d", rc, errno);
rc = llapi_layout_comp_extent_get(layout, &s, &e);