|
1 | 1 | /** |
2 | 2 | * (C) Copyright 2019-2024 Intel Corporation. |
3 | | - * (C) Copyright 2025 Hewlett Packard Enterprise Development LP |
| 3 | + * (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP |
4 | 4 | * |
5 | 5 | * SPDX-License-Identifier: BSD-2-Clause-Patent |
6 | 6 | */ |
@@ -2256,11 +2256,12 @@ dfs_test_oclass_hints(void **state) |
2256 | 2256 | daos_oclass_id_t cid; |
2257 | 2257 | daos_handle_t coh; |
2258 | 2258 | dfs_t *dfs_l; |
2259 | | - dfs_obj_t *obj; |
| 2259 | + dfs_obj_t *obj, *dir; |
2260 | 2260 | daos_obj_id_t oid; |
2261 | 2261 | daos_oclass_id_t ecidx; |
2262 | 2262 | daos_prop_t *prop = NULL; |
2263 | 2263 | dfs_attr_t dattr = {0}; |
| 2264 | + dfs_obj_info_t oinfo = {0}; |
2264 | 2265 | struct pl_map_attr attr = {0}; |
2265 | 2266 | int rc; |
2266 | 2267 |
|
@@ -2416,6 +2417,21 @@ dfs_test_oclass_hints(void **state) |
2416 | 2417 | rc = compare_oclass(coh, cid, OC_RP_2GX); |
2417 | 2418 | assert_rc_equal(rc, 0); |
2418 | 2419 |
|
| 2420 | + /** create a directory and set EC to be used on the directory */ |
| 2421 | + rc = dfs_open(dfs_l, NULL, "d1", S_IFDIR | S_IWUSR | S_IRUSR, O_RDWR | O_CREAT, 0, 0, NULL, |
| 2422 | + &dir); |
| 2423 | + assert_int_equal(rc, 0); |
| 2424 | + rc = dfs_obj_set_oclass(dfs_l, dir, 0, ecidx); |
| 2425 | + assert_int_equal(rc, 0); |
| 2426 | + /** get the dir info to query what oclass will be used */ |
| 2427 | + rc = dfs_obj_get_info(dfs_l, dir, &oinfo); |
| 2428 | + assert_int_equal(rc, 0); |
| 2429 | + rc = compare_oclass(coh, oinfo.doi_dir_oclass_id, OC_RP_2G1); |
| 2430 | + assert_int_equal(rc, 0); |
| 2431 | + rc = compare_oclass(coh, oinfo.doi_file_oclass_id, ecidx); |
| 2432 | + assert_int_equal(rc, 0); |
| 2433 | + dfs_release(dir); |
| 2434 | + |
2419 | 2435 | rc = dfs_umount(dfs_l); |
2420 | 2436 | assert_int_equal(rc, 0); |
2421 | 2437 | rc = daos_cont_close(coh, NULL); |
@@ -2468,6 +2484,21 @@ dfs_test_oclass_hints(void **state) |
2468 | 2484 | rc = compare_oclass(coh, cid, OC_RP_3GX); |
2469 | 2485 | assert_rc_equal(rc, 0); |
2470 | 2486 |
|
| 2487 | + /** create a directory and set EC to be used on the directory */ |
| 2488 | + rc = dfs_open(dfs_l, NULL, "d1", S_IFDIR | S_IWUSR | S_IRUSR, O_RDWR | O_CREAT, 0, 0, NULL, |
| 2489 | + &dir); |
| 2490 | + assert_int_equal(rc, 0); |
| 2491 | + rc = dfs_obj_set_oclass(dfs_l, dir, 0, ecidx); |
| 2492 | + assert_int_equal(rc, 0); |
| 2493 | + /** get the dir info to query what oclass will be used */ |
| 2494 | + rc = dfs_obj_get_info(dfs_l, dir, &oinfo); |
| 2495 | + assert_int_equal(rc, 0); |
| 2496 | + rc = compare_oclass(coh, oinfo.doi_dir_oclass_id, OC_RP_3G1); |
| 2497 | + assert_int_equal(rc, 0); |
| 2498 | + rc = compare_oclass(coh, oinfo.doi_file_oclass_id, ecidx); |
| 2499 | + assert_int_equal(rc, 0); |
| 2500 | + dfs_release(dir); |
| 2501 | + |
2471 | 2502 | rc = dfs_umount(dfs_l); |
2472 | 2503 | assert_int_equal(rc, 0); |
2473 | 2504 | rc = daos_cont_close(coh, NULL); |
@@ -2520,6 +2551,22 @@ dfs_test_oclass_hints(void **state) |
2520 | 2551 | rc = compare_oclass(coh, cid, OC_RP_4GX); |
2521 | 2552 | assert_rc_equal(rc, 0); |
2522 | 2553 |
|
| 2554 | + /** create a directory and set EC to be used on the directory */ |
| 2555 | + rc = dfs_open(dfs_l, NULL, "d1", S_IFDIR | S_IWUSR | S_IRUSR, O_RDWR | O_CREAT, 0, 0, NULL, |
| 2556 | + &dir); |
| 2557 | + assert_int_equal(rc, 0); |
| 2558 | + rc = dfs_obj_set_oclass(dfs_l, dir, 0, ecidx); |
| 2559 | + assert_int_equal(rc, 0); |
| 2560 | + /** get the dir info to query what oclass will be used */ |
| 2561 | + rc = dfs_obj_get_info(dfs_l, dir, &oinfo); |
| 2562 | + assert_int_equal(rc, 0); |
| 2563 | + rc = compare_oclass(coh, oinfo.doi_dir_oclass_id, OC_RP_4G1); |
| 2564 | + assert_int_equal(rc, 0); |
| 2565 | + rc = compare_oclass(coh, oinfo.doi_file_oclass_id, ecidx); |
| 2566 | + assert_int_equal(rc, 0); |
| 2567 | + dfs_release(dir); |
| 2568 | + |
| 2569 | + assert_int_equal(rc, 0); |
2523 | 2570 | rc = dfs_umount(dfs_l); |
2524 | 2571 | assert_int_equal(rc, 0); |
2525 | 2572 | rc = daos_cont_close(coh, NULL); |
|
0 commit comments