diff options
author | Josef Bacik <jbacik@redhat.com> | 2009-02-20 17:00:09 +0100 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-02-20 17:00:09 +0100 |
commit | 6a63209fc02d5483371f07e4913ee8abad608051 (patch) | |
tree | 7595e0df452928b677b66a64baf0cb3b7ec53dfc /fs/btrfs/btrfs_inode.h | |
parent | Btrfs: check file pointer in btrfs_sync_file (diff) | |
download | linux-6a63209fc02d5483371f07e4913ee8abad608051.tar.xz linux-6a63209fc02d5483371f07e4913ee8abad608051.zip |
Btrfs: add better -ENOSPC handling
This is a step in the direction of better -ENOSPC handling. Instead of
checking the global bytes counter we check the space_info bytes counters to
make sure we have enough space.
If we don't we go ahead and try to allocate a new chunk, and then if that fails
we return -ENOSPC. This patch adds two counters to btrfs_space_info,
bytes_delalloc and bytes_may_use.
bytes_delalloc account for extents we've actually setup for delalloc and will
be allocated at some point down the line.
bytes_may_use is to keep track of how many bytes we may use for delalloc at
some point. When we actually set the extent_bit for the delalloc bytes we
subtract the reserved bytes from the bytes_may_use counter. This keeps us from
not actually being able to allocate space for any delalloc bytes.
Signed-off-by: Josef Bacik <jbacik@redhat.com>
Diffstat (limited to 'fs/btrfs/btrfs_inode.h')
-rw-r--r-- | fs/btrfs/btrfs_inode.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index a8c9693b75ac..72677ce2b74f 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h @@ -66,6 +66,9 @@ struct btrfs_inode { */ struct list_head delalloc_inodes; + /* the space_info for where this inode's data allocations are done */ + struct btrfs_space_info *space_info; + /* full 64 bit generation number, struct vfs_inode doesn't have a big * enough field for this. */ @@ -94,6 +97,11 @@ struct btrfs_inode { */ u64 delalloc_bytes; + /* total number of bytes that may be used for this inode for + * delalloc + */ + u64 reserved_bytes; + /* * the size of the file stored in the metadata on disk. data=ordered * means the in-memory i_size might be larger than the size on disk |