diff options
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 1ace6d11e097..39c1fe178f47 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1567,28 +1567,9 @@ out: | |||
1567 | return em; | 1567 | return em; |
1568 | } | 1568 | } |
1569 | 1569 | ||
1570 | static int btrfs_get_block_bmap(struct inode *inode, sector_t iblock, | 1570 | static sector_t btrfs_bmap(struct address_space *mapping, sector_t iblock) |
1571 | struct buffer_head *result, int create) | ||
1572 | { | 1571 | { |
1573 | struct btrfs_root *root = BTRFS_I(inode)->root; | 1572 | return extent_bmap(mapping, iblock, btrfs_get_extent); |
1574 | u64 start = iblock << inode->i_blkbits; | ||
1575 | u64 end = start + root->blocksize -1; | ||
1576 | struct extent_map *em; | ||
1577 | |||
1578 | em = btrfs_get_extent(inode, NULL, 0, start, end, 0); | ||
1579 | if (em && !IS_ERR(em) && em->block_start != EXTENT_MAP_INLINE && | ||
1580 | em->block_start != 0) { | ||
1581 | u64 offset; | ||
1582 | offset = start - em->start; | ||
1583 | start = (em->block_start + offset) >> inode->i_blkbits; | ||
1584 | btrfs_map_bh_to_logical(root, result, start); | ||
1585 | } | ||
1586 | return 0; | ||
1587 | } | ||
1588 | |||
1589 | static sector_t btrfs_bmap(struct address_space *as, sector_t block) | ||
1590 | { | ||
1591 | return generic_block_bmap(as, block, btrfs_get_block_bmap); | ||
1592 | } | 1573 | } |
1593 | 1574 | ||
1594 | static int btrfs_prepare_write(struct file *file, struct page *page, | 1575 | static int btrfs_prepare_write(struct file *file, struct page *page, |