diff options
author | Chris Mason <chris.mason@oracle.com> | 2010-12-24 06:41:52 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-01-04 16:41:39 -0500 |
commit | 65e5341b9a0c39767ae1fecc727d70eda0dd6d83 (patch) | |
tree | 09f54177bfb8c93b2320d84317705bec6dcc42a6 /fs | |
parent | 83a50de97fe96aca82389e061862ed760ece2283 (diff) |
Btrfs: fix off by one while setting block groups readonly
When we read in block groups, we'll set non-redundant groups
readonly if we find a raid1, DUP or raid10 group. But the
ro code has an off by one bug in the math around testing to
make sure out accounting doesn't go wrong.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/extent-tree.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 7e5162e5c411..b180efdc8b68 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -7971,13 +7971,14 @@ static int set_block_group_ro(struct btrfs_block_group_cache *cache) | |||
7971 | 7971 | ||
7972 | if (sinfo->bytes_used + sinfo->bytes_reserved + sinfo->bytes_pinned + | 7972 | if (sinfo->bytes_used + sinfo->bytes_reserved + sinfo->bytes_pinned + |
7973 | sinfo->bytes_may_use + sinfo->bytes_readonly + | 7973 | sinfo->bytes_may_use + sinfo->bytes_readonly + |
7974 | cache->reserved_pinned + num_bytes < sinfo->total_bytes) { | 7974 | cache->reserved_pinned + num_bytes <= sinfo->total_bytes) { |
7975 | sinfo->bytes_readonly += num_bytes; | 7975 | sinfo->bytes_readonly += num_bytes; |
7976 | sinfo->bytes_reserved += cache->reserved_pinned; | 7976 | sinfo->bytes_reserved += cache->reserved_pinned; |
7977 | cache->reserved_pinned = 0; | 7977 | cache->reserved_pinned = 0; |
7978 | cache->ro = 1; | 7978 | cache->ro = 1; |
7979 | ret = 0; | 7979 | ret = 0; |
7980 | } | 7980 | } |
7981 | |||
7981 | spin_unlock(&cache->lock); | 7982 | spin_unlock(&cache->lock); |
7982 | spin_unlock(&sinfo->lock); | 7983 | spin_unlock(&sinfo->lock); |
7983 | return ret; | 7984 | return ret; |