diff options
author | Mark Fasheh <mark.fasheh@oracle.com> | 2007-03-09 16:21:46 -0800 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2007-04-26 15:02:41 -0700 |
commit | 49cb8d2d496ce06869ccca2ab368ed6b0b5b979d (patch) | |
tree | 7aded7178e87dc26eb2ceafb169d7e68a8ee5ded /fs/ocfs2/file.c | |
parent | e48edee2d8eab812f31f0ff62c6ba635ca2e1e21 (diff) | |
download | lwn-49cb8d2d496ce06869ccca2ab368ed6b0b5b979d.tar.gz lwn-49cb8d2d496ce06869ccca2ab368ed6b0b5b979d.zip |
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/file.c')
-rw-r--r-- | fs/ocfs2/file.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 36176018b4b4..f516619a3744 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -1127,6 +1127,7 @@ static int ocfs2_check_range_for_holes(struct inode *inode, loff_t pos, size_t count) { int ret = 0; + unsigned int extent_flags; u32 cpos, clusters, extent_len, phys_cpos; struct super_block *sb = inode->i_sb; @@ -1134,13 +1135,14 @@ static int ocfs2_check_range_for_holes(struct inode *inode, loff_t pos, clusters = ocfs2_clusters_for_bytes(sb, pos + count) - cpos; while (clusters) { - ret = ocfs2_get_clusters(inode, cpos, &phys_cpos, &extent_len); + ret = ocfs2_get_clusters(inode, cpos, &phys_cpos, &extent_len, + &extent_flags); if (ret < 0) { mlog_errno(ret); goto out; } - if (phys_cpos == 0) { + if (phys_cpos == 0 || (extent_flags & OCFS2_EXT_UNWRITTEN)) { ret = 1; break; } |