Skip to content

Commit

Permalink
improve flexibility re hard-wired chunk/stripe setting rockstor#2525
Browse files Browse the repository at this point in the history
Here we sacrifice some speed for flexibility.
  • Loading branch information
phillxnet committed Apr 17, 2023
1 parent 5149d47 commit 5c474d1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/rockstor/fs/btrfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1821,13 +1821,15 @@ def usage_bound(disk_sizes, num_devices, raid_level):
# number of stripes
chunks = num_devices

if raid_level in ["unknown", "single", "single-dup"]:
if raid_level.startwith(("unknown", "single")):
chunks = 1
elif raid_level == "raid0":
# We have no mixed raid levels with raid0, but in case we encounter them:
elif raid_level.startwith("raid0"):
stripes = 2
elif raid_level in ["raid1", "raid1-1c3", "raid1-1c4"]:
# Take care not to match raid10 before its time:
elif raid_level == "raid1" or raid_level.startwith("raid1-"):
chunks = 2
elif raid_level in ["raid10", "raid10-1c3", "raid10-1c4"]:
elif raid_level.startwith("raid10"):
stripes = max(2, int(num_devices / 2))

# Round down so that we have an exact number of duplicate copies
Expand Down

0 comments on commit 5c474d1

Please sign in to comment.