diff options
author | Joel Becker <joel.becker@oracle.com> | 2008-10-09 20:20:30 -0400 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2008-10-14 14:43:29 -0400 |
commit | 31d33073ca38603dea705dae45e094a64ca062d6 (patch) | |
tree | cf02beb489456ebc9e07bace80e96ad1150f2cbf /fs/ocfs2/buffer_head_io.c | |
parent | da1e90985a0e767e44397c9db0937e236033fa58 (diff) |
ocfs2: Require an inode for ocfs2_read_block(s)().
Now that synchronous readers are using ocfs2_read_blocks_sync(), all
callers of ocfs2_read_blocks() are passing an inode. Use it
unconditionally. Since it's there, we don't need to pass the
ocfs2_super either.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/buffer_head_io.c')
-rw-r--r-- | fs/ocfs2/buffer_head_io.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c index ca4ab7ce85bf..718dbe5607ca 100644 --- a/fs/ocfs2/buffer_head_io.c +++ b/fs/ocfs2/buffer_head_io.c | |||
@@ -170,22 +170,20 @@ bail: | |||
170 | return status; | 170 | return status; |
171 | } | 171 | } |
172 | 172 | ||
173 | int ocfs2_read_blocks(struct ocfs2_super *osb, u64 block, int nr, | 173 | int ocfs2_read_blocks(struct inode *inode, u64 block, int nr, |
174 | struct buffer_head *bhs[], int flags, | 174 | struct buffer_head *bhs[], int flags) |
175 | struct inode *inode) | ||
176 | { | 175 | { |
177 | int status = 0; | 176 | int status = 0; |
178 | struct super_block *sb; | ||
179 | int i, ignore_cache = 0; | 177 | int i, ignore_cache = 0; |
180 | struct buffer_head *bh; | 178 | struct buffer_head *bh; |
181 | 179 | ||
182 | mlog_entry("(block=(%llu), nr=(%d), flags=%d, inode=%p)\n", | 180 | mlog_entry("(inode=%p, block=(%llu), nr=(%d), flags=%d)\n", |
183 | (unsigned long long)block, nr, flags, inode); | 181 | inode, (unsigned long long)block, nr, flags); |
184 | 182 | ||
185 | BUG_ON((flags & OCFS2_BH_READAHEAD) && | 183 | BUG_ON(!inode); |
186 | (!inode || !(flags & OCFS2_BH_CACHED))); | 184 | BUG_ON((flags & OCFS2_BH_READAHEAD) && !(flags & OCFS2_BH_CACHED)); |
187 | 185 | ||
188 | if (osb == NULL || osb->sb == NULL || bhs == NULL) { | 186 | if (bhs == NULL) { |
189 | status = -EINVAL; | 187 | status = -EINVAL; |
190 | mlog_errno(status); | 188 | mlog_errno(status); |
191 | goto bail; | 189 | goto bail; |
@@ -204,19 +202,12 @@ int ocfs2_read_blocks(struct ocfs2_super *osb, u64 block, int nr, | |||
204 | goto bail; | 202 | goto bail; |
205 | } | 203 | } |
206 | 204 | ||
207 | sb = osb->sb; | 205 | mutex_lock(&OCFS2_I(inode)->ip_io_mutex); |
208 | |||
209 | if (flags & OCFS2_BH_CACHED && !inode) | ||
210 | flags &= ~OCFS2_BH_CACHED; | ||
211 | |||
212 | if (inode) | ||
213 | mutex_lock(&OCFS2_I(inode)->ip_io_mutex); | ||
214 | for (i = 0 ; i < nr ; i++) { | 206 | for (i = 0 ; i < nr ; i++) { |
215 | if (bhs[i] == NULL) { | 207 | if (bhs[i] == NULL) { |
216 | bhs[i] = sb_getblk(sb, block++); | 208 | bhs[i] = sb_getblk(inode->i_sb, block++); |
217 | if (bhs[i] == NULL) { | 209 | if (bhs[i] == NULL) { |
218 | if (inode) | 210 | mutex_unlock(&OCFS2_I(inode)->ip_io_mutex); |
219 | mutex_unlock(&OCFS2_I(inode)->ip_io_mutex); | ||
220 | status = -EIO; | 211 | status = -EIO; |
221 | mlog_errno(status); | 212 | mlog_errno(status); |
222 | goto bail; | 213 | goto bail; |
@@ -347,11 +338,9 @@ int ocfs2_read_blocks(struct ocfs2_super *osb, u64 block, int nr, | |||
347 | /* Always set the buffer in the cache, even if it was | 338 | /* Always set the buffer in the cache, even if it was |
348 | * a forced read, or read-ahead which hasn't yet | 339 | * a forced read, or read-ahead which hasn't yet |
349 | * completed. */ | 340 | * completed. */ |
350 | if (inode) | 341 | ocfs2_set_buffer_uptodate(inode, bh); |
351 | ocfs2_set_buffer_uptodate(inode, bh); | ||
352 | } | 342 | } |
353 | if (inode) | 343 | mutex_unlock(&OCFS2_I(inode)->ip_io_mutex); |
354 | mutex_unlock(&OCFS2_I(inode)->ip_io_mutex); | ||
355 | 344 | ||
356 | mlog(ML_BH_IO, "block=(%llu), nr=(%d), cached=%s, flags=0x%x\n", | 345 | mlog(ML_BH_IO, "block=(%llu), nr=(%d), cached=%s, flags=0x%x\n", |
357 | (unsigned long long)block, nr, | 346 | (unsigned long long)block, nr, |