aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2007-02-09 23:52:53 -0500
committerMark Fasheh <mark.fasheh@oracle.com>2007-04-26 18:02:12 -0400
commit5069120b7227fd323152a3755a0aa6bdeb361310 (patch)
tree38f55942537178098b4e3a3996bb0f02787dbb51 /fs/ocfs2
parent9517bac6cc7a7aa4fee63cb38a32cb6014e264c7 (diff)
ocfs2: remove ocfs2_prepare_write() and ocfs2_commit_write()
These are no longer used, and can't handle file systems with sparse file allocation. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/aops.c125
1 files changed, 5 insertions, 120 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 5ffb3702b5e9..8368036f434a 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -277,8 +277,11 @@ static int ocfs2_writepage(struct page *page, struct writeback_control *wbc)
277 return ret; 277 return ret;
278} 278}
279 279
280/* This can also be called from ocfs2_write_zero_page() which has done 280/*
281 * it's own cluster locking. */ 281 * This is called from ocfs2_write_zero_page() which has handled it's
282 * own cluster locking and has ensured allocation exists for those
283 * blocks to be written.
284 */
282int ocfs2_prepare_write_nolock(struct inode *inode, struct page *page, 285int ocfs2_prepare_write_nolock(struct inode *inode, struct page *page,
283 unsigned from, unsigned to) 286 unsigned from, unsigned to)
284{ 287{
@@ -293,33 +296,6 @@ int ocfs2_prepare_write_nolock(struct inode *inode, struct page *page,
293 return ret; 296 return ret;
294} 297}
295 298
296/*
297 * ocfs2_prepare_write() can be an outer-most ocfs2 call when it is called
298 * from loopback. It must be able to perform its own locking around
299 * ocfs2_get_block().
300 */
301static int ocfs2_prepare_write(struct file *file, struct page *page,
302 unsigned from, unsigned to)
303{
304 struct inode *inode = page->mapping->host;
305 int ret;
306
307 mlog_entry("(0x%p, 0x%p, %u, %u)\n", file, page, from, to);
308
309 ret = ocfs2_meta_lock_with_page(inode, NULL, 0, page);
310 if (ret != 0) {
311 mlog_errno(ret);
312 goto out;
313 }
314
315 ret = ocfs2_prepare_write_nolock(inode, page, from, to);
316
317 ocfs2_meta_unlock(inode, 0);
318out:
319 mlog_exit(ret);
320 return ret;
321}
322
323/* Taken from ext3. We don't necessarily need the full blown 299/* Taken from ext3. We don't necessarily need the full blown
324 * functionality yet, but IMHO it's better to cut and paste the whole 300 * functionality yet, but IMHO it's better to cut and paste the whole
325 * thing so we can avoid introducing our own bugs (and easily pick up 301 * thing so we can avoid introducing our own bugs (and easily pick up
@@ -389,95 +365,6 @@ out:
389 return handle; 365 return handle;
390} 366}
391 367
392static int ocfs2_commit_write(struct file *file, struct page *page,
393 unsigned from, unsigned to)
394{
395 int ret;
396 struct buffer_head *di_bh = NULL;
397 struct inode *inode = page->mapping->host;
398 handle_t *handle = NULL;
399 struct ocfs2_dinode *di;
400
401 mlog_entry("(0x%p, 0x%p, %u, %u)\n", file, page, from, to);
402
403 /* NOTE: ocfs2_file_aio_write has ensured that it's safe for
404 * us to continue here without rechecking the I/O against
405 * changed inode values.
406 *
407 * 1) We're currently holding the inode alloc lock, so no
408 * nodes can change it underneath us.
409 *
410 * 2) We've had to take the metadata lock at least once
411 * already to check for extending writes, suid removal, etc.
412 * The meta data update code then ensures that we don't get a
413 * stale inode allocation image (i_size, i_clusters, etc).
414 */
415
416 ret = ocfs2_meta_lock_with_page(inode, &di_bh, 1, page);
417 if (ret != 0) {
418 mlog_errno(ret);
419 goto out;
420 }
421
422 ret = ocfs2_data_lock_with_page(inode, 1, page);
423 if (ret != 0) {
424 mlog_errno(ret);
425 goto out_unlock_meta;
426 }
427
428 handle = ocfs2_start_walk_page_trans(inode, page, from, to);
429 if (IS_ERR(handle)) {
430 ret = PTR_ERR(handle);
431 goto out_unlock_data;
432 }
433
434 /* Mark our buffer early. We'd rather catch this error up here
435 * as opposed to after a successful commit_write which would
436 * require us to set back inode->i_size. */
437 ret = ocfs2_journal_access(handle, inode, di_bh,
438 OCFS2_JOURNAL_ACCESS_WRITE);
439 if (ret < 0) {
440 mlog_errno(ret);
441 goto out_commit;
442 }
443
444 /* might update i_size */
445 ret = generic_commit_write(file, page, from, to);
446 if (ret < 0) {
447 mlog_errno(ret);
448 goto out_commit;
449 }
450
451 di = (struct ocfs2_dinode *)di_bh->b_data;
452
453 /* ocfs2_mark_inode_dirty() is too heavy to use here. */
454 inode->i_mtime = inode->i_ctime = CURRENT_TIME;
455 di->i_mtime = di->i_ctime = cpu_to_le64(inode->i_mtime.tv_sec);
456 di->i_mtime_nsec = di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec);
457
458 inode->i_blocks = ocfs2_align_bytes_to_sectors((u64)(i_size_read(inode)));
459 di->i_size = cpu_to_le64((u64)i_size_read(inode));
460
461 ret = ocfs2_journal_dirty(handle, di_bh);
462 if (ret < 0) {
463 mlog_errno(ret);
464 goto out_commit;
465 }
466
467out_commit:
468 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
469out_unlock_data:
470 ocfs2_data_unlock(inode, 1);
471out_unlock_meta:
472 ocfs2_meta_unlock(inode, 1);
473out:
474 if (di_bh)
475 brelse(di_bh);
476
477 mlog_exit(ret);
478 return ret;
479}
480
481static sector_t ocfs2_bmap(struct address_space *mapping, sector_t block) 368static sector_t ocfs2_bmap(struct address_space *mapping, sector_t block)
482{ 369{
483 sector_t status; 370 sector_t status;
@@ -1323,8 +1210,6 @@ out:
1323const struct address_space_operations ocfs2_aops = { 1210const struct address_space_operations ocfs2_aops = {
1324 .readpage = ocfs2_readpage, 1211 .readpage = ocfs2_readpage,
1325 .writepage = ocfs2_writepage, 1212 .writepage = ocfs2_writepage,
1326 .prepare_write = ocfs2_prepare_write,
1327 .commit_write = ocfs2_commit_write,
1328 .bmap = ocfs2_bmap, 1213 .bmap = ocfs2_bmap,
1329 .sync_page = block_sync_page, 1214 .sync_page = block_sync_page,
1330 .direct_IO = ocfs2_direct_IO, 1215 .direct_IO = ocfs2_direct_IO,