summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2026-01-25 01:58:48 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2026-04-02 10:45:02 +0300
commit408d8af01f3a4d666620029a85e741906ff96f47 (patch)
treede0dd838cb909a81d66851996aef41b5318a2ba4 /include/linux
parent7aaa8047eafd0bd628065b15757d9b48c5f9c07d (diff)
downloadlinux-408d8af01f3a4d666620029a85e741906ff96f47.tar.xz
for_each_alias(): helper macro for iterating through dentries of given inode
Most of the places using d_alias are loops iterating through all aliases for given inode; introduce a helper macro (for_each_alias(dentry, inode)) and convert open-coded instances of such loop to it. They are easier to read that way and it reduces the noise on the next steps. You _must_ hold inode->i_lock over that thing. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/dcache.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 898c60d21c92..7f1dbc7121d7 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -615,4 +615,8 @@ void set_default_d_op(struct super_block *, const struct dentry_operations *);
struct dentry *d_make_persistent(struct dentry *, struct inode *);
void d_make_discardable(struct dentry *dentry);
+/* inode->i_lock must be held over that */
+#define for_each_alias(dentry, inode) \
+ hlist_for_each_entry(dentry, &(inode)->i_dentry, d_u.d_alias)
+
#endif /* __LINUX_DCACHE_H */