提交 c75a7e3b 编写于 作者: J Jan Kara 提交者: Yang Yingliang

ocfs2: Use accessor function for h_buffer_credits

mainline inclusion
from mainline-5.5-rc1
commit 9797a902480521dc8e7a478e38f0c896ffff8784
category: bugfix
bugzilla: 25031
CVE: NA
---------------------------

Use the jbd2 accessor function for h_buffer_credits.
Reviewed-by: NTheodore Ts'o <tytso@mit.edu>
Signed-off-by: NJan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20191105164437.32602-12-jack@suse.czSigned-off-by: NTheodore Ts'o <tytso@mit.edu>
Signed-off-by: Nzhangyi (F) <yi.zhang@huawei.com>
Reviewed-by: NYang Erkun <yangerkun@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 02b7342a
...@@ -2302,9 +2302,9 @@ static int ocfs2_extend_rotate_transaction(handle_t *handle, int subtree_depth, ...@@ -2302,9 +2302,9 @@ static int ocfs2_extend_rotate_transaction(handle_t *handle, int subtree_depth,
int ret = 0; int ret = 0;
int credits = (path->p_tree_depth - subtree_depth) * 2 + 1 + op_credits; int credits = (path->p_tree_depth - subtree_depth) * 2 + 1 + op_credits;
if (handle->h_buffer_credits < credits) if (jbd2_handle_buffer_credits(handle) < credits)
ret = ocfs2_extend_trans(handle, ret = ocfs2_extend_trans(handle,
credits - handle->h_buffer_credits); credits - jbd2_handle_buffer_credits(handle));
return ret; return ret;
} }
...@@ -2381,7 +2381,7 @@ static int ocfs2_rotate_tree_right(handle_t *handle, ...@@ -2381,7 +2381,7 @@ static int ocfs2_rotate_tree_right(handle_t *handle,
struct ocfs2_path *right_path, struct ocfs2_path *right_path,
struct ocfs2_path **ret_left_path) struct ocfs2_path **ret_left_path)
{ {
int ret, start, orig_credits = handle->h_buffer_credits; int ret, start, orig_credits = jbd2_handle_buffer_credits(handle);
u32 cpos; u32 cpos;
struct ocfs2_path *left_path = NULL; struct ocfs2_path *left_path = NULL;
struct super_block *sb = ocfs2_metadata_cache_get_super(et->et_ci); struct super_block *sb = ocfs2_metadata_cache_get_super(et->et_ci);
...@@ -3162,7 +3162,7 @@ static int ocfs2_rotate_tree_left(handle_t *handle, ...@@ -3162,7 +3162,7 @@ static int ocfs2_rotate_tree_left(handle_t *handle,
struct ocfs2_path *path, struct ocfs2_path *path,
struct ocfs2_cached_dealloc_ctxt *dealloc) struct ocfs2_cached_dealloc_ctxt *dealloc)
{ {
int ret, orig_credits = handle->h_buffer_credits; int ret, orig_credits = jbd2_handle_buffer_credits(handle);
struct ocfs2_path *tmp_path = NULL, *restart_path = NULL; struct ocfs2_path *tmp_path = NULL, *restart_path = NULL;
struct ocfs2_extent_block *eb; struct ocfs2_extent_block *eb;
struct ocfs2_extent_list *el; struct ocfs2_extent_list *el;
...@@ -3400,7 +3400,7 @@ static int ocfs2_merge_rec_right(struct ocfs2_path *left_path, ...@@ -3400,7 +3400,7 @@ static int ocfs2_merge_rec_right(struct ocfs2_path *left_path,
right_path); right_path);
ret = ocfs2_extend_rotate_transaction(handle, subtree_index, ret = ocfs2_extend_rotate_transaction(handle, subtree_index,
handle->h_buffer_credits, jbd2_handle_buffer_credits(handle),
right_path); right_path);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
...@@ -3562,7 +3562,7 @@ static int ocfs2_merge_rec_left(struct ocfs2_path *right_path, ...@@ -3562,7 +3562,7 @@ static int ocfs2_merge_rec_left(struct ocfs2_path *right_path,
right_path); right_path);
ret = ocfs2_extend_rotate_transaction(handle, subtree_index, ret = ocfs2_extend_rotate_transaction(handle, subtree_index,
handle->h_buffer_credits, jbd2_handle_buffer_credits(handle),
left_path); left_path);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
...@@ -3637,7 +3637,7 @@ static int ocfs2_merge_rec_left(struct ocfs2_path *right_path, ...@@ -3637,7 +3637,7 @@ static int ocfs2_merge_rec_left(struct ocfs2_path *right_path,
le16_to_cpu(el->l_next_free_rec) == 1) { le16_to_cpu(el->l_next_free_rec) == 1) {
/* extend credit for ocfs2_remove_rightmost_path */ /* extend credit for ocfs2_remove_rightmost_path */
ret = ocfs2_extend_rotate_transaction(handle, 0, ret = ocfs2_extend_rotate_transaction(handle, 0,
handle->h_buffer_credits, jbd2_handle_buffer_credits(handle),
right_path); right_path);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
...@@ -3683,7 +3683,7 @@ static int ocfs2_try_to_merge_extent(handle_t *handle, ...@@ -3683,7 +3683,7 @@ static int ocfs2_try_to_merge_extent(handle_t *handle,
if (ctxt->c_split_covers_rec && ctxt->c_has_empty_extent) { if (ctxt->c_split_covers_rec && ctxt->c_has_empty_extent) {
/* extend credit for ocfs2_remove_rightmost_path */ /* extend credit for ocfs2_remove_rightmost_path */
ret = ocfs2_extend_rotate_transaction(handle, 0, ret = ocfs2_extend_rotate_transaction(handle, 0,
handle->h_buffer_credits, jbd2_handle_buffer_credits(handle),
path); path);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
...@@ -3739,7 +3739,7 @@ static int ocfs2_try_to_merge_extent(handle_t *handle, ...@@ -3739,7 +3739,7 @@ static int ocfs2_try_to_merge_extent(handle_t *handle,
/* extend credit for ocfs2_remove_rightmost_path */ /* extend credit for ocfs2_remove_rightmost_path */
ret = ocfs2_extend_rotate_transaction(handle, 0, ret = ocfs2_extend_rotate_transaction(handle, 0,
handle->h_buffer_credits, jbd2_handle_buffer_credits(handle),
path); path);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
...@@ -3769,7 +3769,7 @@ static int ocfs2_try_to_merge_extent(handle_t *handle, ...@@ -3769,7 +3769,7 @@ static int ocfs2_try_to_merge_extent(handle_t *handle,
/* extend credit for ocfs2_remove_rightmost_path */ /* extend credit for ocfs2_remove_rightmost_path */
ret = ocfs2_extend_rotate_transaction(handle, 0, ret = ocfs2_extend_rotate_transaction(handle, 0,
handle->h_buffer_credits, jbd2_handle_buffer_credits(handle),
path); path);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
...@@ -3813,7 +3813,7 @@ static int ocfs2_try_to_merge_extent(handle_t *handle, ...@@ -3813,7 +3813,7 @@ static int ocfs2_try_to_merge_extent(handle_t *handle,
if (ctxt->c_split_covers_rec) { if (ctxt->c_split_covers_rec) {
/* extend credit for ocfs2_remove_rightmost_path */ /* extend credit for ocfs2_remove_rightmost_path */
ret = ocfs2_extend_rotate_transaction(handle, 0, ret = ocfs2_extend_rotate_transaction(handle, 0,
handle->h_buffer_credits, jbd2_handle_buffer_credits(handle),
path); path);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
...@@ -5376,7 +5376,7 @@ static int ocfs2_truncate_rec(handle_t *handle, ...@@ -5376,7 +5376,7 @@ static int ocfs2_truncate_rec(handle_t *handle,
if (ocfs2_is_empty_extent(&el->l_recs[0]) && index > 0) { if (ocfs2_is_empty_extent(&el->l_recs[0]) && index > 0) {
/* extend credit for ocfs2_remove_rightmost_path */ /* extend credit for ocfs2_remove_rightmost_path */
ret = ocfs2_extend_rotate_transaction(handle, 0, ret = ocfs2_extend_rotate_transaction(handle, 0,
handle->h_buffer_credits, jbd2_handle_buffer_credits(handle),
path); path);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
...@@ -5445,7 +5445,7 @@ static int ocfs2_truncate_rec(handle_t *handle, ...@@ -5445,7 +5445,7 @@ static int ocfs2_truncate_rec(handle_t *handle,
} }
ret = ocfs2_extend_rotate_transaction(handle, 0, ret = ocfs2_extend_rotate_transaction(handle, 0,
handle->h_buffer_credits, jbd2_handle_buffer_credits(handle),
path); path);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
......
...@@ -434,7 +434,7 @@ int ocfs2_extend_trans(handle_t *handle, int nblocks) ...@@ -434,7 +434,7 @@ int ocfs2_extend_trans(handle_t *handle, int nblocks)
if (!nblocks) if (!nblocks)
return 0; return 0;
old_nblocks = handle->h_buffer_credits; old_nblocks = jbd2_handle_buffer_credits(handle);
trace_ocfs2_extend_trans(old_nblocks, nblocks); trace_ocfs2_extend_trans(old_nblocks, nblocks);
...@@ -475,7 +475,7 @@ int ocfs2_allocate_extend_trans(handle_t *handle, int thresh) ...@@ -475,7 +475,7 @@ int ocfs2_allocate_extend_trans(handle_t *handle, int thresh)
BUG_ON(!handle); BUG_ON(!handle);
old_nblks = handle->h_buffer_credits; old_nblks = jbd2_handle_buffer_credits(handle);
trace_ocfs2_allocate_extend_trans(old_nblks, thresh); trace_ocfs2_allocate_extend_trans(old_nblks, thresh);
if (old_nblks < thresh) if (old_nblks < thresh)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册