diff options
author | Chris Mason <chris.mason@fusionio.com> | 2013-02-05 10:04:03 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-02-05 10:04:03 -0500 |
commit | 0e4e02636611dbf89a2f36320a32054f9936d6cb (patch) | |
tree | 18b4ecc6c3812770b29729d7abbdc673ffd73a41 /fs/btrfs/free-space-cache.c | |
parent | 1f0905ec156eec8f12cd593bc564551770319720 (diff) | |
parent | 1eafa6c73791e4f312324ddad9cbcaf6a1b6052b (diff) |
Merge branch 'for-linus' into raid56-experimental
Conflicts:
fs/btrfs/volumes.c
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/free-space-cache.c')
-rw-r--r-- | fs/btrfs/free-space-cache.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 62020b7f7036..e067cae15e3d 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -1885,11 +1885,13 @@ int btrfs_remove_free_space(struct btrfs_block_group_cache *block_group, | |||
1885 | { | 1885 | { |
1886 | struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; | 1886 | struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; |
1887 | struct btrfs_free_space *info; | 1887 | struct btrfs_free_space *info; |
1888 | int ret = 0; | 1888 | int ret; |
1889 | bool re_search = false; | ||
1889 | 1890 | ||
1890 | spin_lock(&ctl->tree_lock); | 1891 | spin_lock(&ctl->tree_lock); |
1891 | 1892 | ||
1892 | again: | 1893 | again: |
1894 | ret = 0; | ||
1893 | if (!bytes) | 1895 | if (!bytes) |
1894 | goto out_lock; | 1896 | goto out_lock; |
1895 | 1897 | ||
@@ -1902,17 +1904,17 @@ again: | |||
1902 | info = tree_search_offset(ctl, offset_to_bitmap(ctl, offset), | 1904 | info = tree_search_offset(ctl, offset_to_bitmap(ctl, offset), |
1903 | 1, 0); | 1905 | 1, 0); |
1904 | if (!info) { | 1906 | if (!info) { |
1905 | /* the tree logging code might be calling us before we | 1907 | /* |
1906 | * have fully loaded the free space rbtree for this | 1908 | * If we found a partial bit of our free space in a |
1907 | * block group. So it is possible the entry won't | 1909 | * bitmap but then couldn't find the other part this may |
1908 | * be in the rbtree yet at all. The caching code | 1910 | * be a problem, so WARN about it. |
1909 | * will make sure not to put it in the rbtree if | ||
1910 | * the logging code has pinned it. | ||
1911 | */ | 1911 | */ |
1912 | WARN_ON(re_search); | ||
1912 | goto out_lock; | 1913 | goto out_lock; |
1913 | } | 1914 | } |
1914 | } | 1915 | } |
1915 | 1916 | ||
1917 | re_search = false; | ||
1916 | if (!info->bitmap) { | 1918 | if (!info->bitmap) { |
1917 | unlink_free_space(ctl, info); | 1919 | unlink_free_space(ctl, info); |
1918 | if (offset == info->offset) { | 1920 | if (offset == info->offset) { |
@@ -1958,8 +1960,10 @@ again: | |||
1958 | } | 1960 | } |
1959 | 1961 | ||
1960 | ret = remove_from_bitmap(ctl, info, &offset, &bytes); | 1962 | ret = remove_from_bitmap(ctl, info, &offset, &bytes); |
1961 | if (ret == -EAGAIN) | 1963 | if (ret == -EAGAIN) { |
1964 | re_search = true; | ||
1962 | goto again; | 1965 | goto again; |
1966 | } | ||
1963 | BUG_ON(ret); /* logic error */ | 1967 | BUG_ON(ret); /* logic error */ |
1964 | out_lock: | 1968 | out_lock: |
1965 | spin_unlock(&ctl->tree_lock); | 1969 | spin_unlock(&ctl->tree_lock); |