Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 128313
b: refs/heads/master
c: 9773a78
h: refs/heads/master
i:
  128311: 6b691a4
v: v3
  • Loading branch information
Chris Mason authored and David Woodhouse committed Mar 27, 2007
1 parent bbe6d0f commit a62ad0c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f4b9aa8d3b877d0a6044a6d6d9a44b29cab9e265
refs/heads/master: 9773a788681db1f5c2701b7433737fdca61a14ba
2 changes: 1 addition & 1 deletion trunk/fs/btrfs/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -899,5 +899,5 @@ int btrfs_alloc_file_extent(struct btrfs_trans_handle *trans,
int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_path *path, u64 objectid,
u64 blocknr, u64 num_blocks, int mod);
u64 blocknr, int mod);
#endif
5 changes: 3 additions & 2 deletions trunk/fs/btrfs/file-item.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ int btrfs_alloc_file_extent(struct btrfs_trans_handle *trans,

ret = btrfs_insert_empty_item(trans, root, &path, &file_key,
sizeof(*item));
BUG_ON(ret);
item = btrfs_item_ptr(btrfs_buffer_leaf(path.nodes[0]), path.slots[0],
struct btrfs_file_extent_item);
btrfs_set_file_extent_disk_blocknr(item, ins.objectid);
Expand All @@ -42,15 +43,15 @@ int btrfs_alloc_file_extent(struct btrfs_trans_handle *trans,
int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_path *path, u64 objectid,
u64 blocknr, u64 num_blocks, int mod)
u64 offset, int mod)
{
int ret;
struct btrfs_key file_key;
int ins_len = mod < 0 ? -1 : 0;
int cow = mod != 0;

file_key.objectid = objectid;
file_key.offset = blocknr;
file_key.offset = offset;
file_key.flags = 0;
btrfs_set_key_type(&file_key, BTRFS_EXTENT_DATA_KEY);
ret = btrfs_search_slot(trans, root, &file_key, path, ins_len, cow);
Expand Down
7 changes: 5 additions & 2 deletions trunk/fs/btrfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,8 @@ static int btrfs_get_block(struct inode *inode, sector_t iblock,


ret = btrfs_lookup_file_extent(trans, root, &path,
inode->i_ino, iblock, 1, 0);
inode->i_ino,
iblock << inode->i_blkbits, 0);
if (ret < 0) {
btrfs_release_path(root, &path);
err = ret;
Expand Down Expand Up @@ -737,6 +738,7 @@ static int btrfs_get_block(struct inode *inode, sector_t iblock,
}

extent_start = btrfs_disk_key_offset(&leaf->items[path.slots[0]].key);
extent_start = extent_start >> inode->i_blkbits;
extent_start += btrfs_file_extent_offset(item);
extent_end = extent_start + btrfs_file_extent_num_blocks(item);
btrfs_release_path(root, &path);
Expand All @@ -751,7 +753,8 @@ static int btrfs_get_block(struct inode *inode, sector_t iblock,
err = 0;
goto out;
}
ret = btrfs_alloc_file_extent(trans, root, objectid, iblock,
ret = btrfs_alloc_file_extent(trans, root, objectid,
iblock << inode->i_blkbits,
1, extent_end, &blocknr);
if (ret) {
err = ret;
Expand Down

0 comments on commit a62ad0c

Please sign in to comment.