On 15.09.23 02:27, Qu Wenruo wrote:
/*
* Records the overall state of the qgroups.
* There's only one instance of this key present,
@@ -719,6 +724,32 @@ struct btrfs_free_space_header {
__le64 num_bitmaps;
} __attribute__ ((__packed__));
+struct btrfs_raid_stride {
+ /* The btrfs device-id this raid extent lives on */
+ __le64 devid;
+ /* The physical location on disk */
+ __le64 physical;
+ /* The length of stride on this disk */
+ __le64 length;
Forgot to mention, for btrfs_stripe_extent structure, its key is
(PHYSICAL, RAID_STRIPE_KEY, LENGTH) right?
So is the length in the btrfs_raid_stride duplicated and we can save 8
bytes?
Nope. The length in the key is the stripe length. The length in the
stride is the stride length.
Here's an example for why this is needed:
wrote 32768/32768 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 131072/131072 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 8192/8192 bytes at offset 65536
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
[snip]
item 0 key (XXXXXX RAID_STRIPE_KEY 32768) itemoff XXXXX itemsize 32
encoding: RAID0
stripe 0 devid 1 physical XXXXXXXXX length 32768
item 1 key (XXXXXX RAID_STRIPE_KEY 131072) itemoff XXXXX
itemsize 80
encoding: RAID0
stripe 0 devid 1 physical XXXXXXXXX length 32768
stripe 1 devid 2 physical XXXXXXXXX length 65536
stripe 2 devid 1 physical XXXXXXXXX length 32768
item 2 key (XXXXXX RAID_STRIPE_KEY 8192) itemoff XXXXX itemsize 32
encoding: RAID0
stripe 0 devid 1 physical XXXXXXXXX length 8192
Without the length in the stride, we don't know when to select the next
stride in item 1 above.