Commit 1fc58146 authored by Mark Fasheh's avatar Mark Fasheh

ocfs2: have ocfs2_extend_trans() take handle_t

No reason to use our wrapper struct in this function, so take the handle_t
directly.

Also fixes a bug where we were incorrectly setting the handle to NULL in
case of a failure from journal_restart()
Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
parent 01ddf1e1
...@@ -1074,7 +1074,7 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb, ...@@ -1074,7 +1074,7 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb,
/* TODO: Perhaps we can calculate the bulk of the /* TODO: Perhaps we can calculate the bulk of the
* credits up front rather than extending like * credits up front rather than extending like
* this. */ * this. */
status = ocfs2_extend_trans(handle, status = ocfs2_extend_trans(handle->k_handle,
OCFS2_TRUNCATE_LOG_FLUSH_ONE_REC); OCFS2_TRUNCATE_LOG_FLUSH_ONE_REC);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
......
...@@ -566,7 +566,7 @@ static int ocfs2_extend_allocation(struct inode *inode, ...@@ -566,7 +566,7 @@ static int ocfs2_extend_allocation(struct inode *inode,
credits = ocfs2_calc_extend_credits(osb->sb, credits = ocfs2_calc_extend_credits(osb->sb,
fe, fe,
clusters_to_add); clusters_to_add);
status = ocfs2_extend_trans(handle, credits); status = ocfs2_extend_trans(handle->k_handle, credits);
if (status < 0) { if (status < 0) {
/* handle still has to be committed at /* handle still has to be committed at
* this point. */ * this point. */
......
...@@ -323,20 +323,18 @@ void ocfs2_commit_trans(struct ocfs2_journal_handle *handle) ...@@ -323,20 +323,18 @@ void ocfs2_commit_trans(struct ocfs2_journal_handle *handle)
* good because transaction ids haven't yet been recorded on the * good because transaction ids haven't yet been recorded on the
* cluster locks associated with this handle. * cluster locks associated with this handle.
*/ */
int ocfs2_extend_trans(struct ocfs2_journal_handle *handle, int ocfs2_extend_trans(handle_t *handle, int nblocks)
int nblocks)
{ {
int status; int status;
BUG_ON(!handle); BUG_ON(!handle);
BUG_ON(!(handle->flags & OCFS2_HANDLE_STARTED));
BUG_ON(!nblocks); BUG_ON(!nblocks);
mlog_entry_void(); mlog_entry_void();
mlog(0, "Trying to extend transaction by %d blocks\n", nblocks); mlog(0, "Trying to extend transaction by %d blocks\n", nblocks);
status = journal_extend(handle->k_handle, nblocks); status = journal_extend(handle, nblocks);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail; goto bail;
...@@ -344,9 +342,8 @@ int ocfs2_extend_trans(struct ocfs2_journal_handle *handle, ...@@ -344,9 +342,8 @@ int ocfs2_extend_trans(struct ocfs2_journal_handle *handle,
if (status > 0) { if (status > 0) {
mlog(0, "journal_extend failed, trying journal_restart\n"); mlog(0, "journal_extend failed, trying journal_restart\n");
status = journal_restart(handle->k_handle, nblocks); status = journal_restart(handle, nblocks);
if (status < 0) { if (status < 0) {
handle->k_handle = NULL;
mlog_errno(status); mlog_errno(status);
goto bail; goto bail;
} }
......
...@@ -264,8 +264,7 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb, ...@@ -264,8 +264,7 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb,
struct ocfs2_journal_handle *handle, struct ocfs2_journal_handle *handle,
int max_buffs); int max_buffs);
void ocfs2_commit_trans(struct ocfs2_journal_handle *handle); void ocfs2_commit_trans(struct ocfs2_journal_handle *handle);
int ocfs2_extend_trans(struct ocfs2_journal_handle *handle, int ocfs2_extend_trans(handle_t *handle, int nblocks);
int nblocks);
/* /*
* Create access is for when we get a newly created buffer and we're * Create access is for when we get a newly created buffer and we're
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment