* [PATCH] quota: Use 'hlist_for_each_entry' to simplify code
@ 2021-04-28 8:44 Christophe JAILLET
2021-04-28 12:26 ` Jan Kara
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2021-04-28 8:44 UTC (permalink / raw)
To: jack; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET
Use 'hlist_for_each_entry' instead of hand writing it.
This saves a few lines of code.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only
---
fs/quota/dquot.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 4f1373463766..22d904bde6ab 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -288,14 +288,12 @@ static inline void remove_dquot_hash(struct dquot *dquot)
static struct dquot *find_dquot(unsigned int hashent, struct super_block *sb,
struct kqid qid)
{
- struct hlist_node *node;
struct dquot *dquot;
- hlist_for_each (node, dquot_hash+hashent) {
- dquot = hlist_entry(node, struct dquot, dq_hash);
+ hlist_for_each_entry(dquot, dquot_hash+hashent, dq_hash)
if (dquot->dq_sb == sb && qid_eq(dquot->dq_id, qid))
return dquot;
- }
+
return NULL;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] quota: Use 'hlist_for_each_entry' to simplify code
2021-04-28 8:44 [PATCH] quota: Use 'hlist_for_each_entry' to simplify code Christophe JAILLET
@ 2021-04-28 12:26 ` Jan Kara
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2021-04-28 12:26 UTC (permalink / raw)
To: Christophe JAILLET; +Cc: jack, linux-kernel, kernel-janitors
On Wed 28-04-21 10:44:19, Christophe JAILLET wrote:
> Use 'hlist_for_each_entry' instead of hand writing it.
> This saves a few lines of code.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only
> ---
> fs/quota/dquot.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
Thanks for the cleanup. It looks good. I'll queue it to my tree after the
merge window closes (i.e., in about two weeks).
Honza
>
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index 4f1373463766..22d904bde6ab 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -288,14 +288,12 @@ static inline void remove_dquot_hash(struct dquot *dquot)
> static struct dquot *find_dquot(unsigned int hashent, struct super_block *sb,
> struct kqid qid)
> {
> - struct hlist_node *node;
> struct dquot *dquot;
>
> - hlist_for_each (node, dquot_hash+hashent) {
> - dquot = hlist_entry(node, struct dquot, dq_hash);
> + hlist_for_each_entry(dquot, dquot_hash+hashent, dq_hash)
> if (dquot->dq_sb == sb && qid_eq(dquot->dq_id, qid))
> return dquot;
> - }
> +
> return NULL;
> }
>
> --
> 2.30.2
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-28 12:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28 8:44 [PATCH] quota: Use 'hlist_for_each_entry' to simplify code Christophe JAILLET
2021-04-28 12:26 ` 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).