aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/extent_map.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/extent_map.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/extent_map.c')
-rw-r--r--fs/ocfs2/extent_map.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c
index ea0ce41d4193..eef6c1887708 100644
--- a/fs/ocfs2/extent_map.c
+++ b/fs/ocfs2/extent_map.c
@@ -70,9 +70,11 @@ static int ocfs2_search_extent_list(struct ocfs2_extent_list *el,
70} 70}
71 71
72int ocfs2_get_clusters(struct inode *inode, u32 v_cluster, 72int ocfs2_get_clusters(struct inode *inode, u32 v_cluster,
73 u32 *p_cluster, u32 *num_clusters) 73 u32 *p_cluster, u32 *num_clusters,
74 unsigned int *extent_flags)
74{ 75{
75 int ret, i; 76 int ret, i;
77 unsigned int flags = 0;
76 struct buffer_head *di_bh = NULL; 78 struct buffer_head *di_bh = NULL;
77 struct buffer_head *eb_bh = NULL; 79 struct buffer_head *eb_bh = NULL;
78 struct ocfs2_dinode *di; 80 struct ocfs2_dinode *di;
@@ -142,8 +144,13 @@ int ocfs2_get_clusters(struct inode *inode, u32 v_cluster,
142 144
143 if (num_clusters) 145 if (num_clusters)
144 *num_clusters = ocfs2_rec_clusters(el, rec) - coff; 146 *num_clusters = ocfs2_rec_clusters(el, rec) - coff;
147
148 flags = rec->e_flags;
145 } 149 }
146 150
151 if (extent_flags)
152 *extent_flags = flags;
153
147out: 154out:
148 brelse(di_bh); 155 brelse(di_bh);
149 brelse(eb_bh); 156 brelse(eb_bh);
@@ -155,7 +162,7 @@ out:
155 * all while the map is in the process of being updated. 162 * all while the map is in the process of being updated.
156 */ 163 */
157int ocfs2_extent_map_get_blocks(struct inode *inode, u64 v_blkno, u64 *p_blkno, 164int ocfs2_extent_map_get_blocks(struct inode *inode, u64 v_blkno, u64 *p_blkno,
158 int *ret_count) 165 int *ret_count, unsigned int *extent_flags)
159{ 166{
160 int ret; 167 int ret;
161 int bpc = ocfs2_clusters_to_blocks(inode->i_sb, 1); 168 int bpc = ocfs2_clusters_to_blocks(inode->i_sb, 1);
@@ -164,7 +171,8 @@ int ocfs2_extent_map_get_blocks(struct inode *inode, u64 v_blkno, u64 *p_blkno,
164 171
165 cpos = ocfs2_blocks_to_clusters(inode->i_sb, v_blkno); 172 cpos = ocfs2_blocks_to_clusters(inode->i_sb, v_blkno);
166 173
167 ret = ocfs2_get_clusters(inode, cpos, &p_cluster, &num_clusters); 174 ret = ocfs2_get_clusters(inode, cpos, &p_cluster, &num_clusters,
175 extent_flags);
168 if (ret) { 176 if (ret) {
169 mlog_errno(ret); 177 mlog_errno(ret);
170 goto out; 178 goto out;