diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-02 17:23:30 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-02 17:23:30 -0500 |
commit | 8966be90304b394fd6a2c5af7b6b3abe2df3889c (patch) | |
tree | 9893ca0f2e1c97d4ed5d37fee8502a77f0c3b7d2 /fs | |
parent | 2273d5ccb882106a74c7b780a6bfa16fb210cd24 (diff) |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/dcache.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index fe19ac13f75f..138be96e25b6 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -104,7 +104,7 @@ static unsigned int d_hash_shift __read_mostly; | |||
104 | 104 | ||
105 | static struct hlist_bl_head *dentry_hashtable __read_mostly; | 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 | unsigned long hash) | 108 | unsigned long hash) |
109 | { | 109 | { |
110 | hash += ((unsigned long) parent ^ GOLDEN_RATIO_PRIME) / L1_CACHE_BYTES; | 110 | hash += ((unsigned long) parent ^ GOLDEN_RATIO_PRIME) / L1_CACHE_BYTES; |
@@ -1717,8 +1717,9 @@ EXPORT_SYMBOL(d_add_ci); | |||
1717 | * child is looked up. Thus, an interlocking stepping of sequence lock checks | 1717 | * child is looked up. Thus, an interlocking stepping of sequence lock checks |
1718 | * is formed, giving integrity down the path walk. | 1718 | * is formed, giving integrity down the path walk. |
1719 | */ | 1719 | */ |
1720 | struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name, | 1720 | struct dentry *__d_lookup_rcu(const struct dentry *parent, |
1721 | unsigned *seq, struct inode **inode) | 1721 | const struct qstr *name, |
1722 | unsigned *seqp, struct inode **inode) | ||
1722 | { | 1723 | { |
1723 | unsigned int len = name->len; | 1724 | unsigned int len = name->len; |
1724 | unsigned int hash = name->hash; | 1725 | unsigned int hash = name->hash; |
@@ -1748,6 +1749,7 @@ struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name, | |||
1748 | * See Documentation/filesystems/path-lookup.txt for more details. | 1749 | * See Documentation/filesystems/path-lookup.txt for more details. |
1749 | */ | 1750 | */ |
1750 | hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) { | 1751 | hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) { |
1752 | unsigned seq; | ||
1751 | struct inode *i; | 1753 | struct inode *i; |
1752 | const char *tname; | 1754 | const char *tname; |
1753 | int tlen; | 1755 | int tlen; |
@@ -1756,7 +1758,7 @@ struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name, | |||
1756 | continue; | 1758 | continue; |
1757 | 1759 | ||
1758 | seqretry: | 1760 | seqretry: |
1759 | *seq = read_seqcount_begin(&dentry->d_seq); | 1761 | seq = read_seqcount_begin(&dentry->d_seq); |
1760 | if (dentry->d_parent != parent) | 1762 | if (dentry->d_parent != parent) |
1761 | continue; | 1763 | continue; |
1762 | if (d_unhashed(dentry)) | 1764 | if (d_unhashed(dentry)) |
@@ -1771,7 +1773,7 @@ seqretry: | |||
1771 | * edge of memory when walking. If we could load this | 1773 | * edge of memory when walking. If we could load this |
1772 | * atomically some other way, we could drop this check. | 1774 | * atomically some other way, we could drop this check. |
1773 | */ | 1775 | */ |
1774 | if (read_seqcount_retry(&dentry->d_seq, *seq)) | 1776 | if (read_seqcount_retry(&dentry->d_seq, seq)) |
1775 | goto seqretry; | 1777 | goto seqretry; |
1776 | if (unlikely(parent->d_flags & DCACHE_OP_COMPARE)) { | 1778 | if (unlikely(parent->d_flags & DCACHE_OP_COMPARE)) { |
1777 | if (parent->d_op->d_compare(parent, *inode, | 1779 | if (parent->d_op->d_compare(parent, *inode, |
@@ -1788,6 +1790,7 @@ seqretry: | |||
1788 | * order to do anything useful with the returned dentry | 1790 | * order to do anything useful with the returned dentry |
1789 | * anyway. | 1791 | * anyway. |
1790 | */ | 1792 | */ |
1793 | *seqp = seq; | ||
1791 | *inode = i; | 1794 | *inode = i; |
1792 | return dentry; | 1795 | return dentry; |
1793 | } | 1796 | } |