Commit 4b4563dc80594c6a2580aa52d9fcf0177a27074e
Committed by
Al Viro
1 parent
c642808454
Exists in
master
and in
4 other branches
fs: cosmetic inode.c cleanups
Move the lock order description after all the includes, remove several fairly outdated and/or incorrect comments, move Andrea's copyright/changelog to the top where it belongs, remove the pointless filename in the top of the file comment, and remove to useless macros. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 1 changed file with 5 additions and 49 deletions Side-by-side Diff
fs/inode.c
1 | 1 | /* |
2 | - * linux/fs/inode.c | |
3 | - * | |
4 | 2 | * (C) 1997 Linus Torvalds |
3 | + * (C) 1999 Andrea Arcangeli <andrea@suse.de> (dynamic inode allocation) | |
5 | 4 | */ |
6 | - | |
7 | 5 | #include <linux/fs.h> |
8 | 6 | #include <linux/mm.h> |
9 | 7 | #include <linux/dcache.h> |
10 | 8 | |
... | ... | @@ -27,10 +25,11 @@ |
27 | 25 | #include <linux/prefetch.h> |
28 | 26 | #include <linux/ima.h> |
29 | 27 | #include <linux/cred.h> |
28 | +#include <linux/buffer_head.h> /* for inode_has_buffers */ | |
30 | 29 | #include "internal.h" |
31 | 30 | |
32 | 31 | /* |
33 | - * inode locking rules. | |
32 | + * Inode locking rules: | |
34 | 33 | * |
35 | 34 | * inode->i_lock protects: |
36 | 35 | * inode->i_state, inode->i_hash, __iget() |
37 | 36 | |
... | ... | @@ -60,54 +59,11 @@ |
60 | 59 | * inode_hash_lock |
61 | 60 | */ |
62 | 61 | |
63 | -/* | |
64 | - * This is needed for the following functions: | |
65 | - * - inode_has_buffers | |
66 | - * - invalidate_bdev | |
67 | - * | |
68 | - * FIXME: remove all knowledge of the buffer layer from this file | |
69 | - */ | |
70 | -#include <linux/buffer_head.h> | |
71 | - | |
72 | -/* | |
73 | - * New inode.c implementation. | |
74 | - * | |
75 | - * This implementation has the basic premise of trying | |
76 | - * to be extremely low-overhead and SMP-safe, yet be | |
77 | - * simple enough to be "obviously correct". | |
78 | - * | |
79 | - * Famous last words. | |
80 | - */ | |
81 | - | |
82 | -/* inode dynamic allocation 1999, Andrea Arcangeli <andrea@suse.de> */ | |
83 | - | |
84 | -/* #define INODE_PARANOIA 1 */ | |
85 | -/* #define INODE_DEBUG 1 */ | |
86 | - | |
87 | -/* | |
88 | - * Inode lookup is no longer as critical as it used to be: | |
89 | - * most of the lookups are going to be through the dcache. | |
90 | - */ | |
91 | -#define I_HASHBITS i_hash_shift | |
92 | -#define I_HASHMASK i_hash_mask | |
93 | - | |
94 | 62 | static unsigned int i_hash_mask __read_mostly; |
95 | 63 | static unsigned int i_hash_shift __read_mostly; |
96 | 64 | static struct hlist_head *inode_hashtable __read_mostly; |
97 | 65 | static __cacheline_aligned_in_smp DEFINE_SPINLOCK(inode_hash_lock); |
98 | 66 | |
99 | -/* | |
100 | - * Each inode can be on two separate lists. One is | |
101 | - * the hash list of the inode, used for lookups. The | |
102 | - * other linked list is the "type" list: | |
103 | - * "in_use" - valid inode, i_count > 0, i_nlink > 0 | |
104 | - * "dirty" - as "in_use" but also dirty | |
105 | - * "unused" - valid inode, i_count = 0 | |
106 | - * | |
107 | - * A "dirty" list is maintained for each super block, | |
108 | - * allowing for low-overhead inode sync() operations. | |
109 | - */ | |
110 | - | |
111 | 67 | static LIST_HEAD(inode_lru); |
112 | 68 | static DEFINE_SPINLOCK(inode_lru_lock); |
113 | 69 | |
... | ... | @@ -424,8 +380,8 @@ |
424 | 380 | |
425 | 381 | tmp = (hashval * (unsigned long)sb) ^ (GOLDEN_RATIO_PRIME + hashval) / |
426 | 382 | L1_CACHE_BYTES; |
427 | - tmp = tmp ^ ((tmp ^ GOLDEN_RATIO_PRIME) >> I_HASHBITS); | |
428 | - return tmp & I_HASHMASK; | |
383 | + tmp = tmp ^ ((tmp ^ GOLDEN_RATIO_PRIME) >> i_hash_shift); | |
384 | + return tmp & i_hash_mask; | |
429 | 385 | } |
430 | 386 | |
431 | 387 | /** |