alloc.c (695a461296e5df148c99ac087b9e1cb380f4db15) alloc.c (8cb471e8f82506937fe5e2e9fb0bf90f6b1f1170)
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * alloc.c
5 *
6 * Extent allocs and frees
7 *
8 * Copyright (C) 2002, 2004 Oracle. All rights reserved.

--- 845 unchanged lines hidden (view full) ---

854}
855
856int ocfs2_read_extent_block(struct inode *inode, u64 eb_blkno,
857 struct buffer_head **bh)
858{
859 int rc;
860 struct buffer_head *tmp = *bh;
861
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * alloc.c
5 *
6 * Extent allocs and frees
7 *
8 * Copyright (C) 2002, 2004 Oracle. All rights reserved.

--- 845 unchanged lines hidden (view full) ---

854}
855
856int ocfs2_read_extent_block(struct inode *inode, u64 eb_blkno,
857 struct buffer_head **bh)
858{
859 int rc;
860 struct buffer_head *tmp = *bh;
861
862 rc = ocfs2_read_block(inode, eb_blkno, &tmp,
862 rc = ocfs2_read_block(INODE_CACHE(inode), eb_blkno, &tmp,
863 ocfs2_validate_extent_block);
864
865 /* If ocfs2_read_block() got us a new bh, pass it up. */
866 if (!rc && !*bh)
867 *bh = tmp;
868
869 return rc;
870}

--- 73 unchanged lines hidden (view full) ---

944
945 for(i = count; i < (num_got + count); i++) {
946 bhs[i] = sb_getblk(osb->sb, first_blkno);
947 if (bhs[i] == NULL) {
948 status = -EIO;
949 mlog_errno(status);
950 goto bail;
951 }
863 ocfs2_validate_extent_block);
864
865 /* If ocfs2_read_block() got us a new bh, pass it up. */
866 if (!rc && !*bh)
867 *bh = tmp;
868
869 return rc;
870}

--- 73 unchanged lines hidden (view full) ---

944
945 for(i = count; i < (num_got + count); i++) {
946 bhs[i] = sb_getblk(osb->sb, first_blkno);
947 if (bhs[i] == NULL) {
948 status = -EIO;
949 mlog_errno(status);
950 goto bail;
951 }
952 ocfs2_set_new_buffer_uptodate(inode, bhs[i]);
952 ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode),
953 bhs[i]);
953
954 status = ocfs2_journal_access_eb(handle, inode, bhs[i],
955 OCFS2_JOURNAL_ACCESS_CREATE);
956 if (status < 0) {
957 mlog_errno(status);
958 goto bail;
959 }
960

--- 1593 unchanged lines hidden (view full) ---

2554 mlog(ML_ERROR,
2555 "Inode %llu, attempted to remove extent block "
2556 "%llu with %u records\n",
2557 (unsigned long long)OCFS2_I(inode)->ip_blkno,
2558 (unsigned long long)le64_to_cpu(eb->h_blkno),
2559 le16_to_cpu(el->l_next_free_rec));
2560
2561 ocfs2_journal_dirty(handle, bh);
954
955 status = ocfs2_journal_access_eb(handle, inode, bhs[i],
956 OCFS2_JOURNAL_ACCESS_CREATE);
957 if (status < 0) {
958 mlog_errno(status);
959 goto bail;
960 }
961

--- 1593 unchanged lines hidden (view full) ---

2555 mlog(ML_ERROR,
2556 "Inode %llu, attempted to remove extent block "
2557 "%llu with %u records\n",
2558 (unsigned long long)OCFS2_I(inode)->ip_blkno,
2559 (unsigned long long)le64_to_cpu(eb->h_blkno),
2560 le16_to_cpu(el->l_next_free_rec));
2561
2562 ocfs2_journal_dirty(handle, bh);
2562 ocfs2_remove_from_cache(inode, bh);
2563 ocfs2_remove_from_cache(INODE_CACHE(inode), bh);
2563 continue;
2564 }
2565
2566 el->l_next_free_rec = 0;
2567 memset(&el->l_recs[0], 0, sizeof(struct ocfs2_extent_rec));
2568
2569 ocfs2_journal_dirty(handle, bh);
2570
2571 ret = ocfs2_cache_extent_block_free(dealloc, eb);
2572 if (ret)
2573 mlog_errno(ret);
2574
2564 continue;
2565 }
2566
2567 el->l_next_free_rec = 0;
2568 memset(&el->l_recs[0], 0, sizeof(struct ocfs2_extent_rec));
2569
2570 ocfs2_journal_dirty(handle, bh);
2571
2572 ret = ocfs2_cache_extent_block_free(dealloc, eb);
2573 if (ret)
2574 mlog_errno(ret);
2575
2575 ocfs2_remove_from_cache(inode, bh);
2576 ocfs2_remove_from_cache(INODE_CACHE(inode), bh);
2576 }
2577}
2578
2579static void ocfs2_unlink_subtree(struct inode *inode, handle_t *handle,
2580 struct ocfs2_path *left_path,
2581 struct ocfs2_path *right_path,
2582 int subtree_index,
2583 struct ocfs2_cached_dealloc_ctxt *dealloc)

