aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/Locking2
-rw-r--r--Documentation/filesystems/porting16
-rw-r--r--Documentation/filesystems/vfs.txt2
-rw-r--r--fs/inode.c17
-rw-r--r--fs/logfs/inode.c2
5 files changed, 17 insertions, 22 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index 2e994efe12cb..61b31acb9176 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -128,7 +128,7 @@ alloc_inode:
128destroy_inode: 128destroy_inode:
129dirty_inode: (must not sleep) 129dirty_inode: (must not sleep)
130write_inode: 130write_inode:
131drop_inode: !!!inode_lock!!! 131drop_inode: !!!inode->i_lock!!!
132evict_inode: 132evict_inode:
133put_super: write 133put_super: write
134write_super: read 134write_super: read
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index 0c986c9e8519..6e29954851a2 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -298,11 +298,14 @@ be used instead. It gets called whenever the inode is evicted, whether it has
298remaining links or not. Caller does *not* evict the pagecache or inode-associated 298remaining links or not. Caller does *not* evict the pagecache or inode-associated
299metadata buffers; getting rid of those is responsibility of method, as it had 299metadata buffers; getting rid of those is responsibility of method, as it had
300been for ->delete_inode(). 300been for ->delete_inode().
301 ->drop_inode() returns int now; it's called on final iput() with inode_lock 301
302held and it returns true if filesystems wants the inode to be dropped. As before, 302 ->drop_inode() returns int now; it's called on final iput() with
303generic_drop_inode() is still the default and it's been updated appropriately. 303inode->i_lock held and it returns true if filesystems wants the inode to be
304generic_delete_inode() is also alive and it consists simply of return 1. Note that 304dropped. As before, generic_drop_inode() is still the default and it's been
305all actual eviction work is done by caller after ->drop_inode() returns. 305updated appropriately. generic_delete_inode() is also alive and it consists
306simply of return 1. Note that all actual eviction work is done by caller after
307->drop_inode() returns.
308
306 clear_inode() is gone; use end_writeback() instead. As before, it must 309 clear_inode() is gone; use end_writeback() instead. As before, it must
307be called exactly once on each call of ->evict_inode() (as it used to be for 310be called exactly once on each call of ->evict_inode() (as it used to be for
308each call of ->delete_inode()). Unlike before, if you are using inode-associated 311each call of ->delete_inode()). Unlike before, if you are using inode-associated
@@ -397,6 +400,9 @@ a file off.
397 400
398-- 401--
399[mandatory] 402[mandatory]
403
404--
405[mandatory]
400 ->get_sb() is gone. Switch to use of ->mount(). Typically it's just 406 ->get_sb() is gone. Switch to use of ->mount(). Typically it's just
401a matter of switching from calling get_sb_... to mount_... and changing the 407a matter of switching from calling get_sb_... to mount_... and changing the
402function type. If you were doing it manually, just switch from setting ->mnt_root 408function type. If you were doing it manually, just switch from setting ->mnt_root
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index 306f0ae8df09..80815ed654cb 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -254,7 +254,7 @@ or bottom half).
254 should be synchronous or not, not all filesystems check this flag. 254 should be synchronous or not, not all filesystems check this flag.
255 255
256 drop_inode: called when the last access to the inode is dropped, 256 drop_inode: called when the last access to the inode is dropped,
257 with the inode_lock spinlock held. 257 with the inode->i_lock spinlock held.
258 258
259 This method should be either NULL (normal UNIX filesystem 259 This method should be either NULL (normal UNIX filesystem
260 semantics) or "generic_delete_inode" (for filesystems that do not 260 semantics) or "generic_delete_inode" (for filesystems that do not
diff --git a/fs/inode.c b/fs/inode.c
index b19cb6ee6ca3..389f5a247599 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -650,7 +650,6 @@ static void prune_icache(int nr_to_scan)
650 unsigned long reap = 0; 650 unsigned long reap = 0;
651 651
652 down_read(&iprune_sem); 652 down_read(&iprune_sem);
653 spin_lock(&inode_lock);
654 spin_lock(&inode_lru_lock); 653 spin_lock(&inode_lru_lock);
655 for (nr_scanned = 0; nr_scanned < nr_to_scan; nr_scanned++) { 654 for (nr_scanned = 0; nr_scanned < nr_to_scan; nr_scanned++) {
656 struct inode *inode; 655 struct inode *inode;
@@ -676,8 +675,8 @@ static void prune_icache(int nr_to_scan)
676 */ 675 */
677 if (atomic_read(&inode->i_count) || 676 if (atomic_read(&inode->i_count) ||
678 (inode->i_state & ~I_REFERENCED)) { 677 (inode->i_state & ~I_REFERENCED)) {
679 spin_unlock(&inode->i_lock);
680 list_del_init(&inode->i_lru); 678 list_del_init(&inode->i_lru);
679 spin_unlock(&inode->i_lock);
681 inodes_stat.nr_unused--; 680 inodes_stat.nr_unused--;
682 continue; 681 continue;
683 } 682 }
@@ -685,20 +684,18 @@ static void prune_icache(int nr_to_scan)
685 /* recently referenced inodes get one more pass */ 684 /* recently referenced inodes get one more pass */
686 if (inode->i_state & I_REFERENCED) { 685 if (inode->i_state & I_REFERENCED) {
687 inode->i_state &= ~I_REFERENCED; 686 inode->i_state &= ~I_REFERENCED;
688 spin_unlock(&inode->i_lock);
689 list_move(&inode->i_lru, &inode_lru); 687 list_move(&inode->i_lru, &inode_lru);
688 spin_unlock(&inode->i_lock);
690 continue; 689 continue;
691 } 690 }
692 if (inode_has_buffers(inode) || inode->i_data.nrpages) { 691 if (inode_has_buffers(inode) || inode->i_data.nrpages) {
693 __iget(inode); 692 __iget(inode);
694 spin_unlock(&inode->i_lock); 693 spin_unlock(&inode->i_lock);
695 spin_unlock(&inode_lru_lock); 694 spin_unlock(&inode_lru_lock);
696 spin_unlock(&inode_lock);
697 if (remove_inode_buffers(inode)) 695 if (remove_inode_buffers(inode))
698 reap += invalidate_mapping_pages(&inode->i_data, 696 reap += invalidate_mapping_pages(&inode->i_data,
699 0, -1); 697 0, -1);
700 iput(inode); 698 iput(inode);
701 spin_lock(&inode_lock);
702 spin_lock(&inode_lru_lock); 699 spin_lock(&inode_lru_lock);
703 700
704 if (inode != list_entry(inode_lru.next, 701 if (inode != list_entry(inode_lru.next,
@@ -724,7 +721,6 @@ static void prune_icache(int nr_to_scan)
724 else 721 else
725 __count_vm_events(PGINODESTEAL, reap); 722 __count_vm_events(PGINODESTEAL, reap);
726 spin_unlock(&inode_lru_lock); 723 spin_unlock(&inode_lru_lock);
727 spin_unlock(&inode_lock);
728 724
729 dispose_list(&freeable); 725 dispose_list(&freeable);
730 up_read(&iprune_sem); 726 up_read(&iprune_sem);
@@ -1082,7 +1078,6 @@ EXPORT_SYMBOL(iunique);
1082 1078
1083struct inode *igrab(struct inode *inode) 1079struct inode *igrab(struct inode *inode)
1084{ 1080{
1085 spin_lock(&inode_lock);
1086 spin_lock(&inode->i_lock); 1081 spin_lock(&inode->i_lock);
1087 if (!(inode->i_state & (I_FREEING|I_WILL_FREE))) { 1082 if (!(inode->i_state & (I_FREEING|I_WILL_FREE))) {
1088 __iget(inode); 1083 __iget(inode);
@@ -1096,7 +1091,6 @@ struct inode *igrab(struct inode *inode)
1096 */ 1091 */
1097 inode = NULL; 1092 inode = NULL;
1098 } 1093 }
1099 spin_unlock(&inode_lock);
1100 return inode; 1094 return inode;
1101} 1095}
1102EXPORT_SYMBOL(igrab); 1096EXPORT_SYMBOL(igrab);
@@ -1439,7 +1433,6 @@ static void iput_final(struct inode *inode)
1439 const struct super_operations *op = inode->i_sb->s_op; 1433 const struct super_operations *op = inode->i_sb->s_op;
1440 int drop; 1434 int drop;
1441 1435
1442 spin_lock(&inode->i_lock);
1443 WARN_ON(inode->i_state & I_NEW); 1436 WARN_ON(inode->i_state & I_NEW);
1444 1437
1445 if (op && op->drop_inode) 1438 if (op && op->drop_inode)
@@ -1452,16 +1445,13 @@ static void iput_final(struct inode *inode)
1452 if (!(inode->i_state & (I_DIRTY|I_SYNC))) 1445 if (!(inode->i_state & (I_DIRTY|I_SYNC)))
1453 inode_lru_list_add(inode); 1446 inode_lru_list_add(inode);
1454 spin_unlock(&inode->i_lock); 1447 spin_unlock(&inode->i_lock);
1455 spin_unlock(&inode_lock);
1456 return; 1448 return;
1457 } 1449 }
1458 1450
1459 if (!drop) { 1451 if (!drop) {
1460 inode->i_state |= I_WILL_FREE; 1452 inode->i_state |= I_WILL_FREE;
1461 spin_unlock(&inode->i_lock); 1453 spin_unlock(&inode->i_lock);
1462 spin_unlock(&inode_lock);
1463 write_inode_now(inode, 1); 1454 write_inode_now(inode, 1);
1464 spin_lock(&inode_lock);
1465 spin_lock(&inode->i_lock); 1455 spin_lock(&inode->i_lock);
1466 WARN_ON(inode->i_state & I_NEW); 1456 WARN_ON(inode->i_state & I_NEW);
1467 inode->i_state &= ~I_WILL_FREE; 1457 inode->i_state &= ~I_WILL_FREE;
@@ -1470,7 +1460,6 @@ static void iput_final(struct inode *inode)
1470 inode->i_state |= I_FREEING; 1460 inode->i_state |= I_FREEING;
1471 inode_lru_list_del(inode); 1461 inode_lru_list_del(inode);
1472 spin_unlock(&inode->i_lock); 1462 spin_unlock(&inode->i_lock);
1473 spin_unlock(&inode_lock);
1474 1463
1475 evict(inode); 1464 evict(inode);
1476} 1465}
@@ -1489,7 +1478,7 @@ void iput(struct inode *inode)
1489 if (inode) { 1478 if (inode) {
1490 BUG_ON(inode->i_state & I_CLEAR); 1479 BUG_ON(inode->i_state & I_CLEAR);
1491 1480
1492 if (atomic_dec_and_lock(&inode->i_count, &inode_lock)) 1481 if (atomic_dec_and_lock(&inode->i_count, &inode->i_lock))
1493 iput_final(inode); 1482 iput_final(inode);
1494 } 1483 }
1495} 1484}
diff --git a/fs/logfs/inode.c b/fs/logfs/inode.c
index 03b8c240aeda..edfea7a3a747 100644
--- a/fs/logfs/inode.c
+++ b/fs/logfs/inode.c
@@ -293,7 +293,7 @@ static int logfs_write_inode(struct inode *inode, struct writeback_control *wbc)
293 return ret; 293 return ret;
294} 294}
295 295
296/* called with inode_lock held */ 296/* called with inode->i_lock held */
297static int logfs_drop_inode(struct inode *inode) 297static int logfs_drop_inode(struct inode *inode)
298{ 298{
299 struct logfs_super *super = logfs_super(inode->i_sb); 299 struct logfs_super *super = logfs_super(inode->i_sb);