Btrfs: introduce masks for chunk type and profile
Chunk's type and profile are encoded in u64 flags field. Introduce masks to easily access them. Also fix the type of BTRFS_BLOCK_GROUP_* constants, it should be ULL. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
@ -2949,12 +2949,8 @@ again:
|
||||
}
|
||||
}
|
||||
if (rw & REQ_DISCARD) {
|
||||
if (map->type & (BTRFS_BLOCK_GROUP_RAID0 |
|
||||
BTRFS_BLOCK_GROUP_RAID1 |
|
||||
BTRFS_BLOCK_GROUP_DUP |
|
||||
BTRFS_BLOCK_GROUP_RAID10)) {
|
||||
if (map->type & BTRFS_BLOCK_GROUP_PROFILE_MASK)
|
||||
stripes_required = map->num_stripes;
|
||||
}
|
||||
}
|
||||
if (bbio_ret && (rw & (REQ_WRITE | REQ_DISCARD)) &&
|
||||
stripes_allocated < stripes_required) {
|
||||
@ -2978,10 +2974,7 @@ again:
|
||||
|
||||
if (rw & REQ_DISCARD)
|
||||
*length = min_t(u64, em->len - offset, *length);
|
||||
else if (map->type & (BTRFS_BLOCK_GROUP_RAID0 |
|
||||
BTRFS_BLOCK_GROUP_RAID1 |
|
||||
BTRFS_BLOCK_GROUP_RAID10 |
|
||||
BTRFS_BLOCK_GROUP_DUP)) {
|
||||
else if (map->type & BTRFS_BLOCK_GROUP_PROFILE_MASK) {
|
||||
/* we limit the length of each bio to what fits in a stripe */
|
||||
*length = min_t(u64, em->len - offset,
|
||||
map->stripe_len - stripe_offset);
|
||||
|
Reference in New Issue
Block a user