diff options
author | Chris Mason <chris.mason@oracle.com> | 2011-05-21 09:27:38 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-05-21 09:27:38 -0400 |
commit | 0965537308ac3b267ea16e731bd73870a51c53b8 (patch) | |
tree | 7b52288b7272b2391f736dd82a313cbbaad68570 /fs/btrfs/relocation.c | |
parent | 61c4f2c81c61f73549928dfd9f3e8f26aa36a8cf (diff) | |
parent | 82d5902d9c681be37ffa9d70482907f9f0b7ec1f (diff) |
Merge branch 'ino-alloc' of git://repo.or.cz/linux-btrfs-devel into inode_numbers
Conflicts:
fs/btrfs/free-space-cache.c
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r-- | fs/btrfs/relocation.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 199a80134312..4b5b91cf48e2 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include "btrfs_inode.h" | 30 | #include "btrfs_inode.h" |
31 | #include "async-thread.h" | 31 | #include "async-thread.h" |
32 | #include "free-space-cache.h" | 32 | #include "free-space-cache.h" |
33 | #include "inode-map.h" | ||
33 | 34 | ||
34 | /* | 35 | /* |
35 | * backref_node, mapping_node and tree_block start with this | 36 | * backref_node, mapping_node and tree_block start with this |
@@ -1409,9 +1410,9 @@ again: | |||
1409 | prev = node; | 1410 | prev = node; |
1410 | entry = rb_entry(node, struct btrfs_inode, rb_node); | 1411 | entry = rb_entry(node, struct btrfs_inode, rb_node); |
1411 | 1412 | ||
1412 | if (objectid < entry->vfs_inode.i_ino) | 1413 | if (objectid < btrfs_ino(&entry->vfs_inode)) |
1413 | node = node->rb_left; | 1414 | node = node->rb_left; |
1414 | else if (objectid > entry->vfs_inode.i_ino) | 1415 | else if (objectid > btrfs_ino(&entry->vfs_inode)) |
1415 | node = node->rb_right; | 1416 | node = node->rb_right; |
1416 | else | 1417 | else |
1417 | break; | 1418 | break; |
@@ -1419,7 +1420,7 @@ again: | |||
1419 | if (!node) { | 1420 | if (!node) { |
1420 | while (prev) { | 1421 | while (prev) { |
1421 | entry = rb_entry(prev, struct btrfs_inode, rb_node); | 1422 | entry = rb_entry(prev, struct btrfs_inode, rb_node); |
1422 | if (objectid <= entry->vfs_inode.i_ino) { | 1423 | if (objectid <= btrfs_ino(&entry->vfs_inode)) { |
1423 | node = prev; | 1424 | node = prev; |
1424 | break; | 1425 | break; |
1425 | } | 1426 | } |
@@ -1434,7 +1435,7 @@ again: | |||
1434 | return inode; | 1435 | return inode; |
1435 | } | 1436 | } |
1436 | 1437 | ||
1437 | objectid = entry->vfs_inode.i_ino + 1; | 1438 | objectid = btrfs_ino(&entry->vfs_inode) + 1; |
1438 | if (cond_resched_lock(&root->inode_lock)) | 1439 | if (cond_resched_lock(&root->inode_lock)) |
1439 | goto again; | 1440 | goto again; |
1440 | 1441 | ||
@@ -1470,7 +1471,7 @@ static int get_new_location(struct inode *reloc_inode, u64 *new_bytenr, | |||
1470 | return -ENOMEM; | 1471 | return -ENOMEM; |
1471 | 1472 | ||
1472 | bytenr -= BTRFS_I(reloc_inode)->index_cnt; | 1473 | bytenr -= BTRFS_I(reloc_inode)->index_cnt; |
1473 | ret = btrfs_lookup_file_extent(NULL, root, path, reloc_inode->i_ino, | 1474 | ret = btrfs_lookup_file_extent(NULL, root, path, btrfs_ino(reloc_inode), |
1474 | bytenr, 0); | 1475 | bytenr, 0); |
1475 | if (ret < 0) | 1476 | if (ret < 0) |
1476 | goto out; | 1477 | goto out; |
@@ -1558,11 +1559,11 @@ int replace_file_extents(struct btrfs_trans_handle *trans, | |||
1558 | if (first) { | 1559 | if (first) { |
1559 | inode = find_next_inode(root, key.objectid); | 1560 | inode = find_next_inode(root, key.objectid); |
1560 | first = 0; | 1561 | first = 0; |
1561 | } else if (inode && inode->i_ino < key.objectid) { | 1562 | } else if (inode && btrfs_ino(inode) < key.objectid) { |
1562 | btrfs_add_delayed_iput(inode); | 1563 | btrfs_add_delayed_iput(inode); |
1563 | inode = find_next_inode(root, key.objectid); | 1564 | inode = find_next_inode(root, key.objectid); |
1564 | } | 1565 | } |
1565 | if (inode && inode->i_ino == key.objectid) { | 1566 | if (inode && btrfs_ino(inode) == key.objectid) { |
1566 | end = key.offset + | 1567 | end = key.offset + |
1567 | btrfs_file_extent_num_bytes(leaf, fi); | 1568 | btrfs_file_extent_num_bytes(leaf, fi); |
1568 | WARN_ON(!IS_ALIGNED(key.offset, | 1569 | WARN_ON(!IS_ALIGNED(key.offset, |
@@ -1893,6 +1894,7 @@ static int invalidate_extent_cache(struct btrfs_root *root, | |||
1893 | struct inode *inode = NULL; | 1894 | struct inode *inode = NULL; |
1894 | u64 objectid; | 1895 | u64 objectid; |
1895 | u64 start, end; | 1896 | u64 start, end; |
1897 | u64 ino; | ||
1896 | 1898 | ||
1897 | objectid = min_key->objectid; | 1899 | objectid = min_key->objectid; |
1898 | while (1) { | 1900 | while (1) { |
@@ -1905,17 +1907,18 @@ static int invalidate_extent_cache(struct btrfs_root *root, | |||
1905 | inode = find_next_inode(root, objectid); | 1907 | inode = find_next_inode(root, objectid); |
1906 | if (!inode) | 1908 | if (!inode) |
1907 | break; | 1909 | break; |
1910 | ino = btrfs_ino(inode); | ||
1908 | 1911 | ||
1909 | if (inode->i_ino > max_key->objectid) { | 1912 | if (ino > max_key->objectid) { |
1910 | iput(inode); | 1913 | iput(inode); |
1911 | break; | 1914 | break; |
1912 | } | 1915 | } |
1913 | 1916 | ||
1914 | objectid = inode->i_ino + 1; | 1917 | objectid = ino + 1; |
1915 | if (!S_ISREG(inode->i_mode)) | 1918 | if (!S_ISREG(inode->i_mode)) |
1916 | continue; | 1919 | continue; |
1917 | 1920 | ||
1918 | if (unlikely(min_key->objectid == inode->i_ino)) { | 1921 | if (unlikely(min_key->objectid == ino)) { |
1919 | if (min_key->type > BTRFS_EXTENT_DATA_KEY) | 1922 | if (min_key->type > BTRFS_EXTENT_DATA_KEY) |
1920 | continue; | 1923 | continue; |
1921 | if (min_key->type < BTRFS_EXTENT_DATA_KEY) | 1924 | if (min_key->type < BTRFS_EXTENT_DATA_KEY) |
@@ -1928,7 +1931,7 @@ static int invalidate_extent_cache(struct btrfs_root *root, | |||
1928 | start = 0; | 1931 | start = 0; |
1929 | } | 1932 | } |
1930 | 1933 | ||
1931 | if (unlikely(max_key->objectid == inode->i_ino)) { | 1934 | if (unlikely(max_key->objectid == ino)) { |
1932 | if (max_key->type < BTRFS_EXTENT_DATA_KEY) | 1935 | if (max_key->type < BTRFS_EXTENT_DATA_KEY) |
1933 | continue; | 1936 | continue; |
1934 | if (max_key->type > BTRFS_EXTENT_DATA_KEY) { | 1937 | if (max_key->type > BTRFS_EXTENT_DATA_KEY) { |
@@ -3897,7 +3900,7 @@ struct inode *create_reloc_inode(struct btrfs_fs_info *fs_info, | |||
3897 | if (IS_ERR(trans)) | 3900 | if (IS_ERR(trans)) |
3898 | return ERR_CAST(trans); | 3901 | return ERR_CAST(trans); |
3899 | 3902 | ||
3900 | err = btrfs_find_free_objectid(trans, root, objectid, &objectid); | 3903 | err = btrfs_find_free_objectid(root, &objectid); |
3901 | if (err) | 3904 | if (err) |
3902 | goto out; | 3905 | goto out; |
3903 | 3906 | ||