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

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>

authored by

Christoph Hellwig and committed by
Al Viro
4b4563dc c6428084

+5 -49
+5 -49
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> ··· 25 27 #include <linux/prefetch.h> 26 28 #include <linux/ima.h> 27 29 #include <linux/cred.h> 30 + #include <linux/buffer_head.h> /* for inode_has_buffers */ 28 31 #include "internal.h" 29 32 30 33 /* 31 - * inode locking rules. 34 + * Inode locking rules: 32 35 * 33 36 * inode->i_lock protects: 34 37 * inode->i_state, inode->i_hash, __iget() ··· 59 60 * inode_hash_lock 60 61 */ 61 62 62 - /* 63 - * This is needed for the following functions: 64 - * - inode_has_buffers 65 - * - invalidate_bdev 66 - * 67 - * FIXME: remove all knowledge of the buffer layer from this file 68 - */ 69 - #include <linux/buffer_head.h> 70 - 71 - /* 72 - * New inode.c implementation. 73 - * 74 - * This implementation has the basic premise of trying 75 - * to be extremely low-overhead and SMP-safe, yet be 76 - * simple enough to be "obviously correct". 77 - * 78 - * Famous last words. 79 - */ 80 - 81 - /* inode dynamic allocation 1999, Andrea Arcangeli <andrea@suse.de> */ 82 - 83 - /* #define INODE_PARANOIA 1 */ 84 - /* #define INODE_DEBUG 1 */ 85 - 86 - /* 87 - * Inode lookup is no longer as critical as it used to be: 88 - * most of the lookups are going to be through the dcache. 89 - */ 90 - #define I_HASHBITS i_hash_shift 91 - #define I_HASHMASK i_hash_mask 92 - 93 63 static unsigned int i_hash_mask __read_mostly; 94 64 static unsigned int i_hash_shift __read_mostly; 95 65 static struct hlist_head *inode_hashtable __read_mostly; 96 66 static __cacheline_aligned_in_smp DEFINE_SPINLOCK(inode_hash_lock); 97 - 98 - /* 99 - * Each inode can be on two separate lists. One is 100 - * the hash list of the inode, used for lookups. The 101 - * other linked list is the "type" list: 102 - * "in_use" - valid inode, i_count > 0, i_nlink > 0 103 - * "dirty" - as "in_use" but also dirty 104 - * "unused" - valid inode, i_count = 0 105 - * 106 - * A "dirty" list is maintained for each super block, 107 - * allowing for low-overhead inode sync() operations. 108 - */ 109 67 110 68 static LIST_HEAD(inode_lru); 111 69 static DEFINE_SPINLOCK(inode_lru_lock); ··· 380 424 381 425 tmp = (hashval * (unsigned long)sb) ^ (GOLDEN_RATIO_PRIME + hashval) / 382 426 L1_CACHE_BYTES; 383 - tmp = tmp ^ ((tmp ^ GOLDEN_RATIO_PRIME) >> I_HASHBITS); 384 - return tmp & I_HASHMASK; 427 + tmp = tmp ^ ((tmp ^ GOLDEN_RATIO_PRIME) >> i_hash_shift); 428 + return tmp & i_hash_mask; 385 429 } 386 430 387 431 /**