diff options
author | Mark Fasheh <mark.fasheh@oracle.com> | 2007-03-09 19:21:46 -0500 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2007-04-26 18:02:41 -0400 |
commit | 49cb8d2d496ce06869ccca2ab368ed6b0b5b979d (patch) | |
tree | 7aded7178e87dc26eb2ceafb169d7e68a8ee5ded /fs/ocfs2/file.c | |
parent | e48edee2d8eab812f31f0ff62c6ba635ca2e1e21 (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/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, | |||
1127 | size_t count) | 1127 | size_t count) |
1128 | { | 1128 | { |
1129 | int ret = 0; | 1129 | int ret = 0; |
1130 | unsigned int extent_flags; | ||
1130 | u32 cpos, clusters, extent_len, phys_cpos; | 1131 | u32 cpos, clusters, extent_len, phys_cpos; |
1131 | struct super_block *sb = inode->i_sb; | 1132 | struct super_block *sb = inode->i_sb; |
1132 | 1133 | ||
@@ -1134,13 +1135,14 @@ static int ocfs2_check_range_for_holes(struct inode *inode, loff_t pos, | |||
1134 | clusters = ocfs2_clusters_for_bytes(sb, pos + count) - cpos; | 1135 | clusters = ocfs2_clusters_for_bytes(sb, pos + count) - cpos; |
1135 | 1136 | ||
1136 | while (clusters) { | 1137 | while (clusters) { |
1137 | ret = ocfs2_get_clusters(inode, cpos, &phys_cpos, &extent_len); | 1138 | ret = ocfs2_get_clusters(inode, cpos, &phys_cpos, &extent_len, |
1139 | &extent_flags); | ||
1138 | if (ret < 0) { | 1140 | if (ret < 0) { |
1139 | mlog_errno(ret); | 1141 | mlog_errno(ret); |
1140 | goto out; | 1142 | goto out; |
1141 | } | 1143 | } |
1142 | 1144 | ||
1143 | if (phys_cpos == 0) { | 1145 | if (phys_cpos == 0 || (extent_flags & OCFS2_EXT_UNWRITTEN)) { |
1144 | ret = 1; | 1146 | ret = 1; |
1145 | break; | 1147 | break; |
1146 | } | 1148 | } |