diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-01-30 11:54:05 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:00 -0400 |
commit | f392a938f3cc36a2abe68db9286bd864c3b2f7dd (patch) | |
tree | 6ec7bcfbc21dfce2a84390db17b03be6c7cfe6a0 /fs/btrfs/inode.c | |
parent | b1632b10c0133992fd0290b4836c47661bed4396 (diff) |
Properly align the hole size in btrfs_setattr
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index de17c61dfa0a..515f8b01ab04 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1001,7 +1001,7 @@ static int btrfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
1001 | 1001 | ||
1002 | u64 mask = root->sectorsize - 1; | 1002 | u64 mask = root->sectorsize - 1; |
1003 | u64 pos = (inode->i_size + mask) & ~mask; | 1003 | u64 pos = (inode->i_size + mask) & ~mask; |
1004 | u64 block_end = attr->ia_size | mask; | 1004 | u64 block_end = (attr->ia_size + mask) & ~mask; |
1005 | u64 hole_start; | 1005 | u64 hole_start; |
1006 | u64 hole_size; | 1006 | u64 hole_size; |
1007 | u64 alloc_hint = 0; | 1007 | u64 alloc_hint = 0; |
@@ -1022,7 +1022,7 @@ static int btrfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
1022 | 1022 | ||
1023 | btrfs_truncate_page(inode->i_mapping, inode->i_size); | 1023 | btrfs_truncate_page(inode->i_mapping, inode->i_size); |
1024 | 1024 | ||
1025 | lock_extent(io_tree, pos, block_end, GFP_NOFS); | 1025 | lock_extent(io_tree, pos, block_end - 1, GFP_NOFS); |
1026 | hole_size = block_end - hole_start; | 1026 | hole_size = block_end - hole_start; |
1027 | 1027 | ||
1028 | mutex_lock(&root->fs_info->fs_mutex); | 1028 | mutex_lock(&root->fs_info->fs_mutex); |
@@ -1043,7 +1043,7 @@ static int btrfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
1043 | } | 1043 | } |
1044 | btrfs_end_transaction(trans, root); | 1044 | btrfs_end_transaction(trans, root); |
1045 | mutex_unlock(&root->fs_info->fs_mutex); | 1045 | mutex_unlock(&root->fs_info->fs_mutex); |
1046 | unlock_extent(io_tree, pos, block_end, GFP_NOFS); | 1046 | unlock_extent(io_tree, pos, block_end - 1, GFP_NOFS); |
1047 | if (err) | 1047 | if (err) |
1048 | return err; | 1048 | return err; |
1049 | } | 1049 | } |