aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-04-28 08:48:10 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-04-28 08:48:10 -0400
commit06a2f9fa4c12a055cc396936408a78ae0acfb6b4 (patch)
tree49770115618c2637e80b4d8d6ee540bc86b3c979 /fs
parent28b8bb9e001aa1c4abdd10a8e36972658237fe43 (diff)
Btrfs: try to drop dead cow pages from ram
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/TODO3
-rw-r--r--fs/btrfs/extent-tree.c17
2 files changed, 18 insertions, 2 deletions
diff --git a/fs/btrfs/TODO b/fs/btrfs/TODO
index 5ff2cef9f02..6a8c8cd03ca 100644
--- a/fs/btrfs/TODO
+++ b/fs/btrfs/TODO
@@ -6,8 +6,7 @@
* Check compat and incompat flags on the inode
* Get rid of struct ctree_path, limiting tree levels held at one time
* Add generation number to key pointer in nodes
-* Add parent pointer back to extent map.
-* Implement real list of pending transactions
+* Add generation number to inode
* Release
* Do real tree locking
* Add extent mirroring (backup copies of blocks)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index aca5802a8a1..afc5267515e 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -291,10 +291,18 @@ static int update_block_group(struct btrfs_trans_handle *trans,
return 0;
}
+static int try_remove_page(struct address_space *mapping, unsigned long index)
+{
+ int ret;
+ ret = invalidate_mapping_pages(mapping, index, index);
+ return ret;
+}
+
int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans, struct
btrfs_root *root)
{
unsigned long gang[8];
+ struct inode *btree_inode = root->fs_info->btree_inode;
u64 first = 0;
int ret;
int i;
@@ -309,6 +317,9 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans, struct
first = gang[0];
for (i = 0; i < ret; i++) {
clear_radix_bit(pinned_radix, gang[i]);
+ try_remove_page(btree_inode->i_mapping,
+ gang[i] << (PAGE_CACHE_SHIFT -
+ btree_inode->i_blkbits));
}
}
if (root->fs_info->block_group_cache) {
@@ -600,6 +611,12 @@ check_pending:
*/
btrfs_release_path(root, path);
BUG_ON(ins->objectid < search_start);
+ if (ins->objectid >= btrfs_super_total_blocks(info->disk_super)) {
+ if (search_start == 0)
+ return -ENOSPC;
+ search_start = 0;
+ goto check_failed;
+ }
for (test_block = ins->objectid;
test_block < ins->objectid + num_blocks; test_block++) {
if (test_radix_bit(&info->pinned_radix, test_block)) {