Btrfs: Off by one fixes for extent-tree.c
authorYan <yanzheng@21cn.com>
Fri, 16 Nov 2007 19:57:09 +0000 (14:57 -0500)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:03:57 +0000 (11:03 -0400)
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/extent-tree.c

index e5340677d6c43fdb882a8a66b068e92ea32b60d7..6a7a9ba75fd9a95ff46dbb988f30d305e227ba21 100644 (file)
@@ -150,12 +150,9 @@ struct btrfs_block_group_cache *btrfs_lookup_block_group(struct
                return NULL;
 
        block_group = (struct btrfs_block_group_cache *)(unsigned long)ptr;
-
-
-       if (block_group->key.objectid <= bytenr && bytenr <=
+       if (block_group->key.objectid <= bytenr && bytenr <
            block_group->key.objectid + block_group->key.offset)
                return block_group;
-
        return NULL;
 }
 static u64 find_search_start(struct btrfs_root *root,
@@ -195,7 +192,7 @@ again:
                        continue;
                }
                if (data != BTRFS_BLOCK_GROUP_MIXED &&
-                   start + num >= cache->key.objectid + cache->key.offset)
+                   start + num > cache->key.objectid + cache->key.offset)
                        goto new_group;
                return start;
        }
@@ -1088,9 +1085,8 @@ check_pending:
 
        if (ins->objectid + num_bytes >= search_end)
                goto enospc;
-
        if (!full_scan && data != BTRFS_BLOCK_GROUP_MIXED &&
-           ins->objectid + num_bytes >= block_group->
+           ins->objectid + num_bytes > block_group->
            key.objectid + block_group->key.offset) {
                search_start = block_group->key.objectid +
                        block_group->key.offset;