summaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorZhao Lei <zhaolei@cn.fujitsu.com>2010-03-25 13:32:59 +0100
committerChris Mason <chris.mason@oracle.com>2010-03-31 03:19:09 +0200
commitf3eae7e8a5ed124bbc781e18ea10c21856017322 (patch)
tree5e275277720e220ac3c9c2e3dcc404c39a76bbe8 /fs/btrfs
parentBtrfs: Add error handle for btrfs_search_slot() in btrfs_read_chunk_tree() (diff)
downloadlinux-f3eae7e8a5ed124bbc781e18ea10c21856017322.tar.xz
linux-f3eae7e8a5ed124bbc781e18ea10c21856017322.zip
Btrfs: Simplify num_stripes's calculation logical for __btrfs_alloc_chunk()
We can use this simple method to make source more readable. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/volumes.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index c6c80093eac0..bf3bec3e4130 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2198,9 +2198,9 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
min_stripes = 2;
}
if (type & (BTRFS_BLOCK_GROUP_RAID1)) {
- num_stripes = min_t(u64, 2, fs_devices->rw_devices);
- if (num_stripes < 2)
+ if (fs_devices->rw_devices < 2)
return -ENOSPC;
+ num_stripes = 2;
min_stripes = 2;
}
if (type & (BTRFS_BLOCK_GROUP_RAID10)) {