summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorChris Mason2007-12-21 22:27:21 +0100
committerChris Mason2008-09-25 17:03:58 +0200
commit1832a6d5ee3b1af61001cadba9e10da9e91af4a4 (patch)
tree3a6dcb2a186c3623b0355b7e45d1b94ecae5e54d /fs/btrfs/disk-io.c
parentBtrfs: Less aggressive readahead on deletes (diff)
downloadkernel-qcow2-linux-1832a6d5ee3b1af61001cadba9e10da9e91af4a4.tar.gz
kernel-qcow2-linux-1832a6d5ee3b1af61001cadba9e10da9e91af4a4.tar.xz
kernel-qcow2-linux-1832a6d5ee3b1af61001cadba9e10da9e91af4a4.zip
Btrfs: Implement basic support for -ENOSPC
This is intended to prevent accidentally filling the drive. A determined user can still make things oops. It includes some accounting of the current bytes under delayed allocation, but this will change as things get optimized Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index ebb2db624fdd..eebb4fb65c61 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -223,7 +223,8 @@ static int btree_writepages(struct address_space *mapping,
} else {
thresh = 8 * 1024 * 1024;
}
- num_dirty = count_range_bits(tree, &start, thresh, EXTENT_DIRTY);
+ num_dirty = count_range_bits(tree, &start, (u64)-1,
+ thresh, EXTENT_DIRTY);
if (num_dirty < thresh) {
return 0;
}
@@ -559,6 +560,7 @@ struct btrfs_root *open_ctree(struct super_block *sb)
INIT_LIST_HEAD(&fs_info->dead_roots);
INIT_LIST_HEAD(&fs_info->hashers);
spin_lock_init(&fs_info->hash_lock);
+ spin_lock_init(&fs_info->delalloc_lock);
memset(&fs_info->super_kobj, 0, sizeof(fs_info->super_kobj));
init_completion(&fs_info->kobj_unregister);
@@ -570,6 +572,7 @@ struct btrfs_root *open_ctree(struct super_block *sb)
fs_info->sb = sb;
fs_info->mount_opt = 0;
fs_info->max_extent = (u64)-1;
+ fs_info->delalloc_bytes = 0;
fs_info->btree_inode = new_inode(sb);
fs_info->btree_inode->i_ino = 1;
fs_info->btree_inode->i_nlink = 1;