* [PATCH] ext4: use rb_entry_safe() instead of open-coding it
@ 2019-07-25 13:16 Weitao Hou
2019-08-02 11:02 ` Jan Kara
0 siblings, 1 reply; 2+ messages in thread
From: Weitao Hou @ 2019-07-25 13:16 UTC (permalink / raw)
To: tytso, adilger.kernel; +Cc: linux-ext4, linux-kernel, Weitao Hou
use rb_entry_safe() to make it clean
Signed-off-by: Weitao Hou <houweitaoo@gmail.com>
---
fs/ext4/extents_status.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c
index 7521de2dcf3a..08ce5ded3538 100644
--- a/fs/ext4/extents_status.c
+++ b/fs/ext4/extents_status.c
@@ -228,8 +228,7 @@ static struct extent_status *__es_tree_search(struct rb_root *root,
if (es && lblk > ext4_es_end(es)) {
node = rb_next(&es->rb_node);
- return node ? rb_entry(node, struct extent_status, rb_node) :
- NULL;
+ return rb_entry_safe(node, struct extent_status, rb_node);
}
return NULL;
--
2.18.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ext4: use rb_entry_safe() instead of open-coding it
2019-07-25 13:16 [PATCH] ext4: use rb_entry_safe() instead of open-coding it Weitao Hou
@ 2019-08-02 11:02 ` Jan Kara
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2019-08-02 11:02 UTC (permalink / raw)
To: Weitao Hou; +Cc: tytso, adilger.kernel, linux-ext4, linux-kernel
On Thu 25-07-19 21:16:58, Weitao Hou wrote:
> use rb_entry_safe() to make it clean
>
> Signed-off-by: Weitao Hou <houweitaoo@gmail.com>
Thanks for the patch. It looks good. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/ext4/extents_status.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c
> index 7521de2dcf3a..08ce5ded3538 100644
> --- a/fs/ext4/extents_status.c
> +++ b/fs/ext4/extents_status.c
> @@ -228,8 +228,7 @@ static struct extent_status *__es_tree_search(struct rb_root *root,
>
> if (es && lblk > ext4_es_end(es)) {
> node = rb_next(&es->rb_node);
> - return node ? rb_entry(node, struct extent_status, rb_node) :
> - NULL;
> + return rb_entry_safe(node, struct extent_status, rb_node);
> }
>
> return NULL;
> --
> 2.18.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-02 11:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25 13:16 [PATCH] ext4: use rb_entry_safe() instead of open-coding it Weitao Hou
2019-08-02 11:02 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).