aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/alloc.c
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2007-03-09 19:21:46 -0500
committerMark Fasheh <mark.fasheh@oracle.com>2007-04-26 18:02:41 -0400
commit49cb8d2d496ce06869ccca2ab368ed6b0b5b979d (patch)
tree7aded7178e87dc26eb2ceafb169d7e68a8ee5ded /fs/ocfs2/alloc.c
parente48edee2d8eab812f31f0ff62c6ba635ca2e1e21 (diff)
ocfs2: Read from an unwritten extent returns zeros
Return an optional extent flags field from our lookup functions and wire up callers to treat unwritten regions as holes for the purpose of returning zeros to the user. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/alloc.c')
-rw-r--r--fs/ocfs2/alloc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 0eab0d328289..412a2888a3ed 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -3487,6 +3487,7 @@ static int ocfs2_grab_eof_pages(struct inode *inode, loff_t isize, struct page *
3487{ 3487{
3488 int i, numpages = 0, ret = 0; 3488 int i, numpages = 0, ret = 0;
3489 unsigned int csize = OCFS2_SB(inode->i_sb)->s_clustersize; 3489 unsigned int csize = OCFS2_SB(inode->i_sb)->s_clustersize;
3490 unsigned int ext_flags;
3490 struct super_block *sb = inode->i_sb; 3491 struct super_block *sb = inode->i_sb;
3491 struct address_space *mapping = inode->i_mapping; 3492 struct address_space *mapping = inode->i_mapping;
3492 unsigned long index; 3493 unsigned long index;
@@ -3499,7 +3500,7 @@ static int ocfs2_grab_eof_pages(struct inode *inode, loff_t isize, struct page *
3499 goto out; 3500 goto out;
3500 3501
3501 ret = ocfs2_extent_map_get_blocks(inode, isize >> sb->s_blocksize_bits, 3502 ret = ocfs2_extent_map_get_blocks(inode, isize >> sb->s_blocksize_bits,
3502 phys, NULL); 3503 phys, NULL, &ext_flags);
3503 if (ret) { 3504 if (ret) {
3504 mlog_errno(ret); 3505 mlog_errno(ret);
3505 goto out; 3506 goto out;
@@ -3509,6 +3510,11 @@ static int ocfs2_grab_eof_pages(struct inode *inode, loff_t isize, struct page *
3509 if (*phys == 0) 3510 if (*phys == 0)
3510 goto out; 3511 goto out;
3511 3512
3513 /* Tail is marked as unwritten, we can count on write to zero
3514 * in that case. */
3515 if (ext_flags & OCFS2_EXT_UNWRITTEN)
3516 goto out;
3517
3512 next_cluster_bytes = ocfs2_align_bytes_to_clusters(inode->i_sb, isize); 3518 next_cluster_bytes = ocfs2_align_bytes_to_clusters(inode->i_sb, isize);
3513 index = isize >> PAGE_CACHE_SHIFT; 3519 index = isize >> PAGE_CACHE_SHIFT;
3514 do { 3520 do {
@@ -3579,9 +3585,6 @@ int ocfs2_zero_tail_for_truncate(struct inode *inode, handle_t *handle,
3579 goto out; 3585 goto out;
3580 } 3586 }
3581 3587
3582 /*
3583 * Truncate on an i_size boundary - nothing more to do.
3584 */
3585 if (numpages == 0) 3588 if (numpages == 0)
3586 goto out; 3589 goto out;
3587 3590