aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2012-01-16 15:04:48 -0500
committerIlya Dryomov <idryomov@gmail.com>2012-01-16 15:04:48 -0500
commit70922617b0099f420deceb53d5dc7f4fb30d08d0 (patch)
tree6353dff7355863b92b48001e76c3f00bf180916b /fs/btrfs/ctree.h
parentea67176ae8c024f64d85ec33873e5eadf1af7247 (diff)
Btrfs: do not reduce profile in do_chunk_alloc()
Every caller of do_chunk_alloc() feeds it the reduced allocation profile, so stop trying to reduce it one more time. Instead check the validity of the passed profile. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index c4d98c8df5c5..1e7aea60da2b 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2536,6 +2536,24 @@ static inline void free_fs_info(struct btrfs_fs_info *fs_info)
2536 kfree(fs_info->super_for_commit); 2536 kfree(fs_info->super_for_commit);
2537 kfree(fs_info); 2537 kfree(fs_info);
2538} 2538}
2539/**
2540 * profile_is_valid - tests whether a given profile is valid and reduced
2541 * @flags: profile to validate
2542 * @extended: if true @flags is treated as an extended profile
2543 */
2544static inline int profile_is_valid(u64 flags, int extended)
2545{
2546 u64 mask = ~BTRFS_BLOCK_GROUP_PROFILE_MASK;
2547
2548 flags &= ~BTRFS_BLOCK_GROUP_TYPE_MASK;
2549 if (extended)
2550 mask &= ~BTRFS_AVAIL_ALLOC_BIT_SINGLE;
2551
2552 if (flags & mask)
2553 return 0;
2554 /* true if zero or exactly one bit set */
2555 return (flags & (~flags + 1)) == flags;
2556}
2539 2557
2540/* root-item.c */ 2558/* root-item.c */
2541int btrfs_find_root_ref(struct btrfs_root *tree_root, 2559int btrfs_find_root_ref(struct btrfs_root *tree_root,