summaryrefslogtreecommitdiff
path: root/fs/ocfs2/file.c
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2007-07-06 14:41:18 -0700
committerMark Fasheh <mark.fasheh@oracle.com>2007-07-10 17:32:07 -0700
commit35edec1d52c075975991471d624b33b9336226f2 (patch)
tree4fc59b9d60826b8eb44bc5c1e558a15bea171193 /fs/ocfs2/file.c
parentd0c7d7082ee1ec4f95ee57bf86ed39d1a27c4037 (diff)
downloadlinux-3.10-35edec1d52c075975991471d624b33b9336226f2.tar.gz
linux-3.10-35edec1d52c075975991471d624b33b9336226f2.tar.bz2
linux-3.10-35edec1d52c075975991471d624b33b9336226f2.zip
ocfs2: update truncate handling of partial clusters
The partial cluster zeroing code used during truncate usually assumes that the rightmost byte in the range to be zeroed lies on a cluster boundary. This makes sense for truncate, but punching holes might require zeroing on non-aligned rightmost boundaries. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/file.c')
-rw-r--r--fs/ocfs2/file.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 3e21ad9a6dd..f0a6b1330a6 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -263,6 +263,7 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb,
int status;
handle_t *handle;
struct ocfs2_dinode *di;
+ u64 cluster_bytes;
mlog_entry_void();
@@ -286,7 +287,9 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb,
/*
* Do this before setting i_size.
*/
- status = ocfs2_zero_tail_for_truncate(inode, handle, new_i_size);
+ cluster_bytes = ocfs2_align_bytes_to_clusters(inode->i_sb, new_i_size);
+ status = ocfs2_zero_range_for_truncate(inode, handle, new_i_size,
+ cluster_bytes);
if (status) {
mlog_errno(status);
goto out_commit;