Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vfs: trivial __d_lookup_rcu() cleanups

These don't change any semantics, but they clean up the code a bit and
mark some arguments appropriately 'const'.

They came up as I was doing the word-at-a-time dcache name accessor
code, and cleaning this up now allows me to send out a smaller relevant
interesting patch for the experimental stuff.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+10 -6
+8 -5
fs/dcache.c
··· 104 104 105 105 static struct hlist_bl_head *dentry_hashtable __read_mostly; 106 106 107 - static inline struct hlist_bl_head *d_hash(struct dentry *parent, 107 + static inline struct hlist_bl_head *d_hash(const struct dentry *parent, 108 108 unsigned long hash) 109 109 { 110 110 hash += ((unsigned long) parent ^ GOLDEN_RATIO_PRIME) / L1_CACHE_BYTES; ··· 1717 1717 * child is looked up. Thus, an interlocking stepping of sequence lock checks 1718 1718 * is formed, giving integrity down the path walk. 1719 1719 */ 1720 - struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name, 1721 - unsigned *seq, struct inode **inode) 1720 + struct dentry *__d_lookup_rcu(const struct dentry *parent, 1721 + const struct qstr *name, 1722 + unsigned *seqp, struct inode **inode) 1722 1723 { 1723 1724 unsigned int len = name->len; 1724 1725 unsigned int hash = name->hash; ··· 1749 1748 * See Documentation/filesystems/path-lookup.txt for more details. 1750 1749 */ 1751 1750 hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) { 1751 + unsigned seq; 1752 1752 struct inode *i; 1753 1753 const char *tname; 1754 1754 int tlen; ··· 1758 1756 continue; 1759 1757 1760 1758 seqretry: 1761 - *seq = read_seqcount_begin(&dentry->d_seq); 1759 + seq = read_seqcount_begin(&dentry->d_seq); 1762 1760 if (dentry->d_parent != parent) 1763 1761 continue; 1764 1762 if (d_unhashed(dentry)) ··· 1773 1771 * edge of memory when walking. If we could load this 1774 1772 * atomically some other way, we could drop this check. 1775 1773 */ 1776 - if (read_seqcount_retry(&dentry->d_seq, *seq)) 1774 + if (read_seqcount_retry(&dentry->d_seq, seq)) 1777 1775 goto seqretry; 1778 1776 if (unlikely(parent->d_flags & DCACHE_OP_COMPARE)) { 1779 1777 if (parent->d_op->d_compare(parent, *inode, ··· 1790 1788 * order to do anything useful with the returned dentry 1791 1789 * anyway. 1792 1790 */ 1791 + *seqp = seq; 1793 1792 *inode = i; 1794 1793 return dentry; 1795 1794 }
+2 -1
include/linux/dcache.h
··· 309 309 extern struct dentry *d_lookup(struct dentry *, struct qstr *); 310 310 extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *); 311 311 extern struct dentry *__d_lookup(struct dentry *, struct qstr *); 312 - extern struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name, 312 + extern struct dentry *__d_lookup_rcu(const struct dentry *parent, 313 + const struct qstr *name, 313 314 unsigned *seq, struct inode **inode); 314 315 315 316 /**