--- 3421 unchanged lines hidden (view full) ---

6005 * will be passed back to recovery for processing. */
6006 memcpy(*tl_copy, tl_bh->b_data, tl_bh->b_size);
6007
6008 /* All we need to do to clear the truncate log is set
6009 * tl_used. */
6010 tl->tl_used = 0;
6011
6012 ocfs2_compute_meta_ecc(osb->sb, tl_bh->b_data, &di->i_check);
2577 }
2578}
2579
2580static void ocfs2_unlink_subtree(struct inode *inode, handle_t *handle,
2581 struct ocfs2_path *left_path,
2582 struct ocfs2_path *right_path,
2583 int subtree_index,
2584 struct ocfs2_cached_dealloc_ctxt *dealloc)

--- 3421 unchanged lines hidden (view full) ---

6006 * will be passed back to recovery for processing. */
6007 memcpy(*tl_copy, tl_bh->b_data, tl_bh->b_size);
6008
6009 /* All we need to do to clear the truncate log is set
6010 * tl_used. */
6011 tl->tl_used = 0;
6012
6013 ocfs2_compute_meta_ecc(osb->sb, tl_bh->b_data, &di->i_check);
6013 status = ocfs2_write_block(osb, tl_bh, tl_inode);
6014 status = ocfs2_write_block(osb, tl_bh, INODE_CACHE(tl_inode));
6014 if (status < 0) {
6015 mlog_errno(status);
6016 goto bail;
6017 }
6018 }
6019
6020bail:
6021 if (tl_inode)

--- 692 unchanged lines hidden (view full) ---

6714 /*
6715 * Save this for use when processing the
6716 * parent block.
6717 */
6718 deleted_eb = le64_to_cpu(eb->h_blkno);
6719
6720 mlog(0, "deleting this extent block.\n");
6721
6015 if (status < 0) {
6016 mlog_errno(status);
6017 goto bail;
6018 }
6019 }
6020
6021bail:
6022 if (tl_inode)

--- 692 unchanged lines hidden (view full) ---

6715 /*
6716 * Save this for use when processing the
6717 * parent block.
6718 */
6719 deleted_eb = le64_to_cpu(eb->h_blkno);
6720
6721 mlog(0, "deleting this extent block.\n");
6722
6722 ocfs2_remove_from_cache(inode, bh);
6723 ocfs2_remove_from_cache(INODE_CACHE(inode), bh);
6723
6724 BUG_ON(ocfs2_rec_clusters(el, &el->l_recs[0]));
6725 BUG_ON(le32_to_cpu(el->l_recs[0].e_cpos));
6726 BUG_ON(le64_to_cpu(el->l_recs[0].e_blkno));
6727
6728 ret = ocfs2_cache_extent_block_free(&tc->tc_dealloc, eb);
6729 /* An error here is not fatal. */
6730 if (ret < 0)

--- 829 unchanged lines hidden ---
6724
6725 BUG_ON(ocfs2_rec_clusters(el, &el->l_recs[0]));
6726 BUG_ON(le32_to_cpu(el->l_recs[0].e_cpos));
6727 BUG_ON(le64_to_cpu(el->l_recs[0].e_blkno));
6728
6729 ret = ocfs2_cache_extent_block_free(&tc->tc_dealloc, eb);
6730 /* An error here is not fatal. */
6731 if (ret < 0)

--- 829 unchanged lines hidden ---