diff options
author | Christoph Hellwig <hch@infradead.org> | 2011-05-27 09:28:01 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-05-27 09:43:00 -0400 |
commit | 4b4563dc80594c6a2580aa52d9fcf0177a27074e (patch) | |
tree | 1930ae6b71c7d69c7072e05cc2e2c55fb83547f4 /fs/inode.c | |
parent | c642808454ac81d6a6701da6022e93bbe47bb38b (diff) |
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>
Diffstat (limited to 'fs/inode.c')
-rw-r--r-- | fs/inode.c | 54 |
1 files changed, 5 insertions, 49 deletions
diff --git a/fs/inode.c b/fs/inode.c index 990d284877a1..0f7e88a7803f 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -1,9 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/inode.c | ||
3 | * | ||
4 | * (C) 1997 Linus Torvalds | 2 | * (C) 1997 Linus Torvalds |
3 | * (C) 1999 Andrea Arcangeli <andrea@suse.de> (dynamic inode allocation) | ||
5 | */ | 4 | */ |
6 | |||
7 | #include <linux/fs.h> | 5 | #include <linux/fs.h> |
8 | #include <linux/mm.h> | 6 | #include <linux/mm.h> |
9 | #include <linux/dcache.h> | 7 | #include <linux/dcache.h> |
@@ -27,10 +25,11 @@ | |||
27 | #include <linux/prefetch.h> | 25 | #include <linux/prefetch.h> |
28 | #include <linux/ima.h> | 26 | #include <linux/ima.h> |
29 | #include <linux/cred.h> | 27 | #include <linux/cred.h> |
28 | #include <linux/buffer_head.h> /* for inode_has_buffers */ | ||
30 | #include "internal.h" | 29 | #include "internal.h" |
31 | 30 | ||
32 | /* | 31 | /* |
33 | * inode locking rules. | 32 | * Inode locking rules: |
34 | * | 33 | * |
35 | * inode->i_lock protects: | 34 | * inode->i_lock protects: |
36 | * inode->i_state, inode->i_hash, __iget() | 35 | * inode->i_state, inode->i_hash, __iget() |
@@ -60,54 +59,11 @@ | |||
60 | * inode_hash_lock | 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 | static unsigned int i_hash_mask __read_mostly; | 62 | static unsigned int i_hash_mask __read_mostly; |
95 | static unsigned int i_hash_shift __read_mostly; | 63 | static unsigned int i_hash_shift __read_mostly; |
96 | static struct hlist_head *inode_hashtable __read_mostly; | 64 | static struct hlist_head *inode_hashtable __read_mostly; |
97 | static __cacheline_aligned_in_smp DEFINE_SPINLOCK(inode_hash_lock); | 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 | static LIST_HEAD(inode_lru); | 67 | static LIST_HEAD(inode_lru); |
112 | static DEFINE_SPINLOCK(inode_lru_lock); | 68 | static DEFINE_SPINLOCK(inode_lru_lock); |
113 | 69 | ||
@@ -424,8 +380,8 @@ static unsigned long hash(struct super_block *sb, unsigned long hashval) | |||
424 | 380 | ||
425 | tmp = (hashval * (unsigned long)sb) ^ (GOLDEN_RATIO_PRIME + hashval) / | 381 | tmp = (hashval * (unsigned long)sb) ^ (GOLDEN_RATIO_PRIME + hashval) / |
426 | L1_CACHE_BYTES; | 382 | L1_CACHE_BYTES; |
427 | tmp = tmp ^ ((tmp ^ GOLDEN_RATIO_PRIME) >> I_HASHBITS); | 383 | tmp = tmp ^ ((tmp ^ GOLDEN_RATIO_PRIME) >> i_hash_shift); |
428 | return tmp & I_HASHMASK; | 384 | return tmp & i_hash_mask; |
429 | } | 385 | } |
430 | 386 | ||
431 | /** | 387 | /** |