diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-12-21 16:27:21 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:58 -0400 |
commit | 1832a6d5ee3b1af61001cadba9e10da9e91af4a4 (patch) | |
tree | 3a6dcb2a186c3623b0355b7e45d1b94ecae5e54d /fs/btrfs/disk-io.c | |
parent | 01f466580502c57001bf80fff709479fdb9e87a5 (diff) |
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.c | 5 |
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, | |||
223 | } else { | 223 | } else { |
224 | thresh = 8 * 1024 * 1024; | 224 | thresh = 8 * 1024 * 1024; |
225 | } | 225 | } |
226 | num_dirty = count_range_bits(tree, &start, thresh, EXTENT_DIRTY); | 226 | num_dirty = count_range_bits(tree, &start, (u64)-1, |
227 | thresh, EXTENT_DIRTY); | ||
227 | if (num_dirty < thresh) { | 228 | if (num_dirty < thresh) { |
228 | return 0; | 229 | return 0; |
229 | } | 230 | } |
@@ -559,6 +560,7 @@ struct btrfs_root *open_ctree(struct super_block *sb) | |||
559 | INIT_LIST_HEAD(&fs_info->dead_roots); | 560 | INIT_LIST_HEAD(&fs_info->dead_roots); |
560 | INIT_LIST_HEAD(&fs_info->hashers); | 561 | INIT_LIST_HEAD(&fs_info->hashers); |
561 | spin_lock_init(&fs_info->hash_lock); | 562 | spin_lock_init(&fs_info->hash_lock); |
563 | spin_lock_init(&fs_info->delalloc_lock); | ||
562 | 564 | ||
563 | memset(&fs_info->super_kobj, 0, sizeof(fs_info->super_kobj)); | 565 | memset(&fs_info->super_kobj, 0, sizeof(fs_info->super_kobj)); |
564 | init_completion(&fs_info->kobj_unregister); | 566 | init_completion(&fs_info->kobj_unregister); |
@@ -570,6 +572,7 @@ struct btrfs_root *open_ctree(struct super_block *sb) | |||
570 | fs_info->sb = sb; | 572 | fs_info->sb = sb; |
571 | fs_info->mount_opt = 0; | 573 | fs_info->mount_opt = 0; |
572 | fs_info->max_extent = (u64)-1; | 574 | fs_info->max_extent = (u64)-1; |
575 | fs_info->delalloc_bytes = 0; | ||
573 | fs_info->btree_inode = new_inode(sb); | 576 | fs_info->btree_inode = new_inode(sb); |
574 | fs_info->btree_inode->i_ino = 1; | 577 | fs_info->btree_inode->i_ino = 1; |
575 | fs_info->btree_inode->i_nlink = 1; | 578 | fs_info->btree_inode->i_nlink = 1; |