Commit 1119d3c0 authored by piaojun's avatar piaojun Committed by Linus Torvalds

ocfs2: use 'osb' instead of 'OCFS2_SB()'

We could use 'osb' instead of 'OCFS2_SB()' to make code more elegant.

Link: http://lkml.kernel.org/r/5A702111.7090907@huawei.comSigned-off-by: default avatarJun Piao <piaojun@huawei.com>
Reviewed-by: default avatarYiwen Jiang <jiangyiwen@huawei.com>
Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Joseph Qi <jiangqi903@gmail.com>
Cc: Changwei Ge <ge.changwei@h3c.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6870c016
...@@ -2213,7 +2213,7 @@ static int ocfs2_dio_wr_get_block(struct inode *inode, sector_t iblock, ...@@ -2213,7 +2213,7 @@ static int ocfs2_dio_wr_get_block(struct inode *inode, sector_t iblock,
down_write(&oi->ip_alloc_sem); down_write(&oi->ip_alloc_sem);
if (first_get_block) { if (first_get_block) {
if (ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb))) if (ocfs2_sparse_alloc(osb))
ret = ocfs2_zero_tail(inode, di_bh, pos); ret = ocfs2_zero_tail(inode, di_bh, pos);
else else
ret = ocfs2_expand_nonsparse_inode(inode, di_bh, pos, ret = ocfs2_expand_nonsparse_inode(inode, di_bh, pos,
......
...@@ -3072,7 +3072,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, ...@@ -3072,7 +3072,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
* We need to return the correct block within the * We need to return the correct block within the
* cluster which should hold our entry. * cluster which should hold our entry.
*/ */
off = ocfs2_dx_dir_hash_idx(OCFS2_SB(dir->i_sb), off = ocfs2_dx_dir_hash_idx(osb,
&lookup->dl_hinfo); &lookup->dl_hinfo);
get_bh(dx_leaves[off]); get_bh(dx_leaves[off]);
lookup->dl_dx_leaf_bh = dx_leaves[off]; lookup->dl_dx_leaf_bh = dx_leaves[off];
......
...@@ -1756,8 +1756,7 @@ int ocfs2_rw_lock(struct inode *inode, int write) ...@@ -1756,8 +1756,7 @@ int ocfs2_rw_lock(struct inode *inode, int write)
level = write ? DLM_LOCK_EX : DLM_LOCK_PR; level = write ? DLM_LOCK_EX : DLM_LOCK_PR;
status = ocfs2_cluster_lock(OCFS2_SB(inode->i_sb), lockres, level, 0, status = ocfs2_cluster_lock(osb, lockres, level, 0, 0);
0);
if (status < 0) if (status < 0)
mlog_errno(status); mlog_errno(status);
...@@ -1796,7 +1795,7 @@ void ocfs2_rw_unlock(struct inode *inode, int write) ...@@ -1796,7 +1795,7 @@ void ocfs2_rw_unlock(struct inode *inode, int write)
write ? "EXMODE" : "PRMODE"); write ? "EXMODE" : "PRMODE");
if (!ocfs2_mount_local(osb)) if (!ocfs2_mount_local(osb))
ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); ocfs2_cluster_unlock(osb, lockres, level);
} }
/* /*
...@@ -1816,8 +1815,7 @@ int ocfs2_open_lock(struct inode *inode) ...@@ -1816,8 +1815,7 @@ int ocfs2_open_lock(struct inode *inode)
lockres = &OCFS2_I(inode)->ip_open_lockres; lockres = &OCFS2_I(inode)->ip_open_lockres;
status = ocfs2_cluster_lock(OCFS2_SB(inode->i_sb), lockres, status = ocfs2_cluster_lock(osb, lockres, DLM_LOCK_PR, 0, 0);
DLM_LOCK_PR, 0, 0);
if (status < 0) if (status < 0)
mlog_errno(status); mlog_errno(status);
...@@ -1854,8 +1852,7 @@ int ocfs2_try_open_lock(struct inode *inode, int write) ...@@ -1854,8 +1852,7 @@ int ocfs2_try_open_lock(struct inode *inode, int write)
* other nodes and the -EAGAIN will indicate to the caller that * other nodes and the -EAGAIN will indicate to the caller that
* this inode is still in use. * this inode is still in use.
*/ */
status = ocfs2_cluster_lock(OCFS2_SB(inode->i_sb), lockres, status = ocfs2_cluster_lock(osb, lockres, level, DLM_LKF_NOQUEUE, 0);
level, DLM_LKF_NOQUEUE, 0);
out: out:
return status; return status;
...@@ -1876,11 +1873,9 @@ void ocfs2_open_unlock(struct inode *inode) ...@@ -1876,11 +1873,9 @@ void ocfs2_open_unlock(struct inode *inode)
goto out; goto out;
if(lockres->l_ro_holders) if(lockres->l_ro_holders)
ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, ocfs2_cluster_unlock(osb, lockres, DLM_LOCK_PR);
DLM_LOCK_PR);
if(lockres->l_ex_holders) if(lockres->l_ex_holders)
ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, ocfs2_cluster_unlock(osb, lockres, DLM_LOCK_EX);
DLM_LOCK_EX);
out: out:
return; return;
...@@ -2601,9 +2596,9 @@ void ocfs2_inode_unlock(struct inode *inode, ...@@ -2601,9 +2596,9 @@ void ocfs2_inode_unlock(struct inode *inode,
(unsigned long long)OCFS2_I(inode)->ip_blkno, (unsigned long long)OCFS2_I(inode)->ip_blkno,
ex ? "EXMODE" : "PRMODE"); ex ? "EXMODE" : "PRMODE");
if (!ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb)) && if (!ocfs2_is_hard_readonly(osb) &&
!ocfs2_mount_local(osb)) !ocfs2_mount_local(osb))
ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); ocfs2_cluster_unlock(osb, lockres, level);
} }
/* /*
......
...@@ -296,7 +296,7 @@ int ocfs2_update_inode_atime(struct inode *inode, ...@@ -296,7 +296,7 @@ int ocfs2_update_inode_atime(struct inode *inode,
ocfs2_journal_dirty(handle, bh); ocfs2_journal_dirty(handle, bh);
out_commit: out_commit:
ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); ocfs2_commit_trans(osb, handle);
out: out:
return ret; return ret;
} }
......
...@@ -1135,7 +1135,7 @@ static void ocfs2_clear_inode(struct inode *inode) ...@@ -1135,7 +1135,7 @@ static void ocfs2_clear_inode(struct inode *inode)
trace_ocfs2_clear_inode((unsigned long long)oi->ip_blkno, trace_ocfs2_clear_inode((unsigned long long)oi->ip_blkno,
inode->i_nlink); inode->i_nlink);
mlog_bug_on_msg(OCFS2_SB(inode->i_sb) == NULL, mlog_bug_on_msg(osb == NULL,
"Inode=%lu\n", inode->i_ino); "Inode=%lu\n", inode->i_ino);
dquot_drop(inode); dquot_drop(inode);
...@@ -1150,7 +1150,7 @@ static void ocfs2_clear_inode(struct inode *inode) ...@@ -1150,7 +1150,7 @@ static void ocfs2_clear_inode(struct inode *inode)
ocfs2_mark_lockres_freeing(osb, &oi->ip_inode_lockres); ocfs2_mark_lockres_freeing(osb, &oi->ip_inode_lockres);
ocfs2_mark_lockres_freeing(osb, &oi->ip_open_lockres); ocfs2_mark_lockres_freeing(osb, &oi->ip_open_lockres);
ocfs2_resv_discard(&OCFS2_SB(inode->i_sb)->osb_la_resmap, ocfs2_resv_discard(&osb->osb_la_resmap,
&oi->ip_la_data_resv); &oi->ip_la_data_resv);
ocfs2_resv_init_once(&oi->ip_la_data_resv); ocfs2_resv_init_once(&oi->ip_la_data_resv);
...@@ -1223,7 +1223,7 @@ static void ocfs2_clear_inode(struct inode *inode) ...@@ -1223,7 +1223,7 @@ static void ocfs2_clear_inode(struct inode *inode)
* the journal is flushed before journal shutdown. Thus it is safe to * the journal is flushed before journal shutdown. Thus it is safe to
* have inodes get cleaned up after journal shutdown. * have inodes get cleaned up after journal shutdown.
*/ */
jbd2_journal_release_jbd_inode(OCFS2_SB(inode->i_sb)->journal->j_journal, jbd2_journal_release_jbd_inode(osb->journal->j_journal,
&oi->ip_jinode); &oi->ip_jinode);
} }
......
...@@ -3359,7 +3359,7 @@ static int ocfs2_replace_cow(struct ocfs2_cow_context *context) ...@@ -3359,7 +3359,7 @@ static int ocfs2_replace_cow(struct ocfs2_cow_context *context)
unsigned int ext_flags; unsigned int ext_flags;
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) { if (!ocfs2_refcount_tree(osb)) {
return ocfs2_error(inode->i_sb, "Inode %lu want to use refcount tree, but the feature bit is not set in the super block\n", return ocfs2_error(inode->i_sb, "Inode %lu want to use refcount tree, but the feature bit is not set in the super block\n",
inode->i_ino); inode->i_ino);
} }
...@@ -3707,7 +3707,7 @@ int ocfs2_add_refcount_flag(struct inode *inode, ...@@ -3707,7 +3707,7 @@ int ocfs2_add_refcount_flag(struct inode *inode,
trace_ocfs2_add_refcount_flag(ref_blocks, credits); trace_ocfs2_add_refcount_flag(ref_blocks, credits);
if (ref_blocks) { if (ref_blocks) {
ret = ocfs2_reserve_new_metadata_blocks(OCFS2_SB(inode->i_sb), ret = ocfs2_reserve_new_metadata_blocks(osb,
ref_blocks, &meta_ac); ref_blocks, &meta_ac);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
......
...@@ -387,7 +387,7 @@ static int ocfs2_block_group_fill(handle_t *handle, ...@@ -387,7 +387,7 @@ static int ocfs2_block_group_fill(handle_t *handle,
memset(bg, 0, sb->s_blocksize); memset(bg, 0, sb->s_blocksize);
strcpy(bg->bg_signature, OCFS2_GROUP_DESC_SIGNATURE); strcpy(bg->bg_signature, OCFS2_GROUP_DESC_SIGNATURE);
bg->bg_generation = cpu_to_le32(OCFS2_SB(sb)->fs_generation); bg->bg_generation = cpu_to_le32(osb->fs_generation);
bg->bg_size = cpu_to_le16(ocfs2_group_bitmap_size(sb, 1, bg->bg_size = cpu_to_le16(ocfs2_group_bitmap_size(sb, 1,
osb->s_feature_incompat)); osb->s_feature_incompat));
bg->bg_chain = cpu_to_le16(my_chain); bg->bg_chain = cpu_to_le16(my_chain);
...@@ -1521,7 +1521,7 @@ static int ocfs2_cluster_group_search(struct inode *inode, ...@@ -1521,7 +1521,7 @@ static int ocfs2_cluster_group_search(struct inode *inode,
OCFS2_I(inode)->ip_clusters, max_bits); OCFS2_I(inode)->ip_clusters, max_bits);
} }
ret = ocfs2_block_group_find_clear_bits(OCFS2_SB(inode->i_sb), ret = ocfs2_block_group_find_clear_bits(osb,
group_bh, bits_wanted, group_bh, bits_wanted,
max_bits, res); max_bits, res);
if (ret) if (ret)
......
...@@ -423,10 +423,10 @@ static int ocfs2_sync_fs(struct super_block *sb, int wait) ...@@ -423,10 +423,10 @@ static int ocfs2_sync_fs(struct super_block *sb, int wait)
ocfs2_schedule_truncate_log_flush(osb, 0); ocfs2_schedule_truncate_log_flush(osb, 0);
} }
if (jbd2_journal_start_commit(OCFS2_SB(sb)->journal->j_journal, if (jbd2_journal_start_commit(osb->journal->j_journal,
&target)) { &target)) {
if (wait) if (wait)
jbd2_log_wait_commit(OCFS2_SB(sb)->journal->j_journal, jbd2_log_wait_commit(osb->journal->j_journal,
target); target);
} }
return 0; return 0;
......
...@@ -3564,7 +3564,7 @@ int ocfs2_xattr_set(struct inode *inode, ...@@ -3564,7 +3564,7 @@ int ocfs2_xattr_set(struct inode *inode,
.not_found = -ENODATA, .not_found = -ENODATA,
}; };
if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb))) if (!ocfs2_supports_xattr(osb))
return -EOPNOTSUPP; return -EOPNOTSUPP;
/* /*
......
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