aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2012-01-16 15:04:47 -0500
committerIlya Dryomov <idryomov@gmail.com>2012-01-16 15:04:47 -0500
commit52ba692972532f8d652080214b6599ece3dd51b9 (patch)
treed4c60bad0a7813d964988c7c40aeceadfb54cc1d /fs/btrfs/volumes.c
parent6fef8df1dcb9b586268caff66df1d71ce8610132 (diff)
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>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 89096f6d6fb4..d5fdee56777f 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2949,12 +2949,8 @@ again:
2949 } 2949 }
2950 } 2950 }
2951 if (rw & REQ_DISCARD) { 2951 if (rw & REQ_DISCARD) {
2952 if (map->type & (BTRFS_BLOCK_GROUP_RAID0 | 2952 if (map->type & BTRFS_BLOCK_GROUP_PROFILE_MASK)
2953 BTRFS_BLOCK_GROUP_RAID1 |
2954 BTRFS_BLOCK_GROUP_DUP |
2955 BTRFS_BLOCK_GROUP_RAID10)) {
2956 stripes_required = map->num_stripes; 2953 stripes_required = map->num_stripes;
2957 }
2958 } 2954 }
2959 if (bbio_ret && (rw & (REQ_WRITE | REQ_DISCARD)) && 2955 if (bbio_ret && (rw & (REQ_WRITE | REQ_DISCARD)) &&
2960 stripes_allocated < stripes_required) { 2956 stripes_allocated < stripes_required) {
@@ -2978,10 +2974,7 @@ again:
2978 2974
2979 if (rw & REQ_DISCARD) 2975 if (rw & REQ_DISCARD)
2980 *length = min_t(u64, em->len - offset, *length); 2976 *length = min_t(u64, em->len - offset, *length);
2981 else if (map->type & (BTRFS_BLOCK_GROUP_RAID0 | 2977 else if (map->type & BTRFS_BLOCK_GROUP_PROFILE_MASK) {
2982 BTRFS_BLOCK_GROUP_RAID1 |
2983 BTRFS_BLOCK_GROUP_RAID10 |
2984 BTRFS_BLOCK_GROUP_DUP)) {
2985 /* we limit the length of each bio to what fits in a stripe */ 2978 /* we limit the length of each bio to what fits in a stripe */
2986 *length = min_t(u64, em->len - offset, 2979 *length = min_t(u64, em->len - offset,
2987 map->stripe_len - stripe_offset); 2980 map->stripe_len - stripe_offset);