diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ocfs2/file.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index bbac7cd33e0b..b75b2e1f0e42 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -399,7 +399,7 @@ static int ocfs2_truncate_file(struct inode *inode, | |||
399 | 399 | ||
400 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { | 400 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { |
401 | status = ocfs2_truncate_inline(inode, di_bh, new_i_size, | 401 | status = ocfs2_truncate_inline(inode, di_bh, new_i_size, |
402 | i_size_read(inode), 0); | 402 | i_size_read(inode), 1); |
403 | if (status) | 403 | if (status) |
404 | mlog_errno(status); | 404 | mlog_errno(status); |
405 | 405 | ||
@@ -1521,6 +1521,7 @@ static int ocfs2_remove_inode_range(struct inode *inode, | |||
1521 | u32 trunc_start, trunc_len, cpos, phys_cpos, alloc_size; | 1521 | u32 trunc_start, trunc_len, cpos, phys_cpos, alloc_size; |
1522 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 1522 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
1523 | struct ocfs2_cached_dealloc_ctxt dealloc; | 1523 | struct ocfs2_cached_dealloc_ctxt dealloc; |
1524 | struct address_space *mapping = inode->i_mapping; | ||
1524 | 1525 | ||
1525 | ocfs2_init_dealloc_ctxt(&dealloc); | 1526 | ocfs2_init_dealloc_ctxt(&dealloc); |
1526 | 1527 | ||
@@ -1529,10 +1530,20 @@ static int ocfs2_remove_inode_range(struct inode *inode, | |||
1529 | 1530 | ||
1530 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { | 1531 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { |
1531 | ret = ocfs2_truncate_inline(inode, di_bh, byte_start, | 1532 | ret = ocfs2_truncate_inline(inode, di_bh, byte_start, |
1532 | byte_start + byte_len, 1); | 1533 | byte_start + byte_len, 0); |
1533 | if (ret) | 1534 | if (ret) { |
1534 | mlog_errno(ret); | 1535 | mlog_errno(ret); |
1535 | return ret; | 1536 | goto out; |
1537 | } | ||
1538 | /* | ||
1539 | * There's no need to get fancy with the page cache | ||
1540 | * truncate of an inline-data inode. We're talking | ||
1541 | * about less than a page here, which will be cached | ||
1542 | * in the dinode buffer anyway. | ||
1543 | */ | ||
1544 | unmap_mapping_range(mapping, 0, 0, 0); | ||
1545 | truncate_inode_pages(mapping, 0); | ||
1546 | goto out; | ||
1536 | } | 1547 | } |
1537 | 1548 | ||
1538 | trunc_start = ocfs2_clusters_for_bytes(osb->sb, byte_start); | 1549 | trunc_start = ocfs2_clusters_for_bytes(osb->sb, byte_start); |