Changeset 150adbd2 in mainline
- Timestamp:
- 2025-06-29T10:08:40Z (7 months ago)
- Children:
- 40ab4901
- Parents:
- 93ea452
- Location:
- uspace
- Files:
-
- 1 added
- 6 edited
-
app/hrctl/hrctl.c (modified) (9 diffs)
-
lib/device/include/hr.h (modified) (2 diffs)
-
lib/device/src/hr.c (modified) (1 diff)
-
srv/bd/hr/hr.c (modified) (1 diff)
-
srv/bd/hr/meson.build (modified) (1 diff)
-
srv/bd/hr/metadata/noop.c (added)
-
srv/bd/hr/superblock.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/hrctl/hrctl.c
r93ea452 r150adbd2 52 52 static errno_t fill_config_devs(int, char **, hr_config_t *); 53 53 static errno_t get_vol_configs_from_sif(const char *, hr_config_t **, size_t *); 54 static int create_from_config(hr_t *, const char * );55 static int create_from_argv(hr_t *, int, char ** );54 static int create_from_config(hr_t *, const char *, uint8_t); 55 static int create_from_argv(hr_t *, int, char **, uint8_t); 56 56 static int handle_create(hr_t *, int, char **); 57 57 static int assemble_from_config(hr_t *, const char *); … … 70 70 " -h, --help Display this message and exit.\n" 71 71 "\n" 72 " -c, --create Create a volume, options:\n"72 " -c, --create [--no_meta] Create a volume, options:\n" 73 73 " name {-l , --level level} device... manual device specification, or\n" 74 74 " -f configuration.sif create from configuration file.\n" … … 108 108 "\n" 109 109 "Notes:\n" 110 " Add --no_meta after --create to disable storing on-disk metadata.\n" 110 111 " Simulating an extent failure with -m volume -f index is dangerous. It marks\n" 111 112 " metadata as dirty in other healthy extents, and zeroes out the superblock\n" … … 341 342 } 342 343 343 static int create_from_config(hr_t *hr, const char *config_path) 344 static int create_from_config(hr_t *hr, const char *config_path, 345 uint8_t vol_flags) 344 346 { 345 347 hr_config_t *vol_configs = NULL; … … 351 353 return EXIT_FAILURE; 352 354 } 355 356 for (size_t i = 0; i < vol_count; i++) 357 vol_configs[i].vol_flags |= vol_flags; 353 358 354 359 for (size_t i = 0; i < vol_count; i++) { … … 368 373 } 369 374 370 static int create_from_argv(hr_t *hr, int argc, char **argv )375 static int create_from_argv(hr_t *hr, int argc, char **argv, uint8_t vol_flags) 371 376 { 372 377 /* we need name + --level + arg + at least one extent */ … … 381 386 return EXIT_FAILURE; 382 387 } 388 389 vol_config->vol_flags |= vol_flags; 383 390 384 391 const char *name = argv[optind++]; … … 441 448 { 442 449 int rc; 450 uint8_t vol_flags = 0; 443 451 444 452 if (optind >= argc) { 445 453 printf(NAME ": no arguments to --create\n"); 446 454 return EXIT_FAILURE; 455 } 456 457 if (str_cmp(argv[optind], "--no_meta") == 0) { 458 vol_flags |= HR_VOL_FLAG_NOOP_META; 459 optind++; 447 460 } 448 461 … … 461 474 } 462 475 463 rc = create_from_config(hr, config_path );476 rc = create_from_config(hr, config_path, vol_flags); 464 477 } else { 465 rc = create_from_argv(hr, argc, argv );478 rc = create_from_argv(hr, argc, argv, vol_flags); 466 479 } 467 480 -
uspace/lib/device/include/hr.h
r93ea452 r150adbd2 88 88 HR_METADATA_SOFTRAID, 89 89 HR_METADATA_MD, 90 HR_METADATA_LAST_DUMMY 90 HR_METADATA_NOOP, 91 HR_METADATA_LAST_PLACEHOLDER 91 92 } hr_metadata_type_t; 93 94 typedef enum hr_vol_flag { 95 HR_VOL_FLAG_NOOP_META = 0x01 96 } hr_vol_flag_t; 92 97 93 98 typedef struct hr { … … 100 105 size_t dev_no; 101 106 hr_level_t level; 107 uint8_t vol_flags; 102 108 } hr_config_t; 103 109 -
uspace/lib/device/src/hr.c
r93ea452 r150adbd2 554 554 case HR_METADATA_MD: 555 555 return "Linux Multiple Device"; 556 case HR_METADATA_NOOP: 557 return "NOOP Metadata"; 556 558 default: 557 559 return "Invalid metadata type value"; -
uspace/srv/bd/hr/hr.c
r93ea452 r150adbd2 131 131 } 132 132 133 rc = hr_create_vol_struct(&vol, cfg->level, cfg->devname, 134 HR_METADATA_NATIVE); 133 hr_metadata_type_t meta_type; 134 if (cfg->vol_flags & HR_VOL_FLAG_NOOP_META) 135 meta_type = HR_METADATA_NOOP; 136 else 137 meta_type = HR_METADATA_NATIVE; 138 139 printf("creating with type %d\n", meta_type); 140 rc = hr_create_vol_struct(&vol, cfg->level, cfg->devname, meta_type); 135 141 if (rc != EOK) { 136 142 free(cfg); -
uspace/srv/bd/hr/meson.build
r93ea452 r150adbd2 38 38 'metadata/foreign/softraid/softraid.c', 39 39 'metadata/native.c', 40 'metadata/noop.c', 40 41 'parity_stripe.c', 41 42 'raid0.c', -
uspace/srv/bd/hr/superblock.c
r93ea452 r150adbd2 61 61 extern hr_superblock_ops_t metadata_softraid_ops; 62 62 extern hr_superblock_ops_t metadata_md_ops; 63 extern hr_superblock_ops_t noop_ops; 63 64 64 65 static hr_superblock_ops_t *hr_superblock_ops_all[] = { … … 67 68 [HR_METADATA_GEOM_STRIPE] = &metadata_gstripe_ops, 68 69 [HR_METADATA_SOFTRAID] = &metadata_softraid_ops, 69 [HR_METADATA_MD] = &metadata_md_ops 70 [HR_METADATA_MD] = &metadata_md_ops, 71 [HR_METADATA_NOOP] = &noop_ops 70 72 }; 71 73 72 74 hr_superblock_ops_t *hr_get_meta_type_ops(hr_metadata_type_t type) 73 75 { 74 assert(type >= HR_METADATA_NATIVE && type < HR_METADATA_LAST_DUMMY); 76 assert(type >= HR_METADATA_NATIVE && 77 type < HR_METADATA_LAST_PLACEHOLDER); 75 78 76 79 return hr_superblock_ops_all[type]; … … 92 95 93 96 volatile hr_metadata_type_t type = HR_METADATA_NATIVE; 94 for (; type < HR_METADATA_LAST_ DUMMY; type++) {97 for (; type < HR_METADATA_LAST_PLACEHOLDER; type++) { 95 98 meta_ops = hr_superblock_ops_all[type]; 96 99
Note:
See TracChangeset
for help on using the changeset viewer.
