quota: Use 'hlist_for_each_entry' to simplify code
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Wed, 28 Apr 2021 08:44:19 +0000 (10:44 +0200)
committerJan Kara <jack@suse.cz>
Mon, 10 May 2021 14:27:49 +0000 (16:27 +0200)
Use 'hlist_for_each_entry' instead of hand writing it.
This saves a few lines of code.

Link: https://lore.kernel.org/r/f82d3e33964dcbd2aac19866735e0a8381c8a735.1619599407.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/quota/dquot.c

index 4f13734637660056e299d4ed04ceb38fb04cb580..22d904bde6ab9158702e4d4d83a42ebb4056770d 100644 (file)
@@ -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;
 }