Skip to content

Commit

Permalink
ocfs2: Pass struct ocfs2_caching_info to the journal functions.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joel Becker committed Sep 4, 2009
1 parent 292dd27 commit 0cf2f76
Show file tree
Hide file tree
Showing 17 changed files with 254 additions and 216 deletions.
103 changes: 52 additions & 51 deletions fs/ocfs2/alloc.c

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions fs/ocfs2/aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,7 @@ static int ocfs2_write_begin_inline(struct address_space *mapping,
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);
if (ret) {
ocfs2_commit_trans(osb, handle);
Expand Down Expand Up @@ -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
* 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);
if (ret) {
mlog_errno(ret);
Expand Down
52 changes: 29 additions & 23 deletions fs/ocfs2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_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);
if (ret) {
mlog_errno(ret);
Expand Down Expand Up @@ -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)
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) {
mlog_errno(ret);
goto out;
Expand Down Expand Up @@ -1179,7 +1180,7 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir,
goto bail;
}
if (de == de_del) {
status = access(handle, dir, bh,
status = access(handle, INODE_CACHE(dir), bh,
OCFS2_JOURNAL_ACCESS_WRITE);
if (status < 0) {
status = -EIO;
Expand Down Expand Up @@ -1329,15 +1330,15 @@ static int ocfs2_delete_entry_dx(handle_t *handle, struct inode *dir,
* the entry count needs to be updated. Also, we might be
* 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);
if (ret) {
mlog_errno(ret);
goto out;
}

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,
OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) {
Expand Down Expand Up @@ -1496,7 +1497,7 @@ static int __ocfs2_dx_dir_leaf_insert(struct inode *dir, handle_t *handle,
int ret;
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);
if (ret) {
mlog_errno(ret);
Expand Down Expand Up @@ -1526,7 +1527,7 @@ static int ocfs2_dx_dir_insert(struct inode *dir, handle_t *handle,
struct ocfs2_dx_root_block *dx_root;
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);
if (ret) {
mlog_errno(ret);
Expand Down Expand Up @@ -1648,11 +1649,13 @@ int __ocfs2_add_entry(handle_t *handle,
*/
if (ocfs2_free_list_at_root(lookup)) {
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);
} else {
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);
}
if (retval) {
Expand Down Expand Up @@ -1703,11 +1706,13 @@ int __ocfs2_add_entry(handle_t *handle,
}

if (insert_bh == parent_fe_bh)
status = ocfs2_journal_access_di(handle, dir,
status = ocfs2_journal_access_di(handle,
INODE_CACHE(dir),
insert_bh,
OCFS2_JOURNAL_ACCESS_WRITE);
else {
status = ocfs2_journal_access_db(handle, dir,
status = ocfs2_journal_access_db(handle,
INODE_CACHE(dir),
insert_bh,
OCFS2_JOURNAL_ACCESS_WRITE);

Expand Down Expand Up @@ -2283,7 +2288,7 @@ static int ocfs2_fill_new_dir_id(struct ocfs2_super *osb,
struct ocfs2_inline_data *data = &di->id2.i_data;
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);
if (ret) {
mlog_errno(ret);
Expand Down Expand Up @@ -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);

status = ocfs2_journal_access_db(handle, inode, new_bh,
status = ocfs2_journal_access_db(handle, INODE_CACHE(inode), new_bh,
OCFS2_JOURNAL_ACCESS_CREATE);
if (status < 0) {
mlog_errno(status);
Expand Down Expand Up @@ -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);

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);
if (ret < 0) {
mlog_errno(ret);
Expand Down Expand Up @@ -2457,7 +2462,7 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb,
if (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);
if (ret) {
mlog_errno(ret);
Expand Down Expand Up @@ -2500,7 +2505,7 @@ static int ocfs2_dx_dir_format_cluster(struct ocfs2_super *osb,

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);
if (ret < 0) {
mlog_errno(ret);
Expand Down Expand Up @@ -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);

ret = ocfs2_journal_access_db(handle, dir, dirdata_bh,
ret = ocfs2_journal_access_db(handle, INODE_CACHE(dir), dirdata_bh,
OCFS2_JOURNAL_ACCESS_CREATE);
if (ret) {
mlog_errno(ret);
Expand Down Expand Up @@ -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
* 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);
if (ret) {
mlog_errno(ret);
Expand Down Expand Up @@ -3392,7 +3397,7 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,

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);
if (status < 0) {
mlog_errno(status);
Expand Down Expand Up @@ -3888,7 +3893,7 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir,
}
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);
if (ret) {
mlog_errno(ret);
Expand Down Expand Up @@ -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++) {
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);
if (ret) {
mlog_errno(ret);
Expand Down Expand Up @@ -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
* 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);
if (ret) {
mlog_errno(ret);
Expand Down Expand Up @@ -4472,7 +4478,7 @@ static int ocfs2_dx_dir_remove_index(struct inode *dir,
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);
if (ret) {
mlog_errno(ret);
Expand Down
2 changes: 1 addition & 1 deletion fs/ocfs2/dlmglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -3499,7 +3499,7 @@ static int ocfs2_check_meta_downconvert(struct ocfs2_lock_res *lockres,
int new_level)
{
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(lockres->l_level != DLM_LOCK_EX && !checkpointed);
Expand Down
8 changes: 4 additions & 4 deletions fs/ocfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ int ocfs2_update_inode_atime(struct inode *inode,
goto out;
}

ret = ocfs2_journal_access_di(handle, inode, bh,
ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), bh,
OCFS2_JOURNAL_ACCESS_WRITE);
if (ret) {
mlog_errno(ret);
Expand Down Expand Up @@ -356,7 +356,7 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb,
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);
if (status < 0) {
mlog_errno(status);
Expand Down Expand Up @@ -593,7 +593,7 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
/* reserve a write to the file entry early on - that we if we
* run out of credits in the allocation path, we can still
* 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);
if (status < 0) {
mlog_errno(status);
Expand Down Expand Up @@ -1131,7 +1131,7 @@ static int __ocfs2_write_remove_suid(struct inode *inode,
goto out;
}

ret = ocfs2_journal_access_di(handle, inode, bh,
ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), bh,
OCFS2_JOURNAL_ACCESS_WRITE);
if (ret < 0) {
mlog_errno(ret);
Expand Down
7 changes: 4 additions & 3 deletions fs/ocfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,8 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb,
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);
if (status < 0) {
mlog_errno(status);
Expand Down Expand Up @@ -646,7 +647,7 @@ static int ocfs2_remove_inode(struct inode *inode,
}

/* 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);
if (status < 0) {
mlog_errno(status);
Expand Down Expand Up @@ -1238,7 +1239,7 @@ int ocfs2_mark_inode_dirty(handle_t *handle,
mlog_entry("(inode %llu)\n",
(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);
if (status < 0) {
mlog_errno(status);
Expand Down
Loading

0 comments on commit 0cf2f76

Please sign in to comment.