aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-01-03 09:08:27 -0500
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:58 -0400
commit56b453c92fdf51fd3283a2dc2dfbedf36f516031 (patch)
tree273b7fa9f03f61f6241f722ffa6ff5a3eb64736d /fs/btrfs/inode.c
parent8f662a76c6af8eb367fa519e9bb9766040d9cea8 (diff)
Btrfs: Explicitly send a root objectid to count_snapshots_in_path
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c39
1 files changed, 5 insertions, 34 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index d6de46961887..5003a86510a1 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1770,6 +1770,11 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page,
1770again: 1770again:
1771 em = lookup_extent_mapping(em_tree, start, end); 1771 em = lookup_extent_mapping(em_tree, start, end);
1772 if (em) { 1772 if (em) {
1773 if (em->start > start) {
1774 printk("get_extent start %Lu em start %Lu\n",
1775 start, em->start);
1776 WARN_ON(1);
1777 }
1773 goto out; 1778 goto out;
1774 } 1779 }
1775 if (!em) { 1780 if (!em) {
@@ -1952,23 +1957,6 @@ static sector_t btrfs_bmap(struct address_space *mapping, sector_t iblock)
1952 return extent_bmap(mapping, iblock, btrfs_get_extent); 1957 return extent_bmap(mapping, iblock, btrfs_get_extent);
1953} 1958}
1954 1959
1955static int btrfs_prepare_write(struct file *file, struct page *page,
1956 unsigned from, unsigned to)
1957{
1958 struct btrfs_root *root = BTRFS_I(page->mapping->host)->root;
1959 int err;
1960
1961 mutex_lock(&root->fs_info->fs_mutex);
1962 err = btrfs_check_free_space(root, PAGE_CACHE_SIZE, 0);
1963 mutex_unlock(&root->fs_info->fs_mutex);
1964 if (err)
1965 return -ENOSPC;
1966
1967 return extent_prepare_write(&BTRFS_I(page->mapping->host)->extent_tree,
1968 page->mapping->host, page, from, to,
1969 btrfs_get_extent);
1970}
1971
1972int btrfs_readpage(struct file *file, struct page *page) 1960int btrfs_readpage(struct file *file, struct page *page)
1973{ 1961{
1974 struct extent_map_tree *tree; 1962 struct extent_map_tree *tree;
@@ -2120,21 +2108,6 @@ static void btrfs_truncate(struct inode *inode)
2120 btrfs_btree_balance_dirty(root, nr); 2108 btrfs_btree_balance_dirty(root, nr);
2121} 2109}
2122 2110
2123int btrfs_commit_write(struct file *file, struct page *page,
2124 unsigned from, unsigned to)
2125{
2126 loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
2127 struct inode *inode = page->mapping->host;
2128
2129 btrfs_cow_one_page(inode, page, PAGE_CACHE_SIZE);
2130
2131 if (pos > inode->i_size) {
2132 i_size_write(inode, pos);
2133 mark_inode_dirty(inode);
2134 }
2135 return 0;
2136}
2137
2138static int create_subvol(struct btrfs_root *root, char *name, int namelen) 2111static int create_subvol(struct btrfs_root *root, char *name, int namelen)
2139{ 2112{
2140 struct btrfs_trans_handle *trans; 2113 struct btrfs_trans_handle *trans;
@@ -2930,8 +2903,6 @@ static struct address_space_operations btrfs_aops = {
2930 .writepages = btrfs_writepages, 2903 .writepages = btrfs_writepages,
2931 .readpages = btrfs_readpages, 2904 .readpages = btrfs_readpages,
2932 .sync_page = block_sync_page, 2905 .sync_page = block_sync_page,
2933 .prepare_write = btrfs_prepare_write,
2934 .commit_write = btrfs_commit_write,
2935 .bmap = btrfs_bmap, 2906 .bmap = btrfs_bmap,
2936 .invalidatepage = btrfs_invalidatepage, 2907 .invalidatepage = btrfs_invalidatepage,
2937 .releasepage = btrfs_releasepage, 2908 .releasepage = btrfs_releasepage,