Simplified distributed block storage with strong consistency, like in Ceph
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
1.1 KiB

  1. // Copyright (c) Vitaliy Filippov, 2019+
  2. // License: VNPL-1.0 or GNU GPL-2.0+ (see README.md for details)
  3. #pragma once
  4. // Placement group states
  5. // STARTING -> [acquire lock] -> PEERING -> INCOMPLETE|ACTIVE -> STOPPING -> OFFLINE -> [release lock]
  6. // Exactly one of these:
  7. #define PG_STARTING (1<<0)
  8. #define PG_PEERING (1<<1)
  9. #define PG_INCOMPLETE (1<<2)
  10. #define PG_ACTIVE (1<<3)
  11. #define PG_STOPPING (1<<4)
  12. #define PG_OFFLINE (1<<5)
  13. // Plus any of these:
  14. #define PG_DEGRADED (1<<6)
  15. #define PG_HAS_INCOMPLETE (1<<7)
  16. #define PG_HAS_DEGRADED (1<<8)
  17. #define PG_HAS_MISPLACED (1<<9)
  18. #define PG_HAS_UNCLEAN (1<<10)
  19. #define PG_HAS_INVALID (1<<11)
  20. #define PG_LEFT_ON_DEAD (1<<12)
  21. // Lower bits that represent object role (EC 0/1/2... or always 0 with replication)
  22. // 12 bits is a safe default that doesn't depend on pg_stripe_size or pg_block_size
  23. #define STRIPE_MASK ((uint64_t)4096 - 1)
  24. // OSD object states
  25. #define OBJ_DEGRADED 0x02
  26. #define OBJ_INCOMPLETE 0x04
  27. #define OBJ_MISPLACED 0x08
  28. #define OBJ_NEEDS_STABLE 0x10000
  29. #define OBJ_NEEDS_ROLLBACK 0x20000
  30. extern const int pg_state_bits[];
  31. extern const char *pg_state_names[];
  32. extern const int pg_state_bit_count;