ocfs2: Pass struct ocfs2_caching_info to the journal functions.

The next step in divorcing metadata I/O management from struct inode is
to pass struct ocfs2_caching_info to the journal functions.  Thus the
journal locks a metadata cache with the cache io_lock function.  It also
can compare ci_last_trans and ci_created_trans directly.

This is a large patch because of all the places we change
ocfs2_journal_access..(handle, inode, ...) to
ocfs2_journal_access..(handle, INODE_CACHE(inode), ...).

Signed-off-by: Joel Becker <joel.becker@oracle.com>
This commit is contained in:
Joel Becker 2009-02-12 16:41:25 -08:00
parent 292dd27ec7
commit 0cf2f7632b
17 changed files with 257 additions and 219 deletions

View File

@ -415,11 +415,11 @@ static inline void ocfs2_et_update_clusters(struct inode *inode,
} }
static inline int ocfs2_et_root_journal_access(handle_t *handle, static inline int ocfs2_et_root_journal_access(handle_t *handle,
struct inode *inode, struct ocfs2_caching_info *ci,
struct ocfs2_extent_tree *et, struct ocfs2_extent_tree *et,
int type) int type)
{ {
return et->et_root_journal_access(handle, inode, et->et_root_bh, return et->et_root_journal_access(handle, ci, et->et_root_bh,
type); type);
} }
@ -633,7 +633,7 @@ static struct ocfs2_path *ocfs2_new_path_from_et(struct ocfs2_extent_tree *et)
* ocfs2_journal_access_path(), but I don't have a better one. * ocfs2_journal_access_path(), but I don't have a better one.
*/ */
static int ocfs2_path_bh_journal_access(handle_t *handle, static int ocfs2_path_bh_journal_access(handle_t *handle,
struct inode *inode, struct ocfs2_caching_info *ci,
struct ocfs2_path *path, struct ocfs2_path *path,
int idx) int idx)
{ {
@ -645,14 +645,15 @@ static int ocfs2_path_bh_journal_access(handle_t *handle,
if (idx) if (idx)
access = ocfs2_journal_access_eb; access = ocfs2_journal_access_eb;
return access(handle, inode, path->p_node[idx].bh, return access(handle, ci, path->p_node[idx].bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
} }
/* /*
* Convenience function to journal all components in a path. * Convenience function to journal all components in a path.
*/ */
static int ocfs2_journal_access_path(struct inode *inode, handle_t *handle, static int ocfs2_journal_access_path(struct ocfs2_caching_info *ci,
handle_t *handle,
struct ocfs2_path *path) struct ocfs2_path *path)
{ {
int i, ret = 0; int i, ret = 0;
@ -661,7 +662,7 @@ static int ocfs2_journal_access_path(struct inode *inode, handle_t *handle,
goto out; goto out;
for(i = 0; i < path_num_items(path); i++) { for(i = 0; i < path_num_items(path); i++) {
ret = ocfs2_path_bh_journal_access(handle, inode, path, i); ret = ocfs2_path_bh_journal_access(handle, ci, path, i);
if (ret < 0) { if (ret < 0) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
@ -952,7 +953,7 @@ static int ocfs2_create_new_meta_bhs(struct ocfs2_super *osb,
ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode),
bhs[i]); bhs[i]);
status = ocfs2_journal_access_eb(handle, inode, bhs[i], status = ocfs2_journal_access_eb(handle, INODE_CACHE(inode), bhs[i],
OCFS2_JOURNAL_ACCESS_CREATE); OCFS2_JOURNAL_ACCESS_CREATE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -1051,7 +1052,7 @@ static int ocfs2_adjust_rightmost_branch(handle_t *handle,
goto out; goto out;
} }
status = ocfs2_journal_access_path(inode, handle, path); status = ocfs2_journal_access_path(INODE_CACHE(inode), handle, path);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto out; goto out;
@ -1162,7 +1163,7 @@ static int ocfs2_add_branch(struct ocfs2_super *osb,
BUG_ON(!OCFS2_IS_VALID_EXTENT_BLOCK(eb)); BUG_ON(!OCFS2_IS_VALID_EXTENT_BLOCK(eb));
eb_el = &eb->h_list; eb_el = &eb->h_list;
status = ocfs2_journal_access_eb(handle, inode, bh, status = ocfs2_journal_access_eb(handle, INODE_CACHE(inode), bh,
OCFS2_JOURNAL_ACCESS_CREATE); OCFS2_JOURNAL_ACCESS_CREATE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -1202,20 +1203,20 @@ static int ocfs2_add_branch(struct ocfs2_super *osb,
* journal_dirty erroring as it won't unless we've aborted the * journal_dirty erroring as it won't unless we've aborted the
* handle (in which case we would never be here) so reserving * handle (in which case we would never be here) so reserving
* the write with journal_access is all we need to do. */ * the write with journal_access is all we need to do. */
status = ocfs2_journal_access_eb(handle, inode, *last_eb_bh, status = ocfs2_journal_access_eb(handle, INODE_CACHE(inode), *last_eb_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail; goto bail;
} }
status = ocfs2_et_root_journal_access(handle, inode, et, status = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail; goto bail;
} }
if (eb_bh) { if (eb_bh) {
status = ocfs2_journal_access_eb(handle, inode, eb_bh, status = ocfs2_journal_access_eb(handle, INODE_CACHE(inode), eb_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -1305,7 +1306,7 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb,
eb_el = &eb->h_list; eb_el = &eb->h_list;
root_el = et->et_root_el; root_el = et->et_root_el;
status = ocfs2_journal_access_eb(handle, inode, new_eb_bh, status = ocfs2_journal_access_eb(handle, INODE_CACHE(inode), new_eb_bh,
OCFS2_JOURNAL_ACCESS_CREATE); OCFS2_JOURNAL_ACCESS_CREATE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -1324,7 +1325,7 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb,
goto bail; goto bail;
} }
status = ocfs2_et_root_journal_access(handle, inode, et, status = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -2095,7 +2096,7 @@ static int ocfs2_rotate_subtree_right(struct inode *inode,
root_bh = left_path->p_node[subtree_index].bh; root_bh = left_path->p_node[subtree_index].bh;
BUG_ON(root_bh != right_path->p_node[subtree_index].bh); BUG_ON(root_bh != right_path->p_node[subtree_index].bh);
ret = ocfs2_path_bh_journal_access(handle, inode, right_path, ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), right_path,
subtree_index); subtree_index);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -2103,14 +2104,14 @@ static int ocfs2_rotate_subtree_right(struct inode *inode,
} }
for(i = subtree_index + 1; i < path_num_items(right_path); i++) { for(i = subtree_index + 1; i < path_num_items(right_path); i++) {
ret = ocfs2_path_bh_journal_access(handle, inode, ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode),
right_path, i); right_path, i);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
} }
ret = ocfs2_path_bh_journal_access(handle, inode, ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode),
left_path, i); left_path, i);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -2503,7 +2504,7 @@ static int ocfs2_update_edge_lengths(struct inode *inode, handle_t *handle,
goto out; goto out;
} }
ret = ocfs2_journal_access_path(inode, handle, path); ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, path);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
@ -2654,7 +2655,7 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,
return -EAGAIN; return -EAGAIN;
if (le16_to_cpu(right_leaf_el->l_next_free_rec) > 1) { if (le16_to_cpu(right_leaf_el->l_next_free_rec) > 1) {
ret = ocfs2_journal_access_eb(handle, inode, ret = ocfs2_journal_access_eb(handle, INODE_CACHE(inode),
path_leaf_bh(right_path), path_leaf_bh(right_path),
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
@ -2673,7 +2674,7 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,
* We have to update i_last_eb_blk during the meta * We have to update i_last_eb_blk during the meta
* data delete. * data delete.
*/ */
ret = ocfs2_et_root_journal_access(handle, inode, et, ret = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -2689,7 +2690,7 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,
*/ */
BUG_ON(right_has_empty && !del_right_subtree); BUG_ON(right_has_empty && !del_right_subtree);
ret = ocfs2_path_bh_journal_access(handle, inode, right_path, ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), right_path,
subtree_index); subtree_index);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -2697,14 +2698,14 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,
} }
for(i = subtree_index + 1; i < path_num_items(right_path); i++) { for(i = subtree_index + 1; i < path_num_items(right_path); i++) {
ret = ocfs2_path_bh_journal_access(handle, inode, ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode),
right_path, i); right_path, i);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
} }
ret = ocfs2_path_bh_journal_access(handle, inode, ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode),
left_path, i); left_path, i);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -2864,7 +2865,7 @@ static int ocfs2_rotate_rightmost_leaf_left(struct inode *inode,
if (!ocfs2_is_empty_extent(&el->l_recs[0])) if (!ocfs2_is_empty_extent(&el->l_recs[0]))
return 0; return 0;
ret = ocfs2_path_bh_journal_access(handle, inode, path, ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), path,
path_num_items(path) - 1); path_num_items(path) - 1);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -2947,7 +2948,7 @@ static int __ocfs2_rotate_tree_left(struct inode *inode,
* Caller might still want to make changes to the * Caller might still want to make changes to the
* tree root, so re-add it to the journal here. * tree root, so re-add it to the journal here.
*/ */
ret = ocfs2_path_bh_journal_access(handle, inode, ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode),
left_path, 0); left_path, 0);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -3025,7 +3026,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle,
goto out; goto out;
} }
ret = ocfs2_journal_access_path(inode, handle, path); ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, path);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
@ -3055,7 +3056,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle,
goto out; goto out;
} }
ret = ocfs2_journal_access_path(inode, handle, left_path); ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, left_path);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
@ -3370,7 +3371,7 @@ static int ocfs2_merge_rec_right(struct inode *inode,
root_bh = left_path->p_node[subtree_index].bh; root_bh = left_path->p_node[subtree_index].bh;
BUG_ON(root_bh != right_path->p_node[subtree_index].bh); BUG_ON(root_bh != right_path->p_node[subtree_index].bh);
ret = ocfs2_path_bh_journal_access(handle, inode, right_path, ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), right_path,
subtree_index); subtree_index);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -3379,14 +3380,14 @@ static int ocfs2_merge_rec_right(struct inode *inode,
for (i = subtree_index + 1; for (i = subtree_index + 1;
i < path_num_items(right_path); i++) { i < path_num_items(right_path); i++) {
ret = ocfs2_path_bh_journal_access(handle, inode, ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode),
right_path, i); right_path, i);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
} }
ret = ocfs2_path_bh_journal_access(handle, inode, ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode),
left_path, i); left_path, i);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -3399,7 +3400,7 @@ static int ocfs2_merge_rec_right(struct inode *inode,
right_rec = &el->l_recs[index + 1]; right_rec = &el->l_recs[index + 1];
} }
ret = ocfs2_path_bh_journal_access(handle, inode, left_path, ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), left_path,
path_num_items(left_path) - 1); path_num_items(left_path) - 1);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -3539,7 +3540,7 @@ static int ocfs2_merge_rec_left(struct inode *inode,
root_bh = left_path->p_node[subtree_index].bh; root_bh = left_path->p_node[subtree_index].bh;
BUG_ON(root_bh != right_path->p_node[subtree_index].bh); BUG_ON(root_bh != right_path->p_node[subtree_index].bh);
ret = ocfs2_path_bh_journal_access(handle, inode, right_path, ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), right_path,
subtree_index); subtree_index);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -3548,14 +3549,14 @@ static int ocfs2_merge_rec_left(struct inode *inode,
for (i = subtree_index + 1; for (i = subtree_index + 1;
i < path_num_items(right_path); i++) { i < path_num_items(right_path); i++) {
ret = ocfs2_path_bh_journal_access(handle, inode, ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode),
right_path, i); right_path, i);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
} }
ret = ocfs2_path_bh_journal_access(handle, inode, ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode),
left_path, i); left_path, i);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -3568,7 +3569,7 @@ static int ocfs2_merge_rec_left(struct inode *inode,
has_empty_extent = 1; has_empty_extent = 1;
} }
ret = ocfs2_path_bh_journal_access(handle, inode, right_path, ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), right_path,
path_num_items(right_path) - 1); path_num_items(right_path) - 1);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -4006,7 +4007,7 @@ static int ocfs2_append_rec_to_path(struct inode *inode, handle_t *handle,
} }
} }
ret = ocfs2_journal_access_path(inode, handle, right_path); ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, right_path);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
@ -4135,7 +4136,7 @@ static int ocfs2_insert_path(struct inode *inode,
goto out; goto out;
} }
ret = ocfs2_journal_access_path(inode, handle, left_path); ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, left_path);
if (ret < 0) { if (ret < 0) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
@ -4146,7 +4147,7 @@ static int ocfs2_insert_path(struct inode *inode,
* Pass both paths to the journal. The majority of inserts * Pass both paths to the journal. The majority of inserts
* will be touching all components anyway. * will be touching all components anyway.
*/ */
ret = ocfs2_journal_access_path(inode, handle, right_path); ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, right_path);
if (ret < 0) { if (ret < 0) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
@ -4211,7 +4212,7 @@ static int ocfs2_do_insert_extent(struct inode *inode,
el = et->et_root_el; el = et->et_root_el;
ret = ocfs2_et_root_journal_access(handle, inode, et, ret = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -4273,7 +4274,7 @@ static int ocfs2_do_insert_extent(struct inode *inode,
* ocfs2_rotate_tree_right() might have extended the * ocfs2_rotate_tree_right() might have extended the
* transaction without re-journaling our tree root. * transaction without re-journaling our tree root.
*/ */
ret = ocfs2_et_root_journal_access(handle, inode, et, ret = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -4796,7 +4797,7 @@ int ocfs2_add_clusters_in_btree(struct ocfs2_super *osb,
BUG_ON(num_bits > clusters_to_add); BUG_ON(num_bits > clusters_to_add);
/* reserve our write early -- insert_extent may update the tree root */ /* reserve our write early -- insert_extent may update the tree root */
status = ocfs2_et_root_journal_access(handle, inode, et, status = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -4971,7 +4972,7 @@ static int ocfs2_replace_extent_rec(struct inode *inode,
{ {
int ret; int ret;
ret = ocfs2_path_bh_journal_access(handle, inode, path, ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), path,
path_num_items(path) - 1); path_num_items(path) - 1);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -5333,13 +5334,13 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,
goto out; goto out;
} }
ret = ocfs2_journal_access_path(inode, handle, path); ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, path);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
} }
ret = ocfs2_journal_access_path(inode, handle, left_path); ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, left_path);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
@ -5574,7 +5575,7 @@ int ocfs2_remove_btree_range(struct inode *inode,
goto out; goto out;
} }
ret = ocfs2_et_root_journal_access(handle, inode, et, ret = ocfs2_et_root_journal_access(handle, INODE_CACHE(inode), et,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -5691,7 +5692,7 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb,
goto bail; goto bail;
} }
status = ocfs2_journal_access_di(handle, tl_inode, tl_bh, status = ocfs2_journal_access_di(handle, INODE_CACHE(tl_inode), tl_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -5753,7 +5754,7 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb,
while (i >= 0) { while (i >= 0) {
/* Caller has given us at least enough credits to /* Caller has given us at least enough credits to
* update the truncate log dinode */ * update the truncate log dinode */
status = ocfs2_journal_access_di(handle, tl_inode, tl_bh, status = ocfs2_journal_access_di(handle, INODE_CACHE(tl_inode), tl_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -6770,14 +6771,14 @@ static int ocfs2_do_truncate(struct ocfs2_super *osb,
* Each component will be touched, so we might as well journal * Each component will be touched, so we might as well journal
* here to avoid having to handle errors later. * here to avoid having to handle errors later.
*/ */
status = ocfs2_journal_access_path(inode, handle, path); status = ocfs2_journal_access_path(INODE_CACHE(inode), handle, path);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail; goto bail;
} }
if (last_eb_bh) { if (last_eb_bh) {
status = ocfs2_journal_access_eb(handle, inode, last_eb_bh, status = ocfs2_journal_access_eb(handle, INODE_CACHE(inode), last_eb_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -7139,7 +7140,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,
goto out_unlock; goto out_unlock;
} }
ret = ocfs2_journal_access_di(handle, inode, di_bh, ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -7508,7 +7509,7 @@ int ocfs2_truncate_inline(struct inode *inode, struct buffer_head *di_bh,
goto out; goto out;
} }
ret = ocfs2_journal_access_di(handle, inode, di_bh, ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);

View File

@ -1528,7 +1528,7 @@ static int ocfs2_write_begin_inline(struct address_space *mapping,
goto out; goto out;
} }
ret = ocfs2_journal_access_di(handle, inode, wc->w_di_bh, ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), wc->w_di_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
ocfs2_commit_trans(osb, handle); ocfs2_commit_trans(osb, handle);
@ -1773,7 +1773,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping,
* We don't want this to fail in ocfs2_write_end(), so do it * We don't want this to fail in ocfs2_write_end(), so do it
* here. * here.
*/ */
ret = ocfs2_journal_access_di(handle, inode, wc->w_di_bh, ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), wc->w_di_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);

View File

@ -176,7 +176,7 @@ static int ocfs2_dx_dir_link_trailer(struct inode *dir, handle_t *handle,
struct ocfs2_dx_root_block *dx_root; struct ocfs2_dx_root_block *dx_root;
struct ocfs2_dir_block_trailer *trailer; struct ocfs2_dir_block_trailer *trailer;
ret = ocfs2_journal_access_dr(handle, dir, dx_root_bh, ret = ocfs2_journal_access_dr(handle, INODE_CACHE(dir), dx_root_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -1136,7 +1136,8 @@ int ocfs2_update_entry(struct inode *dir, handle_t *handle,
if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL) if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
access = ocfs2_journal_access_di; access = ocfs2_journal_access_di;
ret = access(handle, dir, de_bh, OCFS2_JOURNAL_ACCESS_WRITE); ret = access(handle, INODE_CACHE(dir), de_bh,
OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
@ -1179,7 +1180,7 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir,
goto bail; goto bail;
} }
if (de == de_del) { if (de == de_del) {
status = access(handle, dir, bh, status = access(handle, INODE_CACHE(dir), bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
status = -EIO; status = -EIO;
@ -1329,7 +1330,7 @@ static int ocfs2_delete_entry_dx(handle_t *handle, struct inode *dir,
* the entry count needs to be updated. Also, we might be * the entry count needs to be updated. Also, we might be
* adding to the start of the free list. * adding to the start of the free list.
*/ */
ret = ocfs2_journal_access_dr(handle, dir, dx_root_bh, ret = ocfs2_journal_access_dr(handle, INODE_CACHE(dir), dx_root_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -1337,7 +1338,7 @@ static int ocfs2_delete_entry_dx(handle_t *handle, struct inode *dir,
} }
if (!ocfs2_dx_root_inline(dx_root)) { if (!ocfs2_dx_root_inline(dx_root)) {
ret = ocfs2_journal_access_dl(handle, dir, ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir),
lookup->dl_dx_leaf_bh, lookup->dl_dx_leaf_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
@ -1496,7 +1497,7 @@ static int __ocfs2_dx_dir_leaf_insert(struct inode *dir, handle_t *handle,
int ret; int ret;
struct ocfs2_dx_leaf *dx_leaf; struct ocfs2_dx_leaf *dx_leaf;
ret = ocfs2_journal_access_dl(handle, dir, dx_leaf_bh, ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), dx_leaf_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -1526,7 +1527,7 @@ static int ocfs2_dx_dir_insert(struct inode *dir, handle_t *handle,
struct ocfs2_dx_root_block *dx_root; struct ocfs2_dx_root_block *dx_root;
struct buffer_head *dx_root_bh = lookup->dl_dx_root_bh; struct buffer_head *dx_root_bh = lookup->dl_dx_root_bh;
ret = ocfs2_journal_access_dr(handle, dir, dx_root_bh, ret = ocfs2_journal_access_dr(handle, INODE_CACHE(dir), dx_root_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -1648,11 +1649,13 @@ int __ocfs2_add_entry(handle_t *handle,
*/ */
if (ocfs2_free_list_at_root(lookup)) { if (ocfs2_free_list_at_root(lookup)) {
bh = lookup->dl_dx_root_bh; bh = lookup->dl_dx_root_bh;
retval = ocfs2_journal_access_dr(handle, dir, bh, retval = ocfs2_journal_access_dr(handle,
INODE_CACHE(dir), bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
} else { } else {
bh = lookup->dl_prev_leaf_bh; bh = lookup->dl_prev_leaf_bh;
retval = ocfs2_journal_access_db(handle, dir, bh, retval = ocfs2_journal_access_db(handle,
INODE_CACHE(dir), bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
} }
if (retval) { if (retval) {
@ -1703,11 +1706,13 @@ int __ocfs2_add_entry(handle_t *handle,
} }
if (insert_bh == parent_fe_bh) if (insert_bh == parent_fe_bh)
status = ocfs2_journal_access_di(handle, dir, status = ocfs2_journal_access_di(handle,
INODE_CACHE(dir),
insert_bh, insert_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
else { else {
status = ocfs2_journal_access_db(handle, dir, status = ocfs2_journal_access_db(handle,
INODE_CACHE(dir),
insert_bh, insert_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
@ -2283,7 +2288,7 @@ static int ocfs2_fill_new_dir_id(struct ocfs2_super *osb,
struct ocfs2_inline_data *data = &di->id2.i_data; struct ocfs2_inline_data *data = &di->id2.i_data;
unsigned int size = le16_to_cpu(data->id_count); unsigned int size = le16_to_cpu(data->id_count);
ret = ocfs2_journal_access_di(handle, inode, di_bh, ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -2337,7 +2342,7 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb,
ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), new_bh); ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), new_bh);
status = ocfs2_journal_access_db(handle, inode, new_bh, status = ocfs2_journal_access_db(handle, INODE_CACHE(inode), new_bh,
OCFS2_JOURNAL_ACCESS_CREATE); OCFS2_JOURNAL_ACCESS_CREATE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -2423,7 +2428,7 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb,
} }
ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), dx_root_bh); ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), dx_root_bh);
ret = ocfs2_journal_access_dr(handle, dir, dx_root_bh, ret = ocfs2_journal_access_dr(handle, INODE_CACHE(dir), dx_root_bh,
OCFS2_JOURNAL_ACCESS_CREATE); OCFS2_JOURNAL_ACCESS_CREATE);
if (ret < 0) { if (ret < 0) {
mlog_errno(ret); mlog_errno(ret);
@ -2457,7 +2462,7 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb,
if (ret) if (ret)
mlog_errno(ret); mlog_errno(ret);
ret = ocfs2_journal_access_di(handle, dir, di_bh, ret = ocfs2_journal_access_di(handle, INODE_CACHE(dir), di_bh,
OCFS2_JOURNAL_ACCESS_CREATE); OCFS2_JOURNAL_ACCESS_CREATE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -2500,7 +2505,7 @@ static int ocfs2_dx_dir_format_cluster(struct ocfs2_super *osb,
ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), bh); ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), bh);
ret = ocfs2_journal_access_dl(handle, dir, bh, ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), bh,
OCFS2_JOURNAL_ACCESS_CREATE); OCFS2_JOURNAL_ACCESS_CREATE);
if (ret < 0) { if (ret < 0) {
mlog_errno(ret); mlog_errno(ret);
@ -3010,7 +3015,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), dirdata_bh); ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), dirdata_bh);
ret = ocfs2_journal_access_db(handle, dir, dirdata_bh, ret = ocfs2_journal_access_db(handle, INODE_CACHE(dir), dirdata_bh,
OCFS2_JOURNAL_ACCESS_CREATE); OCFS2_JOURNAL_ACCESS_CREATE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -3063,7 +3068,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
* We let the later dirent insert modify c/mtime - to the user * We let the later dirent insert modify c/mtime - to the user
* the data hasn't changed. * the data hasn't changed.
*/ */
ret = ocfs2_journal_access_di(handle, dir, di_bh, ret = ocfs2_journal_access_di(handle, INODE_CACHE(dir), di_bh,
OCFS2_JOURNAL_ACCESS_CREATE); OCFS2_JOURNAL_ACCESS_CREATE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -3392,7 +3397,7 @@ do_extend:
ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), new_bh); ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), new_bh);
status = ocfs2_journal_access_db(handle, dir, new_bh, status = ocfs2_journal_access_db(handle, INODE_CACHE(dir), new_bh,
OCFS2_JOURNAL_ACCESS_CREATE); OCFS2_JOURNAL_ACCESS_CREATE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -3888,7 +3893,7 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir,
} }
did_quota = 1; did_quota = 1;
ret = ocfs2_journal_access_dl(handle, dir, dx_leaf_bh, ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), dx_leaf_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -3952,7 +3957,8 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir,
} }
for (i = 0; i < num_dx_leaves; i++) { for (i = 0; i < num_dx_leaves; i++) {
ret = ocfs2_journal_access_dl(handle, dir, orig_dx_leaves[i], ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir),
orig_dx_leaves[i],
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -4168,7 +4174,7 @@ static int ocfs2_expand_inline_dx_root(struct inode *dir,
* failure to add the dx_root_bh to the journal won't result * failure to add the dx_root_bh to the journal won't result
* us losing clusters. * us losing clusters.
*/ */
ret = ocfs2_journal_access_dr(handle, dir, dx_root_bh, ret = ocfs2_journal_access_dr(handle, INODE_CACHE(dir), dx_root_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -4472,7 +4478,7 @@ static int ocfs2_dx_dir_remove_index(struct inode *dir,
goto out_unlock; goto out_unlock;
} }
ret = ocfs2_journal_access_di(handle, dir, di_bh, ret = ocfs2_journal_access_di(handle, INODE_CACHE(dir), di_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);

View File

@ -3499,7 +3499,7 @@ static int ocfs2_check_meta_downconvert(struct ocfs2_lock_res *lockres,
int new_level) int new_level)
{ {
struct inode *inode = ocfs2_lock_res_inode(lockres); struct inode *inode = ocfs2_lock_res_inode(lockres);
int checkpointed = ocfs2_inode_fully_checkpointed(inode); int checkpointed = ocfs2_ci_fully_checkpointed(INODE_CACHE(inode));
BUG_ON(new_level != DLM_LOCK_NL && new_level != DLM_LOCK_PR); BUG_ON(new_level != DLM_LOCK_NL && new_level != DLM_LOCK_PR);
BUG_ON(lockres->l_level != DLM_LOCK_EX && !checkpointed); BUG_ON(lockres->l_level != DLM_LOCK_EX && !checkpointed);

View File

@ -259,7 +259,7 @@ int ocfs2_update_inode_atime(struct inode *inode,
goto out; goto out;
} }
ret = ocfs2_journal_access_di(handle, inode, bh, ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -356,7 +356,7 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb,
goto out; goto out;
} }
status = ocfs2_journal_access_di(handle, inode, fe_bh, status = ocfs2_journal_access_di(handle, INODE_CACHE(inode), fe_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -593,7 +593,7 @@ restarted_transaction:
/* reserve a write to the file entry early on - that we if we /* reserve a write to the file entry early on - that we if we
* run out of credits in the allocation path, we can still * run out of credits in the allocation path, we can still
* update i_size. */ * update i_size. */
status = ocfs2_journal_access_di(handle, inode, bh, status = ocfs2_journal_access_di(handle, INODE_CACHE(inode), bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -1131,7 +1131,7 @@ static int __ocfs2_write_remove_suid(struct inode *inode,
goto out; goto out;
} }
ret = ocfs2_journal_access_di(handle, inode, bh, ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret < 0) { if (ret < 0) {
mlog_errno(ret); mlog_errno(ret);

View File

@ -562,7 +562,8 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb,
goto out; goto out;
} }
status = ocfs2_journal_access_di(handle, inode, fe_bh, status = ocfs2_journal_access_di(handle, INODE_CACHE(inode),
fe_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -646,7 +647,7 @@ static int ocfs2_remove_inode(struct inode *inode,
} }
/* set the inodes dtime */ /* set the inodes dtime */
status = ocfs2_journal_access_di(handle, inode, di_bh, status = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -1238,7 +1239,7 @@ int ocfs2_mark_inode_dirty(handle_t *handle,
mlog_entry("(inode %llu)\n", mlog_entry("(inode %llu)\n",
(unsigned long long)OCFS2_I(inode)->ip_blkno); (unsigned long long)OCFS2_I(inode)->ip_blkno);
status = ocfs2_journal_access_di(handle, inode, bh, status = ocfs2_journal_access_di(handle, INODE_CACHE(inode), bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);

View File

@ -48,6 +48,7 @@
#include "slot_map.h" #include "slot_map.h"
#include "super.h" #include "super.h"
#include "sysfile.h" #include "sysfile.h"
#include "uptodate.h"
#include "quota.h" #include "quota.h"
#include "buffer_head_io.h" #include "buffer_head_io.h"
@ -601,14 +602,16 @@ static struct ocfs2_triggers dl_triggers = {
}; };
static int __ocfs2_journal_access(handle_t *handle, static int __ocfs2_journal_access(handle_t *handle,
struct inode *inode, struct ocfs2_caching_info *ci,
struct buffer_head *bh, struct buffer_head *bh,
struct ocfs2_triggers *triggers, struct ocfs2_triggers *triggers,
int type) int type)
{ {
int status; int status;
struct ocfs2_super *osb =
OCFS2_SB(ocfs2_metadata_cache_get_super(ci));
BUG_ON(!inode); BUG_ON(!ci || !ci->ci_ops);
BUG_ON(!handle); BUG_ON(!handle);
BUG_ON(!bh); BUG_ON(!bh);
@ -627,15 +630,15 @@ static int __ocfs2_journal_access(handle_t *handle,
BUG(); BUG();
} }
/* Set the current transaction information on the inode so /* Set the current transaction information on the ci so
* that the locking code knows whether it can drop it's locks * that the locking code knows whether it can drop it's locks
* on this inode or not. We're protected from the commit * on this ci or not. We're protected from the commit
* thread updating the current transaction id until * thread updating the current transaction id until
* ocfs2_commit_trans() because ocfs2_start_trans() took * ocfs2_commit_trans() because ocfs2_start_trans() took
* j_trans_barrier for us. */ * j_trans_barrier for us. */
ocfs2_set_inode_lock_trans(OCFS2_SB(inode->i_sb)->journal, inode); ocfs2_set_ci_lock_trans(osb->journal, ci);
mutex_lock(&OCFS2_I(inode)->ip_io_mutex); ocfs2_metadata_cache_io_lock(ci);
switch (type) { switch (type) {
case OCFS2_JOURNAL_ACCESS_CREATE: case OCFS2_JOURNAL_ACCESS_CREATE:
case OCFS2_JOURNAL_ACCESS_WRITE: case OCFS2_JOURNAL_ACCESS_WRITE:
@ -650,9 +653,9 @@ static int __ocfs2_journal_access(handle_t *handle,
status = -EINVAL; status = -EINVAL;
mlog(ML_ERROR, "Uknown access type!\n"); mlog(ML_ERROR, "Uknown access type!\n");
} }
if (!status && ocfs2_meta_ecc(OCFS2_SB(inode->i_sb)) && triggers) if (!status && ocfs2_meta_ecc(osb) && triggers)
jbd2_journal_set_triggers(bh, &triggers->ot_triggers); jbd2_journal_set_triggers(bh, &triggers->ot_triggers);
mutex_unlock(&OCFS2_I(inode)->ip_io_mutex); ocfs2_metadata_cache_io_unlock(ci);
if (status < 0) if (status < 0)
mlog(ML_ERROR, "Error %d getting %d access to buffer!\n", mlog(ML_ERROR, "Error %d getting %d access to buffer!\n",
@ -662,66 +665,58 @@ static int __ocfs2_journal_access(handle_t *handle,
return status; return status;
} }
int ocfs2_journal_access_di(handle_t *handle, struct inode *inode, int ocfs2_journal_access_di(handle_t *handle, struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type)
{
return __ocfs2_journal_access(handle, inode, bh, &di_triggers,
type);
}
int ocfs2_journal_access_eb(handle_t *handle, struct inode *inode,
struct buffer_head *bh, int type) struct buffer_head *bh, int type)
{ {
return __ocfs2_journal_access(handle, inode, bh, &eb_triggers, return __ocfs2_journal_access(handle, ci, bh, &di_triggers, type);
type);
} }
int ocfs2_journal_access_gd(handle_t *handle, struct inode *inode, int ocfs2_journal_access_eb(handle_t *handle, struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type) struct buffer_head *bh, int type)
{ {
return __ocfs2_journal_access(handle, inode, bh, &gd_triggers, return __ocfs2_journal_access(handle, ci, bh, &eb_triggers, type);
type);
} }
int ocfs2_journal_access_db(handle_t *handle, struct inode *inode, int ocfs2_journal_access_gd(handle_t *handle, struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type) struct buffer_head *bh, int type)
{ {
return __ocfs2_journal_access(handle, inode, bh, &db_triggers, return __ocfs2_journal_access(handle, ci, bh, &gd_triggers, type);
type);
} }
int ocfs2_journal_access_xb(handle_t *handle, struct inode *inode, int ocfs2_journal_access_db(handle_t *handle, struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type) struct buffer_head *bh, int type)
{ {
return __ocfs2_journal_access(handle, inode, bh, &xb_triggers, return __ocfs2_journal_access(handle, ci, bh, &db_triggers, type);
type);
} }
int ocfs2_journal_access_dq(handle_t *handle, struct inode *inode, int ocfs2_journal_access_xb(handle_t *handle, struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type) struct buffer_head *bh, int type)
{ {
return __ocfs2_journal_access(handle, inode, bh, &dq_triggers, return __ocfs2_journal_access(handle, ci, bh, &xb_triggers, type);
type);
} }
int ocfs2_journal_access_dr(handle_t *handle, struct inode *inode, int ocfs2_journal_access_dq(handle_t *handle, struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type) struct buffer_head *bh, int type)
{ {
return __ocfs2_journal_access(handle, inode, bh, &dr_triggers, return __ocfs2_journal_access(handle, ci, bh, &dq_triggers, type);
type);
} }
int ocfs2_journal_access_dl(handle_t *handle, struct inode *inode, int ocfs2_journal_access_dr(handle_t *handle, struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type) struct buffer_head *bh, int type)
{ {
return __ocfs2_journal_access(handle, inode, bh, &dl_triggers, return __ocfs2_journal_access(handle, ci, bh, &dr_triggers, type);
type);
} }
int ocfs2_journal_access(handle_t *handle, struct inode *inode, int ocfs2_journal_access_dl(handle_t *handle, struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type)
{
return __ocfs2_journal_access(handle, ci, bh, &dl_triggers, type);
}
int ocfs2_journal_access(handle_t *handle, struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type) struct buffer_head *bh, int type)
{ {
return __ocfs2_journal_access(handle, inode, bh, NULL, type); return __ocfs2_journal_access(handle, ci, bh, NULL, type);
} }
int ocfs2_journal_dirty(handle_t *handle, int ocfs2_journal_dirty(handle_t *handle,

View File

@ -90,57 +90,66 @@ static inline unsigned long ocfs2_inc_trans_id(struct ocfs2_journal *j)
return old_id; return old_id;
} }
static inline void ocfs2_set_inode_lock_trans(struct ocfs2_journal *journal, static inline void ocfs2_set_ci_lock_trans(struct ocfs2_journal *journal,
struct inode *inode) struct ocfs2_caching_info *ci)
{ {
spin_lock(&trans_inc_lock); spin_lock(&trans_inc_lock);
INODE_CACHE(inode)->ci_last_trans = journal->j_trans_id; ci->ci_last_trans = journal->j_trans_id;
spin_unlock(&trans_inc_lock); spin_unlock(&trans_inc_lock);
} }
/* Used to figure out whether it's safe to drop a metadata lock on an /* Used to figure out whether it's safe to drop a metadata lock on an
* inode. Returns true if all the inodes changes have been * cached object. Returns true if all the object's changes have been
* checkpointed to disk. You should be holding the spinlock on the * checkpointed to disk. You should be holding the spinlock on the
* metadata lock while calling this to be sure that nobody can take * metadata lock while calling this to be sure that nobody can take
* the lock and put it on another transaction. */ * the lock and put it on another transaction. */
static inline int ocfs2_inode_fully_checkpointed(struct inode *inode) static inline int ocfs2_ci_fully_checkpointed(struct ocfs2_caching_info *ci)
{ {
int ret; int ret;
struct ocfs2_journal *journal = OCFS2_SB(inode->i_sb)->journal; struct ocfs2_journal *journal =
OCFS2_SB(ocfs2_metadata_cache_get_super(ci))->journal;
spin_lock(&trans_inc_lock); spin_lock(&trans_inc_lock);
ret = time_after(journal->j_trans_id, ret = time_after(journal->j_trans_id, ci->ci_last_trans);
INODE_CACHE(inode)->ci_last_trans);
spin_unlock(&trans_inc_lock); spin_unlock(&trans_inc_lock);
return ret; return ret;
} }
/* convenience function to check if an inode is still new (has never /* convenience function to check if an object backed by struct
* hit disk) Will do you a favor and set created_trans = 0 when you've * ocfs2_caching_info is still new (has never hit disk) Will do you a
* been checkpointed. returns '1' if the inode is still new. */ * favor and set created_trans = 0 when you've
static inline int ocfs2_inode_is_new(struct inode *inode) * been checkpointed. returns '1' if the ci is still new. */
static inline int ocfs2_ci_is_new(struct ocfs2_caching_info *ci)
{ {
int ret; int ret;
struct ocfs2_journal *journal =
OCFS2_SB(ocfs2_metadata_cache_get_super(ci))->journal;
spin_lock(&trans_inc_lock);
ret = !(time_after(journal->j_trans_id, ci->ci_created_trans));
if (!ret)
ci->ci_created_trans = 0;
spin_unlock(&trans_inc_lock);
return ret;
}
/* Wrapper for inodes so we can check system files */
static inline int ocfs2_inode_is_new(struct inode *inode)
{
/* System files are never "new" as they're written out by /* System files are never "new" as they're written out by
* mkfs. This helps us early during mount, before we have the * mkfs. This helps us early during mount, before we have the
* journal open and j_trans_id could be junk. */ * journal open and j_trans_id could be junk. */
if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SYSTEM_FILE) if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SYSTEM_FILE)
return 0; return 0;
spin_lock(&trans_inc_lock);
ret = !(time_after(OCFS2_SB(inode->i_sb)->journal->j_trans_id, return ocfs2_ci_is_new(INODE_CACHE(inode));
INODE_CACHE(inode)->ci_created_trans));
if (!ret)
INODE_CACHE(inode)->ci_created_trans = 0;
spin_unlock(&trans_inc_lock);
return ret;
} }
static inline void ocfs2_inode_set_new(struct ocfs2_super *osb, static inline void ocfs2_ci_set_new(struct ocfs2_super *osb,
struct inode *inode) struct ocfs2_caching_info *ci)
{ {
spin_lock(&trans_inc_lock); spin_lock(&trans_inc_lock);
INODE_CACHE(inode)->ci_created_trans = osb->journal->j_trans_id; ci->ci_created_trans = osb->journal->j_trans_id;
spin_unlock(&trans_inc_lock); spin_unlock(&trans_inc_lock);
} }
@ -201,7 +210,7 @@ static inline void ocfs2_checkpoint_inode(struct inode *inode)
if (ocfs2_mount_local(osb)) if (ocfs2_mount_local(osb))
return; return;
if (!ocfs2_inode_fully_checkpointed(inode)) { if (!ocfs2_ci_fully_checkpointed(INODE_CACHE(inode))) {
/* WARNING: This only kicks off a single /* WARNING: This only kicks off a single
* checkpoint. If someone races you and adds more * checkpoint. If someone races you and adds more
* metadata to the journal, you won't know, and will * metadata to the journal, you won't know, and will
@ -211,7 +220,7 @@ static inline void ocfs2_checkpoint_inode(struct inode *inode)
ocfs2_start_checkpoint(osb); ocfs2_start_checkpoint(osb);
wait_event(osb->journal->j_checkpointed, wait_event(osb->journal->j_checkpointed,
ocfs2_inode_fully_checkpointed(inode)); ocfs2_ci_fully_checkpointed(INODE_CACHE(inode)));
} }
} }
@ -267,31 +276,31 @@ int ocfs2_extend_trans(handle_t *handle, int nblocks);
/* ocfs2_inode */ /* ocfs2_inode */
int ocfs2_journal_access_di(handle_t *handle, struct inode *inode, int ocfs2_journal_access_di(handle_t *handle, struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type); struct buffer_head *bh, int type);
/* ocfs2_extent_block */ /* ocfs2_extent_block */
int ocfs2_journal_access_eb(handle_t *handle, struct inode *inode, int ocfs2_journal_access_eb(handle_t *handle, struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type); struct buffer_head *bh, int type);
/* ocfs2_group_desc */ /* ocfs2_group_desc */
int ocfs2_journal_access_gd(handle_t *handle, struct inode *inode, int ocfs2_journal_access_gd(handle_t *handle, struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type); struct buffer_head *bh, int type);
/* ocfs2_xattr_block */ /* ocfs2_xattr_block */
int ocfs2_journal_access_xb(handle_t *handle, struct inode *inode, int ocfs2_journal_access_xb(handle_t *handle, struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type); struct buffer_head *bh, int type);
/* quota blocks */ /* quota blocks */
int ocfs2_journal_access_dq(handle_t *handle, struct inode *inode, int ocfs2_journal_access_dq(handle_t *handle, struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type); struct buffer_head *bh, int type);
/* dirblock */ /* dirblock */
int ocfs2_journal_access_db(handle_t *handle, struct inode *inode, int ocfs2_journal_access_db(handle_t *handle, struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type); struct buffer_head *bh, int type);
/* ocfs2_dx_root_block */ /* ocfs2_dx_root_block */
int ocfs2_journal_access_dr(handle_t *handle, struct inode *inode, int ocfs2_journal_access_dr(handle_t *handle, struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type); struct buffer_head *bh, int type);
/* ocfs2_dx_leaf */ /* ocfs2_dx_leaf */
int ocfs2_journal_access_dl(handle_t *handle, struct inode *inode, int ocfs2_journal_access_dl(handle_t *handle, struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type); struct buffer_head *bh, int type);
/* Anything that has no ecc */ /* Anything that has no ecc */
int ocfs2_journal_access(handle_t *handle, struct inode *inode, int ocfs2_journal_access(handle_t *handle, struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type); struct buffer_head *bh, int type);
/* /*

View File

@ -297,8 +297,8 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
} }
memcpy(alloc_copy, alloc, bh->b_size); memcpy(alloc_copy, alloc, bh->b_size);
status = ocfs2_journal_access_di(handle, local_alloc_inode, bh, status = ocfs2_journal_access_di(handle, INODE_CACHE(local_alloc_inode),
OCFS2_JOURNAL_ACCESS_WRITE); bh, OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto out_commit; goto out_commit;
@ -678,7 +678,8 @@ int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb,
* delete bits from it! */ * delete bits from it! */
*num_bits = bits_wanted; *num_bits = bits_wanted;
status = ocfs2_journal_access_di(handle, local_alloc_inode, status = ocfs2_journal_access_di(handle,
INODE_CACHE(local_alloc_inode),
osb->local_alloc_bh, osb->local_alloc_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
@ -1156,7 +1157,8 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
} }
memcpy(alloc_copy, alloc, osb->local_alloc_bh->b_size); memcpy(alloc_copy, alloc, osb->local_alloc_bh->b_size);
status = ocfs2_journal_access_di(handle, local_alloc_inode, status = ocfs2_journal_access_di(handle,
INODE_CACHE(local_alloc_inode),
osb->local_alloc_bh, osb->local_alloc_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {

View File

@ -375,7 +375,8 @@ static int ocfs2_mknod(struct inode *dir,
goto leave; goto leave;
} }
status = ocfs2_journal_access_di(handle, dir, parent_fe_bh, status = ocfs2_journal_access_di(handle, INODE_CACHE(dir),
parent_fe_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -509,7 +510,8 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
} }
ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), *new_fe_bh); ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), *new_fe_bh);
status = ocfs2_journal_access_di(handle, inode, *new_fe_bh, status = ocfs2_journal_access_di(handle, INODE_CACHE(inode),
*new_fe_bh,
OCFS2_JOURNAL_ACCESS_CREATE); OCFS2_JOURNAL_ACCESS_CREATE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -565,7 +567,7 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
} }
ocfs2_populate_inode(inode, fe, 1); ocfs2_populate_inode(inode, fe, 1);
ocfs2_inode_set_new(osb, inode); ocfs2_ci_set_new(osb, INODE_CACHE(inode));
if (!ocfs2_mount_local(osb)) { if (!ocfs2_mount_local(osb)) {
status = ocfs2_create_new_inode_locks(inode); status = ocfs2_create_new_inode_locks(inode);
if (status < 0) if (status < 0)
@ -682,7 +684,7 @@ static int ocfs2_link(struct dentry *old_dentry,
goto out_unlock_inode; goto out_unlock_inode;
} }
err = ocfs2_journal_access_di(handle, inode, fe_bh, err = ocfs2_journal_access_di(handle, INODE_CACHE(inode), fe_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (err < 0) { if (err < 0) {
mlog_errno(err); mlog_errno(err);
@ -866,7 +868,7 @@ static int ocfs2_unlink(struct inode *dir,
goto leave; goto leave;
} }
status = ocfs2_journal_access_di(handle, inode, fe_bh, status = ocfs2_journal_access_di(handle, INODE_CACHE(inode), fe_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -1284,7 +1286,8 @@ static int ocfs2_rename(struct inode *old_dir,
goto bail; goto bail;
} }
} }
status = ocfs2_journal_access_di(handle, new_inode, newfe_bh, status = ocfs2_journal_access_di(handle, INODE_CACHE(new_inode),
newfe_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -1331,7 +1334,8 @@ static int ocfs2_rename(struct inode *old_dir,
old_inode->i_ctime = CURRENT_TIME; old_inode->i_ctime = CURRENT_TIME;
mark_inode_dirty(old_inode); mark_inode_dirty(old_inode);
status = ocfs2_journal_access_di(handle, old_inode, old_inode_bh, status = ocfs2_journal_access_di(handle, INODE_CACHE(old_inode),
old_inode_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status >= 0) { if (status >= 0) {
old_di = (struct ocfs2_dinode *) old_inode_bh->b_data; old_di = (struct ocfs2_dinode *) old_inode_bh->b_data;
@ -1407,9 +1411,10 @@ static int ocfs2_rename(struct inode *old_dir,
(int)old_dir_nlink, old_dir->i_nlink); (int)old_dir_nlink, old_dir->i_nlink);
} else { } else {
struct ocfs2_dinode *fe; struct ocfs2_dinode *fe;
status = ocfs2_journal_access_di(handle, old_dir, status = ocfs2_journal_access_di(handle,
old_dir_bh, INODE_CACHE(old_dir),
OCFS2_JOURNAL_ACCESS_WRITE); old_dir_bh,
OCFS2_JOURNAL_ACCESS_WRITE);
fe = (struct ocfs2_dinode *) old_dir_bh->b_data; fe = (struct ocfs2_dinode *) old_dir_bh->b_data;
ocfs2_set_links_count(fe, old_dir->i_nlink); ocfs2_set_links_count(fe, old_dir->i_nlink);
status = ocfs2_journal_dirty(handle, old_dir_bh); status = ocfs2_journal_dirty(handle, old_dir_bh);
@ -1530,7 +1535,8 @@ static int ocfs2_create_symlink_data(struct ocfs2_super *osb,
ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode),
bhs[virtual]); bhs[virtual]);
status = ocfs2_journal_access(handle, inode, bhs[virtual], status = ocfs2_journal_access(handle, INODE_CACHE(inode),
bhs[virtual],
OCFS2_JOURNAL_ACCESS_CREATE); OCFS2_JOURNAL_ACCESS_CREATE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -1918,7 +1924,9 @@ static int ocfs2_orphan_add(struct ocfs2_super *osb,
goto leave; goto leave;
} }
status = ocfs2_journal_access_di(handle, orphan_dir_inode, orphan_dir_bh, status = ocfs2_journal_access_di(handle,
INODE_CACHE(orphan_dir_inode),
orphan_dir_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -2003,7 +2011,9 @@ int ocfs2_orphan_del(struct ocfs2_super *osb,
goto leave; goto leave;
} }
status = ocfs2_journal_access_di(handle,orphan_dir_inode, orphan_dir_bh, status = ocfs2_journal_access_di(handle,
INODE_CACHE(orphan_dir_inode),
orphan_dir_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);

View File

@ -91,6 +91,11 @@ struct ocfs2_caching_info {
struct rb_root ci_tree; struct rb_root ci_tree;
} ci_cache; } ci_cache;
}; };
/*
* Need this prototype here instead of in uptodate.h because journal.h
* uses it.
*/
struct super_block *ocfs2_metadata_cache_get_super(struct ocfs2_caching_info *ci);
/* this limits us to 256 nodes /* this limits us to 256 nodes
* if we need more, we can do a kmalloc for the map */ * if we need more, we can do a kmalloc for the map */
@ -408,7 +413,8 @@ struct ocfs2_super
#define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info) #define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info)
/* Useful typedef for passing around journal access functions */ /* Useful typedef for passing around journal access functions */
typedef int (*ocfs2_journal_access_func)(handle_t *handle, struct inode *inode, typedef int (*ocfs2_journal_access_func)(handle_t *handle,
struct ocfs2_caching_info *ci,
struct buffer_head *bh, int type); struct buffer_head *bh, int type);
static inline int ocfs2_should_order_data(struct inode *inode) static inline int ocfs2_should_order_data(struct inode *inode)

View File

@ -254,7 +254,8 @@ ssize_t ocfs2_quota_write(struct super_block *sb, int type,
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
unlock_buffer(bh); unlock_buffer(bh);
ocfs2_set_buffer_uptodate(INODE_CACHE(gqinode), bh); ocfs2_set_buffer_uptodate(INODE_CACHE(gqinode), bh);
err = ocfs2_journal_access_dq(handle, gqinode, bh, ja_type); err = ocfs2_journal_access_dq(handle, INODE_CACHE(gqinode), bh,
ja_type);
if (err < 0) { if (err < 0) {
brelse(bh); brelse(bh);
goto out; goto out;

View File

@ -108,7 +108,7 @@ static int ocfs2_modify_bh(struct inode *inode, struct buffer_head *bh,
mlog_errno(status); mlog_errno(status);
return status; return status;
} }
status = ocfs2_journal_access_dq(handle, inode, bh, status = ocfs2_journal_access_dq(handle, INODE_CACHE(inode), bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -510,7 +510,8 @@ static int ocfs2_recover_local_quota_file(struct inode *lqinode,
goto out_commit; goto out_commit;
} }
/* Release local quota file entry */ /* Release local quota file entry */
status = ocfs2_journal_access_dq(handle, lqinode, status = ocfs2_journal_access_dq(handle,
INODE_CACHE(lqinode),
qbh, OCFS2_JOURNAL_ACCESS_WRITE); qbh, OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -619,7 +620,8 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,
mlog_errno(status); mlog_errno(status);
goto out_bh; goto out_bh;
} }
status = ocfs2_journal_access_dq(handle, lqinode, bh, status = ocfs2_journal_access_dq(handle, INODE_CACHE(lqinode),
bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -994,7 +996,7 @@ static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk(
} }
dchunk = (struct ocfs2_local_disk_chunk *)bh->b_data; dchunk = (struct ocfs2_local_disk_chunk *)bh->b_data;
ocfs2_set_new_buffer_uptodate(INODE_CACHE(lqinode), bh); ocfs2_set_new_buffer_uptodate(INODE_CACHE(lqinode), bh);
status = ocfs2_journal_access_dq(handle, lqinode, bh, status = ocfs2_journal_access_dq(handle, INODE_CACHE(lqinode), bh,
OCFS2_JOURNAL_ACCESS_CREATE); OCFS2_JOURNAL_ACCESS_CREATE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -1028,7 +1030,7 @@ static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk(
goto out_trans; goto out_trans;
} }
ocfs2_set_new_buffer_uptodate(INODE_CACHE(lqinode), dbh); ocfs2_set_new_buffer_uptodate(INODE_CACHE(lqinode), dbh);
status = ocfs2_journal_access_dq(handle, lqinode, dbh, status = ocfs2_journal_access_dq(handle, INODE_CACHE(lqinode), dbh,
OCFS2_JOURNAL_ACCESS_CREATE); OCFS2_JOURNAL_ACCESS_CREATE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -1143,7 +1145,7 @@ static struct ocfs2_quota_chunk *ocfs2_extend_local_quota_file(
goto out; goto out;
} }
/* Zero created block */ /* Zero created block */
status = ocfs2_journal_access_dq(handle, lqinode, bh, status = ocfs2_journal_access_dq(handle, INODE_CACHE(lqinode), bh,
OCFS2_JOURNAL_ACCESS_CREATE); OCFS2_JOURNAL_ACCESS_CREATE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -1158,7 +1160,8 @@ static struct ocfs2_quota_chunk *ocfs2_extend_local_quota_file(
goto out_trans; goto out_trans;
} }
/* Update chunk header */ /* Update chunk header */
status = ocfs2_journal_access_dq(handle, lqinode, chunk->qc_headerbh, status = ocfs2_journal_access_dq(handle, INODE_CACHE(lqinode),
chunk->qc_headerbh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -1292,7 +1295,8 @@ static int ocfs2_local_release_dquot(struct dquot *dquot)
goto out; goto out;
} }
status = ocfs2_journal_access_dq(handle, sb_dqopt(sb)->files[type], status = ocfs2_journal_access_dq(handle,
INODE_CACHE(sb_dqopt(sb)->files[type]),
od->dq_chunk->qc_headerbh, OCFS2_JOURNAL_ACCESS_WRITE); od->dq_chunk->qc_headerbh, OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);

View File

@ -106,8 +106,8 @@ static int ocfs2_update_last_group_and_inode(handle_t *handle,
mlog_entry("(new_clusters=%d, first_new_cluster = %u)\n", mlog_entry("(new_clusters=%d, first_new_cluster = %u)\n",
new_clusters, first_new_cluster); new_clusters, first_new_cluster);
ret = ocfs2_journal_access_gd(handle, bm_inode, group_bh, ret = ocfs2_journal_access_gd(handle, INODE_CACHE(bm_inode),
OCFS2_JOURNAL_ACCESS_WRITE); group_bh, OCFS2_JOURNAL_ACCESS_WRITE);
if (ret < 0) { if (ret < 0) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
@ -141,7 +141,7 @@ static int ocfs2_update_last_group_and_inode(handle_t *handle,
} }
/* update the inode accordingly. */ /* update the inode accordingly. */
ret = ocfs2_journal_access_di(handle, bm_inode, bm_bh, ret = ocfs2_journal_access_di(handle, INODE_CACHE(bm_inode), bm_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret < 0) { if (ret < 0) {
mlog_errno(ret); mlog_errno(ret);
@ -536,8 +536,8 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input)
cl = &fe->id2.i_chain; cl = &fe->id2.i_chain;
cr = &cl->cl_recs[input->chain]; cr = &cl->cl_recs[input->chain];
ret = ocfs2_journal_access_gd(handle, main_bm_inode, group_bh, ret = ocfs2_journal_access_gd(handle, INODE_CACHE(main_bm_inode),
OCFS2_JOURNAL_ACCESS_WRITE); group_bh, OCFS2_JOURNAL_ACCESS_WRITE);
if (ret < 0) { if (ret < 0) {
mlog_errno(ret); mlog_errno(ret);
goto out_commit; goto out_commit;
@ -552,8 +552,8 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input)
goto out_commit; goto out_commit;
} }
ret = ocfs2_journal_access_di(handle, main_bm_inode, main_bm_bh, ret = ocfs2_journal_access_di(handle, INODE_CACHE(main_bm_inode),
OCFS2_JOURNAL_ACCESS_WRITE); main_bm_bh, OCFS2_JOURNAL_ACCESS_WRITE);
if (ret < 0) { if (ret < 0) {
mlog_errno(ret); mlog_errno(ret);
goto out_commit; goto out_commit;

View File

@ -352,7 +352,7 @@ static int ocfs2_block_group_fill(handle_t *handle,
} }
status = ocfs2_journal_access_gd(handle, status = ocfs2_journal_access_gd(handle,
alloc_inode, INODE_CACHE(alloc_inode),
bg_bh, bg_bh,
OCFS2_JOURNAL_ACCESS_CREATE); OCFS2_JOURNAL_ACCESS_CREATE);
if (status < 0) { if (status < 0) {
@ -491,7 +491,7 @@ static int ocfs2_block_group_alloc(struct ocfs2_super *osb,
bg = (struct ocfs2_group_desc *) bg_bh->b_data; bg = (struct ocfs2_group_desc *) bg_bh->b_data;
status = ocfs2_journal_access_di(handle, alloc_inode, status = ocfs2_journal_access_di(handle, INODE_CACHE(alloc_inode),
bh, OCFS2_JOURNAL_ACCESS_WRITE); bh, OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -1033,7 +1033,7 @@ static inline int ocfs2_block_group_set_bits(handle_t *handle,
journal_type = OCFS2_JOURNAL_ACCESS_UNDO; journal_type = OCFS2_JOURNAL_ACCESS_UNDO;
status = ocfs2_journal_access_gd(handle, status = ocfs2_journal_access_gd(handle,
alloc_inode, INODE_CACHE(alloc_inode),
group_bh, group_bh,
journal_type); journal_type);
if (status < 0) { if (status < 0) {
@ -1106,7 +1106,8 @@ static int ocfs2_relink_block_group(handle_t *handle,
bg_ptr = le64_to_cpu(bg->bg_next_group); bg_ptr = le64_to_cpu(bg->bg_next_group);
prev_bg_ptr = le64_to_cpu(prev_bg->bg_next_group); prev_bg_ptr = le64_to_cpu(prev_bg->bg_next_group);
status = ocfs2_journal_access_gd(handle, alloc_inode, prev_bg_bh, status = ocfs2_journal_access_gd(handle, INODE_CACHE(alloc_inode),
prev_bg_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -1121,8 +1122,8 @@ static int ocfs2_relink_block_group(handle_t *handle,
goto out_rollback; goto out_rollback;
} }
status = ocfs2_journal_access_gd(handle, alloc_inode, bg_bh, status = ocfs2_journal_access_gd(handle, INODE_CACHE(alloc_inode),
OCFS2_JOURNAL_ACCESS_WRITE); bg_bh, OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto out_rollback; goto out_rollback;
@ -1136,8 +1137,8 @@ static int ocfs2_relink_block_group(handle_t *handle,
goto out_rollback; goto out_rollback;
} }
status = ocfs2_journal_access_di(handle, alloc_inode, fe_bh, status = ocfs2_journal_access_di(handle, INODE_CACHE(alloc_inode),
OCFS2_JOURNAL_ACCESS_WRITE); fe_bh, OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto out_rollback; goto out_rollback;
@ -1288,7 +1289,7 @@ static int ocfs2_alloc_dinode_update_counts(struct inode *inode,
struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data; struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data;
struct ocfs2_chain_list *cl = (struct ocfs2_chain_list *) &di->id2.i_chain; struct ocfs2_chain_list *cl = (struct ocfs2_chain_list *) &di->id2.i_chain;
ret = ocfs2_journal_access_di(handle, inode, di_bh, ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret < 0) { if (ret < 0) {
mlog_errno(ret); mlog_errno(ret);
@ -1461,7 +1462,7 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac,
/* Ok, claim our bits now: set the info on dinode, chainlist /* Ok, claim our bits now: set the info on dinode, chainlist
* and then the group */ * and then the group */
status = ocfs2_journal_access_di(handle, status = ocfs2_journal_access_di(handle,
alloc_inode, INODE_CACHE(alloc_inode),
ac->ac_bh, ac->ac_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
@ -1907,8 +1908,8 @@ static inline int ocfs2_block_group_clear_bits(handle_t *handle,
if (ocfs2_is_cluster_bitmap(alloc_inode)) if (ocfs2_is_cluster_bitmap(alloc_inode))
journal_type = OCFS2_JOURNAL_ACCESS_UNDO; journal_type = OCFS2_JOURNAL_ACCESS_UNDO;
status = ocfs2_journal_access_gd(handle, alloc_inode, group_bh, status = ocfs2_journal_access_gd(handle, INODE_CACHE(alloc_inode),
journal_type); group_bh, journal_type);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail; goto bail;
@ -1993,8 +1994,8 @@ int ocfs2_free_suballoc_bits(handle_t *handle,
goto bail; goto bail;
} }
status = ocfs2_journal_access_di(handle, alloc_inode, alloc_bh, status = ocfs2_journal_access_di(handle, INODE_CACHE(alloc_inode),
OCFS2_JOURNAL_ACCESS_WRITE); alloc_bh, OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail; goto bail;

View File

@ -64,7 +64,6 @@ void ocfs2_metadata_cache_purge(struct ocfs2_caching_info *ci);
void ocfs2_metadata_cache_exit(struct ocfs2_caching_info *ci); void ocfs2_metadata_cache_exit(struct ocfs2_caching_info *ci);
u64 ocfs2_metadata_cache_owner(struct ocfs2_caching_info *ci); u64 ocfs2_metadata_cache_owner(struct ocfs2_caching_info *ci);
struct super_block *ocfs2_metadata_cache_get_super(struct ocfs2_caching_info *ci);
void ocfs2_metadata_cache_io_lock(struct ocfs2_caching_info *ci); void ocfs2_metadata_cache_io_lock(struct ocfs2_caching_info *ci);
void ocfs2_metadata_cache_io_unlock(struct ocfs2_caching_info *ci); void ocfs2_metadata_cache_io_unlock(struct ocfs2_caching_info *ci);

View File

@ -297,7 +297,8 @@ static int ocfs2_xattr_bucket_journal_access(handle_t *handle,
int i, rc = 0; int i, rc = 0;
for (i = 0; i < bucket->bu_blocks; i++) { for (i = 0; i < bucket->bu_blocks; i++) {
rc = ocfs2_journal_access(handle, bucket->bu_inode, rc = ocfs2_journal_access(handle,
INODE_CACHE(bucket->bu_inode),
bucket->bu_bhs[i], type); bucket->bu_bhs[i], type);
if (rc) { if (rc) {
mlog_errno(rc); mlog_errno(rc);
@ -604,7 +605,7 @@ static int ocfs2_xattr_extend_allocation(struct inode *inode,
ocfs2_init_xattr_value_extent_tree(&et, inode, vb); ocfs2_init_xattr_value_extent_tree(&et, inode, vb);
status = vb->vb_access(handle, inode, vb->vb_bh, status = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
@ -658,7 +659,7 @@ static int __ocfs2_remove_xattr_range(struct inode *inode,
ocfs2_init_xattr_value_extent_tree(&et, inode, vb); ocfs2_init_xattr_value_extent_tree(&et, inode, vb);
ret = vb->vb_access(handle, inode, vb->vb_bh, ret = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -1217,7 +1218,7 @@ static int __ocfs2_xattr_set_value_outside(struct inode *inode,
} }
ret = ocfs2_journal_access(handle, ret = ocfs2_journal_access(handle,
inode, INODE_CACHE(inode),
bh, bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret < 0) { if (ret < 0) {
@ -1268,7 +1269,7 @@ static int ocfs2_xattr_cleanup(struct inode *inode,
void *val = xs->base + offs; void *val = xs->base + offs;
size_t size = OCFS2_XATTR_SIZE(name_len) + OCFS2_XATTR_ROOT_SIZE; size_t size = OCFS2_XATTR_SIZE(name_len) + OCFS2_XATTR_ROOT_SIZE;
ret = vb->vb_access(handle, inode, vb->vb_bh, ret = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -1296,7 +1297,7 @@ static int ocfs2_xattr_update_entry(struct inode *inode,
{ {
int ret; int ret;
ret = vb->vb_access(handle, inode, vb->vb_bh, ret = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -1617,7 +1618,7 @@ static int ocfs2_xattr_set_entry(struct inode *inode,
} }
} }
ret = ocfs2_journal_access_di(handle, inode, xs->inode_bh, ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), xs->inode_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -1625,7 +1626,7 @@ static int ocfs2_xattr_set_entry(struct inode *inode,
} }
if (!(flag & OCFS2_INLINE_XATTR_FL)) { if (!(flag & OCFS2_INLINE_XATTR_FL)) {
ret = vb.vb_access(handle, inode, vb.vb_bh, ret = vb.vb_access(handle, INODE_CACHE(inode), vb.vb_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -1898,7 +1899,7 @@ int ocfs2_xattr_remove(struct inode *inode, struct buffer_head *di_bh)
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
} }
ret = ocfs2_journal_access_di(handle, inode, di_bh, ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -2107,7 +2108,8 @@ static int ocfs2_xattr_block_set(struct inode *inode,
int ret; int ret;
if (!xs->xattr_bh) { if (!xs->xattr_bh) {
ret = ocfs2_journal_access_di(handle, inode, xs->inode_bh, ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode),
xs->inode_bh,
OCFS2_JOURNAL_ACCESS_CREATE); OCFS2_JOURNAL_ACCESS_CREATE);
if (ret < 0) { if (ret < 0) {
mlog_errno(ret); mlog_errno(ret);
@ -2125,7 +2127,8 @@ static int ocfs2_xattr_block_set(struct inode *inode,
new_bh = sb_getblk(inode->i_sb, first_blkno); new_bh = sb_getblk(inode->i_sb, first_blkno);
ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), new_bh); ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), new_bh);
ret = ocfs2_journal_access_xb(handle, inode, new_bh, ret = ocfs2_journal_access_xb(handle, INODE_CACHE(inode),
new_bh,
OCFS2_JOURNAL_ACCESS_CREATE); OCFS2_JOURNAL_ACCESS_CREATE);
if (ret < 0) { if (ret < 0) {
mlog_errno(ret); mlog_errno(ret);
@ -2600,7 +2603,7 @@ static int __ocfs2_xattr_set_handle(struct inode *inode,
if (!ret) { if (!ret) {
/* Update inode ctime. */ /* Update inode ctime. */
ret = ocfs2_journal_access_di(ctxt->handle, inode, ret = ocfs2_journal_access_di(ctxt->handle, INODE_CACHE(inode),
xis->inode_bh, xis->inode_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
@ -3428,7 +3431,7 @@ static int ocfs2_xattr_create_index_block(struct inode *inode,
*/ */
down_write(&oi->ip_alloc_sem); down_write(&oi->ip_alloc_sem);
ret = ocfs2_journal_access_xb(handle, inode, xb_bh, ret = ocfs2_journal_access_xb(handle, INODE_CACHE(inode), xb_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
@ -4267,7 +4270,7 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode,
ocfs2_init_xattr_tree_extent_tree(&et, inode, root_bh); ocfs2_init_xattr_tree_extent_tree(&et, inode, root_bh);
ret = ocfs2_journal_access_xb(handle, inode, root_bh, ret = ocfs2_journal_access_xb(handle, INODE_CACHE(inode), root_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret < 0) { if (ret < 0) {
mlog_errno(ret); mlog_errno(ret);
@ -4873,7 +4876,7 @@ static int ocfs2_rm_xattr_cluster(struct inode *inode,
goto out; goto out;
} }
ret = ocfs2_journal_access_xb(handle, inode, root_bh, ret = ocfs2_journal_access_xb(handle, INODE_CACHE(inode), root_bh,
OCFS2_JOURNAL_ACCESS_WRITE); OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);