summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorYan <yanzheng@21cn.com>2008-02-05 09:07:49 -0500
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:00 -0400
commitdacb473ad81d5c1650cb73d1cb9b866202f6bab0 (patch)
tree7b0396348204f8b1a0b5b0e8b205f04067b5a739 /fs
parent47b0c4f8c717890877058f30e07a30e05f74a7bb (diff)
Btrfs: Fix hole creation in file_write
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/file.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 7cbf8d8d7e27..184bde1cfc3d 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -265,16 +265,14 @@ static int noinline dirty_and_release_pages(struct btrfs_trans_handle *trans,
set_extent_uptodate(io_tree, start_pos, end_of_last_block, GFP_NOFS);
/* FIXME...EIEIO, ENOSPC and more */
-
/* insert any holes we need to create */
- if (inode->i_size < start_pos) {
+ if (isize < end_pos) {
u64 last_pos_in_file;
u64 hole_size;
u64 mask = root->sectorsize - 1;
last_pos_in_file = (isize + mask) & ~mask;
hole_size = (end_pos - last_pos_in_file + mask) & ~mask;
-
- if (last_pos_in_file < start_pos) {
+ if (last_pos_in_file < end_pos) {
err = btrfs_drop_extents(trans, root, inode,
last_pos_in_file,
last_pos_in_file + hole_size,