* [PATCH] fs/ocfs2: remove redundant ret variable
@ 2022-01-04 11:23 ` cgel.zte--- via Ocfs2-devel
0 siblings, 0 replies; 6+ messages in thread
From: cgel.zte @ 2022-01-04 11:23 UTC (permalink / raw)
To: mark
Cc: jlbec, joseph.qi, ocfs2-devel, linux-kernel, Minghao Chi,
Zeal Robot, CGEL ZTE
From: Minghao Chi <chi.minghao@zte.com.cn>
Return value from dlm_lock() directly instead
of taking this in another redundant variable.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Signed-off-by: CGEL ZTE <cgel.zte@gmail.com>
---
fs/ocfs2/stack_user.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
index 85a47621e0c0..3027a6a05668 100644
--- a/fs/ocfs2/stack_user.c
+++ b/fs/ocfs2/stack_user.c
@@ -683,28 +683,23 @@ static int user_dlm_lock(struct ocfs2_cluster_connection *conn,
void *name,
unsigned int namelen)
{
- int ret;
-
if (!lksb->lksb_fsdlm.sb_lvbptr)
lksb->lksb_fsdlm.sb_lvbptr = (char *)lksb +
sizeof(struct dlm_lksb);
- ret = dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm,
+ return dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm,
flags|DLM_LKF_NODLCKWT, name, namelen, 0,
fsdlm_lock_ast_wrapper, lksb,
fsdlm_blocking_ast_wrapper);
- return ret;
}
static int user_dlm_unlock(struct ocfs2_cluster_connection *conn,
struct ocfs2_dlm_lksb *lksb,
u32 flags)
{
- int ret;
- ret = dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid,
+ return dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid,
flags, &lksb->lksb_fsdlm, lksb);
- return ret;
}
static int user_dlm_lock_status(struct ocfs2_dlm_lksb *lksb)
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Ocfs2-devel] [PATCH] fs/ocfs2: remove redundant ret variable
@ 2022-01-04 11:23 ` cgel.zte--- via Ocfs2-devel
0 siblings, 0 replies; 6+ messages in thread
From: cgel.zte--- via Ocfs2-devel @ 2022-01-04 11:23 UTC (permalink / raw)
To: mark; +Cc: CGEL ZTE, Zeal Robot, linux-kernel, Minghao Chi, ocfs2-devel
From: Minghao Chi <chi.minghao@zte.com.cn>
Return value from dlm_lock() directly instead
of taking this in another redundant variable.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Signed-off-by: CGEL ZTE <cgel.zte@gmail.com>
---
fs/ocfs2/stack_user.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
index 85a47621e0c0..3027a6a05668 100644
--- a/fs/ocfs2/stack_user.c
+++ b/fs/ocfs2/stack_user.c
@@ -683,28 +683,23 @@ static int user_dlm_lock(struct ocfs2_cluster_connection *conn,
void *name,
unsigned int namelen)
{
- int ret;
-
if (!lksb->lksb_fsdlm.sb_lvbptr)
lksb->lksb_fsdlm.sb_lvbptr = (char *)lksb +
sizeof(struct dlm_lksb);
- ret = dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm,
+ return dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm,
flags|DLM_LKF_NODLCKWT, name, namelen, 0,
fsdlm_lock_ast_wrapper, lksb,
fsdlm_blocking_ast_wrapper);
- return ret;
}
static int user_dlm_unlock(struct ocfs2_cluster_connection *conn,
struct ocfs2_dlm_lksb *lksb,
u32 flags)
{
- int ret;
- ret = dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid,
+ return dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid,
flags, &lksb->lksb_fsdlm, lksb);
- return ret;
}
static int user_dlm_lock_status(struct ocfs2_dlm_lksb *lksb)
--
2.25.1
_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] fs/ocfs2: remove redundant ret variable
2022-01-04 11:23 ` [Ocfs2-devel] " cgel.zte--- via Ocfs2-devel
@ 2022-01-05 2:04 ` Joseph Qi via Ocfs2-devel
-1 siblings, 0 replies; 6+ messages in thread
From: Joseph Qi @ 2022-01-05 2:04 UTC (permalink / raw)
To: cgel.zte, mark; +Cc: jlbec, ocfs2-devel, linux-kernel, Minghao Chi, Zeal Robot
On 1/4/22 7:23 PM, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
>
> Return value from dlm_lock() directly instead
> of taking this in another redundant variable.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> Signed-off-by: CGEL ZTE <cgel.zte@gmail.com>
> ---
> fs/ocfs2/stack_user.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
> index 85a47621e0c0..3027a6a05668 100644
> --- a/fs/ocfs2/stack_user.c
> +++ b/fs/ocfs2/stack_user.c
> @@ -683,28 +683,23 @@ static int user_dlm_lock(struct ocfs2_cluster_connection *conn,
> void *name,
> unsigned int namelen)
> {
> - int ret;
> -
> if (!lksb->lksb_fsdlm.sb_lvbptr)
> lksb->lksb_fsdlm.sb_lvbptr = (char *)lksb +
> sizeof(struct dlm_lksb);
>
> - ret = dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm,
> + return dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm,
> flags|DLM_LKF_NODLCKWT, name, namelen, 0,
> fsdlm_lock_ast_wrapper, lksb,
> fsdlm_blocking_ast_wrapper);
Better to align the parameters as well.
Thanks,
Joseph
> - return ret;
> }
>
> static int user_dlm_unlock(struct ocfs2_cluster_connection *conn,
> struct ocfs2_dlm_lksb *lksb,
> u32 flags)
> {
> - int ret;
>
> - ret = dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid,
> + return dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid,
> flags, &lksb->lksb_fsdlm, lksb);
> - return ret;
> }
>
> static int user_dlm_lock_status(struct ocfs2_dlm_lksb *lksb)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Ocfs2-devel] [PATCH] fs/ocfs2: remove redundant ret variable
@ 2022-01-05 2:04 ` Joseph Qi via Ocfs2-devel
0 siblings, 0 replies; 6+ messages in thread
From: Joseph Qi via Ocfs2-devel @ 2022-01-05 2:04 UTC (permalink / raw)
To: cgel.zte, mark; +Cc: Minghao Chi, Zeal Robot, ocfs2-devel, linux-kernel
On 1/4/22 7:23 PM, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
>
> Return value from dlm_lock() directly instead
> of taking this in another redundant variable.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> Signed-off-by: CGEL ZTE <cgel.zte@gmail.com>
> ---
> fs/ocfs2/stack_user.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
> index 85a47621e0c0..3027a6a05668 100644
> --- a/fs/ocfs2/stack_user.c
> +++ b/fs/ocfs2/stack_user.c
> @@ -683,28 +683,23 @@ static int user_dlm_lock(struct ocfs2_cluster_connection *conn,
> void *name,
> unsigned int namelen)
> {
> - int ret;
> -
> if (!lksb->lksb_fsdlm.sb_lvbptr)
> lksb->lksb_fsdlm.sb_lvbptr = (char *)lksb +
> sizeof(struct dlm_lksb);
>
> - ret = dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm,
> + return dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm,
> flags|DLM_LKF_NODLCKWT, name, namelen, 0,
> fsdlm_lock_ast_wrapper, lksb,
> fsdlm_blocking_ast_wrapper);
Better to align the parameters as well.
Thanks,
Joseph
> - return ret;
> }
>
> static int user_dlm_unlock(struct ocfs2_cluster_connection *conn,
> struct ocfs2_dlm_lksb *lksb,
> u32 flags)
> {
> - int ret;
>
> - ret = dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid,
> + return dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid,
> flags, &lksb->lksb_fsdlm, lksb);
> - return ret;
> }
>
> static int user_dlm_lock_status(struct ocfs2_dlm_lksb *lksb)
_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] fs/ocfs2: remove redundant ret variable
@ 2022-01-12 8:14 cgel.zte
2022-01-12 11:19 ` Joseph Qi
0 siblings, 1 reply; 6+ messages in thread
From: cgel.zte @ 2022-01-12 8:14 UTC (permalink / raw)
To: mark
Cc: jlbec, joseph.qi, ocfs2-devel, linux-kernel, Minghao Chi,
Zeal Robot, CGEL ZTE
From: Minghao Chi <chi.minghao@zte.com.cn>
Return value from ocfs2_add_clusters_in_btree() directly instead
of taking this in another redundant variable.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Signed-off-by: CGEL ZTE <cgel.zte@gmail.com>
---
fs/ocfs2/file.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index fc5f780fa235..9a46dcef448c 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -540,15 +540,11 @@ int ocfs2_add_inode_data(struct ocfs2_super *osb,
struct ocfs2_alloc_context *meta_ac,
enum ocfs2_alloc_restarted *reason_ret)
{
- int ret;
struct ocfs2_extent_tree et;
- ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), fe_bh);
- ret = ocfs2_add_clusters_in_btree(handle, &et, logical_offset,
+ return ocfs2_add_clusters_in_btree(handle, &et, logical_offset,
clusters_to_add, mark_unwritten,
data_ac, meta_ac, reason_ret);
-
- return ret;
}
static int ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] fs/ocfs2: remove redundant ret variable
2022-01-12 8:14 cgel.zte
@ 2022-01-12 11:19 ` Joseph Qi
0 siblings, 0 replies; 6+ messages in thread
From: Joseph Qi @ 2022-01-12 11:19 UTC (permalink / raw)
To: cgel.zte, mark; +Cc: jlbec, ocfs2-devel, linux-kernel, Minghao Chi, Zeal Robot
This is obviously not right as you remove the extent tree initialization.
Thanks,
Joseph
On 1/12/22 4:14 PM, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
>
> Return value from ocfs2_add_clusters_in_btree() directly instead
> of taking this in another redundant variable.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> Signed-off-by: CGEL ZTE <cgel.zte@gmail.com>
> ---
> fs/ocfs2/file.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index fc5f780fa235..9a46dcef448c 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -540,15 +540,11 @@ int ocfs2_add_inode_data(struct ocfs2_super *osb,
> struct ocfs2_alloc_context *meta_ac,
> enum ocfs2_alloc_restarted *reason_ret)
> {
> - int ret;
> struct ocfs2_extent_tree et;
>
> - ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), fe_bh);
> - ret = ocfs2_add_clusters_in_btree(handle, &et, logical_offset,
> + return ocfs2_add_clusters_in_btree(handle, &et, logical_offset,
> clusters_to_add, mark_unwritten,
> data_ac, meta_ac, reason_ret);
> -
> - return ret;
> }
>
> static int ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-01-12 11:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-04 11:23 [PATCH] fs/ocfs2: remove redundant ret variable cgel.zte
2022-01-04 11:23 ` [Ocfs2-devel] " cgel.zte--- via Ocfs2-devel
2022-01-05 2:04 ` Joseph Qi
2022-01-05 2:04 ` [Ocfs2-devel] " Joseph Qi via Ocfs2-devel
2022-01-12 8:14 cgel.zte
2022-01-12 11:19 ` Joseph Qi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.