From 6cef01e8db303656b55f39068b917616b89bfb52 Mon Sep 17 00:00:00 2001 From: WuBo Date: Tue, 26 Jul 2011 03:30:11 +0000 Subject: [PATCH] --- yaml --- r: 262235 b: refs/heads/master c: 61cfea9bb84d41b09e59822c33b3eb27acc48358 h: refs/heads/master i: 262233: 50e4d6b7a001e31f6c696cb56b45a025e9e4c2d2 262231: ba84089fdc7fe6b4fef37aa8fcd8e8e038a21c80 v: v3 --- [refs] | 2 +- trunk/fs/btrfs/extent-tree.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 71d355440ccb..4ce81f4dafd6 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 1bf85046e493c88be1c1bad9084428373089f618 +refs/heads/master: 61cfea9bb84d41b09e59822c33b3eb27acc48358 diff --git a/trunk/fs/btrfs/extent-tree.c b/trunk/fs/btrfs/extent-tree.c index db2057f262ad..a4db88da125e 100644 --- a/trunk/fs/btrfs/extent-tree.c +++ b/trunk/fs/btrfs/extent-tree.c @@ -6549,8 +6549,6 @@ static int set_block_group_ro(struct btrfs_block_group_cache *cache, int force) u64 min_allocable_bytes; int ret = -ENOSPC; - if (cache->ro) - return 0; /* * We need some metadata space and system metadata space for @@ -6566,6 +6564,12 @@ static int set_block_group_ro(struct btrfs_block_group_cache *cache, int force) spin_lock(&sinfo->lock); spin_lock(&cache->lock); + + if (cache->ro) { + ret = 0; + goto out; + } + num_bytes = cache->key.offset - cache->reserved - cache->pinned - cache->bytes_super - btrfs_block_group_used(&cache->item); @@ -6579,7 +6583,7 @@ static int set_block_group_ro(struct btrfs_block_group_cache *cache, int force) cache->ro = 1; ret = 0; } - +out: spin_unlock(&cache->lock); spin_unlock(&sinfo->lock); return ret;