Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 128585
b: refs/heads/master
c: 56b453c
h: refs/heads/master
i:
  128583: 4bc2f29
v: v3
  • Loading branch information
Chris Mason committed Sep 25, 2008
1 parent 39e8244 commit d75e169
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 45 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: 8f662a76c6af8eb367fa519e9bb9766040d9cea8
refs/heads/master: 56b453c92fdf51fd3283a2dc2dfbedf36f516031
16 changes: 6 additions & 10 deletions trunk/fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ u32 btrfs_count_snapshots_in_path(struct btrfs_root *root,
struct btrfs_path *path;
u64 bytenr;
u64 found_objectid;
u64 root_objectid = 0;
u64 root_objectid = root->root_key.objectid;
u32 total_count = 0;
u32 cur_count;
u32 refs;
Expand Down Expand Up @@ -749,15 +749,11 @@ u32 btrfs_count_snapshots_in_path(struct btrfs_root *root,
struct btrfs_extent_ref);
found_objectid = btrfs_ref_root(l, ref_item);

if (found_objectid != root_objectid)
total_count++;

if (total_count > 1)
goto out;

if (root_objectid == 0)
root_objectid = found_objectid;

if (found_objectid != root_objectid) {
total_count = 2;
break;
}
total_count = 1;
path->slots[0]++;
}
if (cur_count == 0) {
Expand Down
39 changes: 5 additions & 34 deletions trunk/fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1770,6 +1770,11 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page,
again:
em = lookup_extent_mapping(em_tree, start, end);
if (em) {
if (em->start > start) {
printk("get_extent start %Lu em start %Lu\n",
start, em->start);
WARN_ON(1);
}
goto out;
}
if (!em) {
Expand Down Expand Up @@ -1952,23 +1957,6 @@ static sector_t btrfs_bmap(struct address_space *mapping, sector_t iblock)
return extent_bmap(mapping, iblock, btrfs_get_extent);
}

static int btrfs_prepare_write(struct file *file, struct page *page,
unsigned from, unsigned to)
{
struct btrfs_root *root = BTRFS_I(page->mapping->host)->root;
int err;

mutex_lock(&root->fs_info->fs_mutex);
err = btrfs_check_free_space(root, PAGE_CACHE_SIZE, 0);
mutex_unlock(&root->fs_info->fs_mutex);
if (err)
return -ENOSPC;

return extent_prepare_write(&BTRFS_I(page->mapping->host)->extent_tree,
page->mapping->host, page, from, to,
btrfs_get_extent);
}

int btrfs_readpage(struct file *file, struct page *page)
{
struct extent_map_tree *tree;
Expand Down Expand Up @@ -2120,21 +2108,6 @@ static void btrfs_truncate(struct inode *inode)
btrfs_btree_balance_dirty(root, nr);
}

int btrfs_commit_write(struct file *file, struct page *page,
unsigned from, unsigned to)
{
loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
struct inode *inode = page->mapping->host;

btrfs_cow_one_page(inode, page, PAGE_CACHE_SIZE);

if (pos > inode->i_size) {
i_size_write(inode, pos);
mark_inode_dirty(inode);
}
return 0;
}

static int create_subvol(struct btrfs_root *root, char *name, int namelen)
{
struct btrfs_trans_handle *trans;
Expand Down Expand Up @@ -2930,8 +2903,6 @@ static struct address_space_operations btrfs_aops = {
.writepages = btrfs_writepages,
.readpages = btrfs_readpages,
.sync_page = block_sync_page,
.prepare_write = btrfs_prepare_write,
.commit_write = btrfs_commit_write,
.bmap = btrfs_bmap,
.invalidatepage = btrfs_invalidatepage,
.releasepage = btrfs_releasepage,
Expand Down

0 comments on commit d75e169

Please sign in to comment.