aboutsummaryrefslogtreecommitdiffstats
path: root/fs/inode.c
diff options
context:
space:
mode:
authorManish Katiyar <mkatiyar@gmail.com>2009-03-31 10:05:54 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2009-05-09 10:49:41 -0400
commit6b3304b531704711286c3359b06922b83fdba015 (patch)
tree176e991b95d391c7afd0e4bf8875663091ebf605 /fs/inode.c
parentddbaaf3024d764ced700efb2d818709b90ea6fdd (diff)
Make checkpatch.pl shut up on fs/inode.c
Code Quality According To Mingo(tm) has been vastly improved, no code has been damaged^Wchanged^Wdamaged. [commit message rewritten -- AV] Signed-off-by: Manish Katiyar <mkatiyar@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c81
1 files changed, 35 insertions, 46 deletions
diff --git a/fs/inode.c b/fs/inode.c
index 6ad14a1cd8c9..0571983755dc 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -99,7 +99,7 @@ static DEFINE_MUTEX(iprune_mutex);
99 */ 99 */
100struct inodes_stat_t inodes_stat; 100struct inodes_stat_t inodes_stat;
101 101
102static struct kmem_cache * inode_cachep __read_mostly; 102static struct kmem_cache *inode_cachep __read_mostly;
103 103
104static void wake_up_inode(struct inode *inode) 104static void wake_up_inode(struct inode *inode)
105{ 105{
@@ -124,7 +124,7 @@ struct inode *inode_init_always(struct super_block *sb, struct inode *inode)
124 static struct inode_operations empty_iops; 124 static struct inode_operations empty_iops;
125 static const struct file_operations empty_fops; 125 static const struct file_operations empty_fops;
126 126
127 struct address_space * const mapping = &inode->i_data; 127 struct address_space *const mapping = &inode->i_data;
128 128
129 inode->i_sb = sb; 129 inode->i_sb = sb;
130 inode->i_blkbits = sb->s_blocksize_bits; 130 inode->i_blkbits = sb->s_blocksize_bits;
@@ -216,7 +216,7 @@ static struct inode *alloc_inode(struct super_block *sb)
216 return NULL; 216 return NULL;
217} 217}
218 218
219void destroy_inode(struct inode *inode) 219void destroy_inode(struct inode *inode)
220{ 220{
221 BUG_ON(inode_has_buffers(inode)); 221 BUG_ON(inode_has_buffers(inode));
222 security_inode_free(inode); 222 security_inode_free(inode);
@@ -252,12 +252,11 @@ void inode_init_once(struct inode *inode)
252 mutex_init(&inode->inotify_mutex); 252 mutex_init(&inode->inotify_mutex);
253#endif 253#endif
254} 254}
255
256EXPORT_SYMBOL(inode_init_once); 255EXPORT_SYMBOL(inode_init_once);
257 256
258static void init_once(void *foo) 257static void init_once(void *foo)
259{ 258{
260 struct inode * inode = (struct inode *) foo; 259 struct inode *inode = (struct inode *) foo;
261 260
262 inode_init_once(inode); 261 inode_init_once(inode);
263} 262}
@@ -265,7 +264,7 @@ static void init_once(void *foo)
265/* 264/*
266 * inode_lock must be held 265 * inode_lock must be held
267 */ 266 */
268void __iget(struct inode * inode) 267void __iget(struct inode *inode)
269{ 268{
270 if (atomic_read(&inode->i_count)) { 269 if (atomic_read(&inode->i_count)) {
271 atomic_inc(&inode->i_count); 270 atomic_inc(&inode->i_count);
@@ -289,7 +288,7 @@ void clear_inode(struct inode *inode)
289{ 288{
290 might_sleep(); 289 might_sleep();
291 invalidate_inode_buffers(inode); 290 invalidate_inode_buffers(inode);
292 291
293 BUG_ON(inode->i_data.nrpages); 292 BUG_ON(inode->i_data.nrpages);
294 BUG_ON(!(inode->i_state & I_FREEING)); 293 BUG_ON(!(inode->i_state & I_FREEING));
295 BUG_ON(inode->i_state & I_CLEAR); 294 BUG_ON(inode->i_state & I_CLEAR);
@@ -303,7 +302,6 @@ void clear_inode(struct inode *inode)
303 cd_forget(inode); 302 cd_forget(inode);
304 inode->i_state = I_CLEAR; 303 inode->i_state = I_CLEAR;
305} 304}
306
307EXPORT_SYMBOL(clear_inode); 305EXPORT_SYMBOL(clear_inode);
308 306
309/* 307/*
@@ -351,8 +349,8 @@ static int invalidate_list(struct list_head *head, struct list_head *dispose)
351 349
352 next = head->next; 350 next = head->next;
353 for (;;) { 351 for (;;) {
354 struct list_head * tmp = next; 352 struct list_head *tmp = next;
355 struct inode * inode; 353 struct inode *inode;
356 354
357 /* 355 /*
358 * We can reschedule here without worrying about the list's 356 * We can reschedule here without worrying about the list's
@@ -391,7 +389,7 @@ static int invalidate_list(struct list_head *head, struct list_head *dispose)
391 * fails because there are busy inodes then a non zero value is returned. 389 * fails because there are busy inodes then a non zero value is returned.
392 * If the discard is successful all the inodes have been discarded. 390 * If the discard is successful all the inodes have been discarded.
393 */ 391 */
394int invalidate_inodes(struct super_block * sb) 392int invalidate_inodes(struct super_block *sb)
395{ 393{
396 int busy; 394 int busy;
397 LIST_HEAD(throw_away); 395 LIST_HEAD(throw_away);
@@ -407,7 +405,6 @@ int invalidate_inodes(struct super_block * sb)
407 405
408 return busy; 406 return busy;
409} 407}
410
411EXPORT_SYMBOL(invalidate_inodes); 408EXPORT_SYMBOL(invalidate_inodes);
412 409
413static int can_unuse(struct inode *inode) 410static int can_unuse(struct inode *inode)
@@ -504,7 +501,7 @@ static int shrink_icache_memory(int nr, gfp_t gfp_mask)
504 * Nasty deadlock avoidance. We may hold various FS locks, 501 * Nasty deadlock avoidance. We may hold various FS locks,
505 * and we don't want to recurse into the FS that called us 502 * and we don't want to recurse into the FS that called us
506 * in clear_inode() and friends.. 503 * in clear_inode() and friends..
507 */ 504 */
508 if (!(gfp_mask & __GFP_FS)) 505 if (!(gfp_mask & __GFP_FS))
509 return -1; 506 return -1;
510 prune_icache(nr); 507 prune_icache(nr);
@@ -524,10 +521,13 @@ static void __wait_on_freeing_inode(struct inode *inode);
524 * by hand after calling find_inode now! This simplifies iunique and won't 521 * by hand after calling find_inode now! This simplifies iunique and won't
525 * add any additional branch in the common code. 522 * add any additional branch in the common code.
526 */ 523 */
527static struct inode * find_inode(struct super_block * sb, struct hlist_head *head, int (*test)(struct inode *, void *), void *data) 524static struct inode *find_inode(struct super_block *sb,
525 struct hlist_head *head,
526 int (*test)(struct inode *, void *),
527 void *data)
528{ 528{
529 struct hlist_node *node; 529 struct hlist_node *node;
530 struct inode * inode = NULL; 530 struct inode *inode = NULL;
531 531
532repeat: 532repeat:
533 hlist_for_each_entry(inode, node, head, i_hash) { 533 hlist_for_each_entry(inode, node, head, i_hash) {
@@ -548,10 +548,11 @@ repeat:
548 * find_inode_fast is the fast path version of find_inode, see the comment at 548 * find_inode_fast is the fast path version of find_inode, see the comment at
549 * iget_locked for details. 549 * iget_locked for details.
550 */ 550 */
551static struct inode * find_inode_fast(struct super_block * sb, struct hlist_head *head, unsigned long ino) 551static struct inode *find_inode_fast(struct super_block *sb,
552 struct hlist_head *head, unsigned long ino)
552{ 553{
553 struct hlist_node *node; 554 struct hlist_node *node;
554 struct inode * inode = NULL; 555 struct inode *inode = NULL;
555 556
556repeat: 557repeat:
557 hlist_for_each_entry(inode, node, head, i_hash) { 558 hlist_for_each_entry(inode, node, head, i_hash) {
@@ -631,10 +632,10 @@ struct inode *new_inode(struct super_block *sb)
631 * here to attempt to avoid that. 632 * here to attempt to avoid that.
632 */ 633 */
633 static unsigned int last_ino; 634 static unsigned int last_ino;
634 struct inode * inode; 635 struct inode *inode;
635 636
636 spin_lock_prefetch(&inode_lock); 637 spin_lock_prefetch(&inode_lock);
637 638
638 inode = alloc_inode(sb); 639 inode = alloc_inode(sb);
639 if (inode) { 640 if (inode) {
640 spin_lock(&inode_lock); 641 spin_lock(&inode_lock);
@@ -645,7 +646,6 @@ struct inode *new_inode(struct super_block *sb)
645 } 646 }
646 return inode; 647 return inode;
647} 648}
648
649EXPORT_SYMBOL(new_inode); 649EXPORT_SYMBOL(new_inode);
650 650
651void unlock_new_inode(struct inode *inode) 651void unlock_new_inode(struct inode *inode)
@@ -674,7 +674,6 @@ void unlock_new_inode(struct inode *inode)
674 inode->i_state &= ~(I_LOCK|I_NEW); 674 inode->i_state &= ~(I_LOCK|I_NEW);
675 wake_up_inode(inode); 675 wake_up_inode(inode);
676} 676}
677
678EXPORT_SYMBOL(unlock_new_inode); 677EXPORT_SYMBOL(unlock_new_inode);
679 678
680/* 679/*
@@ -683,13 +682,17 @@ EXPORT_SYMBOL(unlock_new_inode);
683 * We no longer cache the sb_flags in i_flags - see fs.h 682 * We no longer cache the sb_flags in i_flags - see fs.h
684 * -- rmk@arm.uk.linux.org 683 * -- rmk@arm.uk.linux.org
685 */ 684 */
686static struct inode * get_new_inode(struct super_block *sb, struct hlist_head *head, int (*test)(struct inode *, void *), int (*set)(struct inode *, void *), void *data) 685static struct inode *get_new_inode(struct super_block *sb,
686 struct hlist_head *head,
687 int (*test)(struct inode *, void *),
688 int (*set)(struct inode *, void *),
689 void *data)
687{ 690{
688 struct inode * inode; 691 struct inode *inode;
689 692
690 inode = alloc_inode(sb); 693 inode = alloc_inode(sb);
691 if (inode) { 694 if (inode) {
692 struct inode * old; 695 struct inode *old;
693 696
694 spin_lock(&inode_lock); 697 spin_lock(&inode_lock);
695 /* We released the lock, so.. */ 698 /* We released the lock, so.. */
@@ -731,13 +734,14 @@ set_failed:
731 * get_new_inode_fast is the fast path version of get_new_inode, see the 734 * get_new_inode_fast is the fast path version of get_new_inode, see the
732 * comment at iget_locked for details. 735 * comment at iget_locked for details.
733 */ 736 */
734static struct inode * get_new_inode_fast(struct super_block *sb, struct hlist_head *head, unsigned long ino) 737static struct inode *get_new_inode_fast(struct super_block *sb,
738 struct hlist_head *head, unsigned long ino)
735{ 739{
736 struct inode * inode; 740 struct inode *inode;
737 741
738 inode = alloc_inode(sb); 742 inode = alloc_inode(sb);
739 if (inode) { 743 if (inode) {
740 struct inode * old; 744 struct inode *old;
741 745
742 spin_lock(&inode_lock); 746 spin_lock(&inode_lock);
743 /* We released the lock, so.. */ 747 /* We released the lock, so.. */
@@ -823,7 +827,6 @@ struct inode *igrab(struct inode *inode)
823 spin_unlock(&inode_lock); 827 spin_unlock(&inode_lock);
824 return inode; 828 return inode;
825} 829}
826
827EXPORT_SYMBOL(igrab); 830EXPORT_SYMBOL(igrab);
828 831
829/** 832/**
@@ -924,7 +927,6 @@ struct inode *ilookup5_nowait(struct super_block *sb, unsigned long hashval,
924 927
925 return ifind(sb, head, test, data, 0); 928 return ifind(sb, head, test, data, 0);
926} 929}
927
928EXPORT_SYMBOL(ilookup5_nowait); 930EXPORT_SYMBOL(ilookup5_nowait);
929 931
930/** 932/**
@@ -953,7 +955,6 @@ struct inode *ilookup5(struct super_block *sb, unsigned long hashval,
953 955
954 return ifind(sb, head, test, data, 1); 956 return ifind(sb, head, test, data, 1);
955} 957}
956
957EXPORT_SYMBOL(ilookup5); 958EXPORT_SYMBOL(ilookup5);
958 959
959/** 960/**
@@ -976,7 +977,6 @@ struct inode *ilookup(struct super_block *sb, unsigned long ino)
976 977
977 return ifind_fast(sb, head, ino); 978 return ifind_fast(sb, head, ino);
978} 979}
979
980EXPORT_SYMBOL(ilookup); 980EXPORT_SYMBOL(ilookup);
981 981
982/** 982/**
@@ -1015,7 +1015,6 @@ struct inode *iget5_locked(struct super_block *sb, unsigned long hashval,
1015 */ 1015 */
1016 return get_new_inode(sb, head, test, set, data); 1016 return get_new_inode(sb, head, test, set, data);
1017} 1017}
1018
1019EXPORT_SYMBOL(iget5_locked); 1018EXPORT_SYMBOL(iget5_locked);
1020 1019
1021/** 1020/**
@@ -1047,7 +1046,6 @@ struct inode *iget_locked(struct super_block *sb, unsigned long ino)
1047 */ 1046 */
1048 return get_new_inode_fast(sb, head, ino); 1047 return get_new_inode_fast(sb, head, ino);
1049} 1048}
1050
1051EXPORT_SYMBOL(iget_locked); 1049EXPORT_SYMBOL(iget_locked);
1052 1050
1053int insert_inode_locked(struct inode *inode) 1051int insert_inode_locked(struct inode *inode)
@@ -1076,7 +1074,6 @@ int insert_inode_locked(struct inode *inode)
1076 iput(old); 1074 iput(old);
1077 } 1075 }
1078} 1076}
1079
1080EXPORT_SYMBOL(insert_inode_locked); 1077EXPORT_SYMBOL(insert_inode_locked);
1081 1078
1082int insert_inode_locked4(struct inode *inode, unsigned long hashval, 1079int insert_inode_locked4(struct inode *inode, unsigned long hashval,
@@ -1106,7 +1103,6 @@ int insert_inode_locked4(struct inode *inode, unsigned long hashval,
1106 iput(old); 1103 iput(old);
1107 } 1104 }
1108} 1105}
1109
1110EXPORT_SYMBOL(insert_inode_locked4); 1106EXPORT_SYMBOL(insert_inode_locked4);
1111 1107
1112/** 1108/**
@@ -1124,7 +1120,6 @@ void __insert_inode_hash(struct inode *inode, unsigned long hashval)
1124 hlist_add_head(&inode->i_hash, head); 1120 hlist_add_head(&inode->i_hash, head);
1125 spin_unlock(&inode_lock); 1121 spin_unlock(&inode_lock);
1126} 1122}
1127
1128EXPORT_SYMBOL(__insert_inode_hash); 1123EXPORT_SYMBOL(__insert_inode_hash);
1129 1124
1130/** 1125/**
@@ -1139,7 +1134,6 @@ void remove_inode_hash(struct inode *inode)
1139 hlist_del_init(&inode->i_hash); 1134 hlist_del_init(&inode->i_hash);
1140 spin_unlock(&inode_lock); 1135 spin_unlock(&inode_lock);
1141} 1136}
1142
1143EXPORT_SYMBOL(remove_inode_hash); 1137EXPORT_SYMBOL(remove_inode_hash);
1144 1138
1145/* 1139/*
@@ -1187,7 +1181,6 @@ void generic_delete_inode(struct inode *inode)
1187 BUG_ON(inode->i_state != I_CLEAR); 1181 BUG_ON(inode->i_state != I_CLEAR);
1188 destroy_inode(inode); 1182 destroy_inode(inode);
1189} 1183}
1190
1191EXPORT_SYMBOL(generic_delete_inode); 1184EXPORT_SYMBOL(generic_delete_inode);
1192 1185
1193static void generic_forget_inode(struct inode *inode) 1186static void generic_forget_inode(struct inode *inode)
@@ -1237,12 +1230,11 @@ void generic_drop_inode(struct inode *inode)
1237 else 1230 else
1238 generic_forget_inode(inode); 1231 generic_forget_inode(inode);
1239} 1232}
1240
1241EXPORT_SYMBOL_GPL(generic_drop_inode); 1233EXPORT_SYMBOL_GPL(generic_drop_inode);
1242 1234
1243/* 1235/*
1244 * Called when we're dropping the last reference 1236 * Called when we're dropping the last reference
1245 * to an inode. 1237 * to an inode.
1246 * 1238 *
1247 * Call the FS "drop()" function, defaulting to 1239 * Call the FS "drop()" function, defaulting to
1248 * the legacy UNIX filesystem behaviour.. 1240 * the legacy UNIX filesystem behaviour..
@@ -1262,7 +1254,7 @@ static inline void iput_final(struct inode *inode)
1262} 1254}
1263 1255
1264/** 1256/**
1265 * iput - put an inode 1257 * iput - put an inode
1266 * @inode: inode to put 1258 * @inode: inode to put
1267 * 1259 *
1268 * Puts an inode, dropping its usage count. If the inode use count hits 1260 * Puts an inode, dropping its usage count. If the inode use count hits
@@ -1279,7 +1271,6 @@ void iput(struct inode *inode)
1279 iput_final(inode); 1271 iput_final(inode);
1280 } 1272 }
1281} 1273}
1282
1283EXPORT_SYMBOL(iput); 1274EXPORT_SYMBOL(iput);
1284 1275
1285/** 1276/**
@@ -1290,10 +1281,10 @@ EXPORT_SYMBOL(iput);
1290 * Returns the block number on the device holding the inode that 1281 * Returns the block number on the device holding the inode that
1291 * is the disk block number for the block of the file requested. 1282 * is the disk block number for the block of the file requested.
1292 * That is, asked for block 4 of inode 1 the function will return the 1283 * That is, asked for block 4 of inode 1 the function will return the
1293 * disk block relative to the disk start that holds that block of the 1284 * disk block relative to the disk start that holds that block of the
1294 * file. 1285 * file.
1295 */ 1286 */
1296sector_t bmap(struct inode * inode, sector_t block) 1287sector_t bmap(struct inode *inode, sector_t block)
1297{ 1288{
1298 sector_t res = 0; 1289 sector_t res = 0;
1299 if (inode->i_mapping->a_ops->bmap) 1290 if (inode->i_mapping->a_ops->bmap)
@@ -1425,7 +1416,6 @@ void file_update_time(struct file *file)
1425 mark_inode_dirty_sync(inode); 1416 mark_inode_dirty_sync(inode);
1426 mnt_drop_write(file->f_path.mnt); 1417 mnt_drop_write(file->f_path.mnt);
1427} 1418}
1428
1429EXPORT_SYMBOL(file_update_time); 1419EXPORT_SYMBOL(file_update_time);
1430 1420
1431int inode_needs_sync(struct inode *inode) 1421int inode_needs_sync(struct inode *inode)
@@ -1436,7 +1426,6 @@ int inode_needs_sync(struct inode *inode)
1436 return 1; 1426 return 1;
1437 return 0; 1427 return 0;
1438} 1428}
1439
1440EXPORT_SYMBOL(inode_needs_sync); 1429EXPORT_SYMBOL(inode_needs_sync);
1441 1430
1442int inode_wait(void *word) 1431int inode_wait(void *word)