aboutsummaryrefslogtreecommitdiffstats
path: root/fs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c40
1 files changed, 10 insertions, 30 deletions
diff --git a/fs/inode.c b/fs/inode.c
index fb10d86ffad7..9f4f5fecc096 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -2,29 +2,19 @@
2 * (C) 1997 Linus Torvalds 2 * (C) 1997 Linus Torvalds
3 * (C) 1999 Andrea Arcangeli <andrea@suse.de> (dynamic inode allocation) 3 * (C) 1999 Andrea Arcangeli <andrea@suse.de> (dynamic inode allocation)
4 */ 4 */
5#include <linux/export.h>
5#include <linux/fs.h> 6#include <linux/fs.h>
6#include <linux/mm.h> 7#include <linux/mm.h>
7#include <linux/dcache.h>
8#include <linux/init.h>
9#include <linux/slab.h>
10#include <linux/writeback.h>
11#include <linux/module.h>
12#include <linux/backing-dev.h> 8#include <linux/backing-dev.h>
13#include <linux/wait.h>
14#include <linux/rwsem.h>
15#include <linux/hash.h> 9#include <linux/hash.h>
16#include <linux/swap.h> 10#include <linux/swap.h>
17#include <linux/security.h> 11#include <linux/security.h>
18#include <linux/pagemap.h>
19#include <linux/cdev.h> 12#include <linux/cdev.h>
20#include <linux/bootmem.h> 13#include <linux/bootmem.h>
21#include <linux/fsnotify.h> 14#include <linux/fsnotify.h>
22#include <linux/mount.h> 15#include <linux/mount.h>
23#include <linux/async.h>
24#include <linux/posix_acl.h> 16#include <linux/posix_acl.h>
25#include <linux/prefetch.h> 17#include <linux/prefetch.h>
26#include <linux/ima.h>
27#include <linux/cred.h>
28#include <linux/buffer_head.h> /* for inode_has_buffers */ 18#include <linux/buffer_head.h> /* for inode_has_buffers */
29#include <linux/ratelimit.h> 19#include <linux/ratelimit.h>
30#include "internal.h" 20#include "internal.h"
@@ -938,8 +928,7 @@ void lockdep_annotate_inode_mutex_key(struct inode *inode)
938 struct file_system_type *type = inode->i_sb->s_type; 928 struct file_system_type *type = inode->i_sb->s_type;
939 929
940 /* Set new key only if filesystem hasn't already changed it */ 930 /* Set new key only if filesystem hasn't already changed it */
941 if (!lockdep_match_class(&inode->i_mutex, 931 if (lockdep_match_class(&inode->i_mutex, &type->i_mutex_key)) {
942 &type->i_mutex_key)) {
943 /* 932 /*
944 * ensure nobody is actually holding i_mutex 933 * ensure nobody is actually holding i_mutex
945 */ 934 */
@@ -966,6 +955,7 @@ void unlock_new_inode(struct inode *inode)
966 spin_lock(&inode->i_lock); 955 spin_lock(&inode->i_lock);
967 WARN_ON(!(inode->i_state & I_NEW)); 956 WARN_ON(!(inode->i_state & I_NEW));
968 inode->i_state &= ~I_NEW; 957 inode->i_state &= ~I_NEW;
958 smp_mb();
969 wake_up_bit(&inode->i_state, __I_NEW); 959 wake_up_bit(&inode->i_state, __I_NEW);
970 spin_unlock(&inode->i_lock); 960 spin_unlock(&inode->i_lock);
971} 961}
@@ -1369,17 +1359,6 @@ int generic_delete_inode(struct inode *inode)
1369EXPORT_SYMBOL(generic_delete_inode); 1359EXPORT_SYMBOL(generic_delete_inode);
1370 1360
1371/* 1361/*
1372 * Normal UNIX filesystem behaviour: delete the
1373 * inode when the usage count drops to zero, and
1374 * i_nlink is zero.
1375 */
1376int generic_drop_inode(struct inode *inode)
1377{
1378 return !inode->i_nlink || inode_unhashed(inode);
1379}
1380EXPORT_SYMBOL_GPL(generic_drop_inode);
1381
1382/*
1383 * Called when we're dropping the last reference 1362 * Called when we're dropping the last reference
1384 * to an inode. 1363 * to an inode.
1385 * 1364 *
@@ -1510,9 +1489,10 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
1510 * This function automatically handles read only file systems and media, 1489 * This function automatically handles read only file systems and media,
1511 * as well as the "noatime" flag and inode specific "noatime" markers. 1490 * as well as the "noatime" flag and inode specific "noatime" markers.
1512 */ 1491 */
1513void touch_atime(struct vfsmount *mnt, struct dentry *dentry) 1492void touch_atime(struct path *path)
1514{ 1493{
1515 struct inode *inode = dentry->d_inode; 1494 struct vfsmount *mnt = path->mnt;
1495 struct inode *inode = path->dentry->d_inode;
1516 struct timespec now; 1496 struct timespec now;
1517 1497
1518 if (inode->i_flags & S_NOATIME) 1498 if (inode->i_flags & S_NOATIME)
@@ -1651,7 +1631,7 @@ __setup("ihash_entries=", set_ihash_entries);
1651 */ 1631 */
1652void __init inode_init_early(void) 1632void __init inode_init_early(void)
1653{ 1633{
1654 int loop; 1634 unsigned int loop;
1655 1635
1656 /* If hashes are distributed across NUMA nodes, defer 1636 /* If hashes are distributed across NUMA nodes, defer
1657 * hash allocation until vmalloc space is available. 1637 * hash allocation until vmalloc space is available.
@@ -1669,13 +1649,13 @@ void __init inode_init_early(void)
1669 &i_hash_mask, 1649 &i_hash_mask,
1670 0); 1650 0);
1671 1651
1672 for (loop = 0; loop < (1 << i_hash_shift); loop++) 1652 for (loop = 0; loop < (1U << i_hash_shift); loop++)
1673 INIT_HLIST_HEAD(&inode_hashtable[loop]); 1653 INIT_HLIST_HEAD(&inode_hashtable[loop]);
1674} 1654}
1675 1655
1676void __init inode_init(void) 1656void __init inode_init(void)
1677{ 1657{
1678 int loop; 1658 unsigned int loop;
1679 1659
1680 /* inode slab cache */ 1660 /* inode slab cache */
1681 inode_cachep = kmem_cache_create("inode_cache", 1661 inode_cachep = kmem_cache_create("inode_cache",
@@ -1699,7 +1679,7 @@ void __init inode_init(void)
1699 &i_hash_mask, 1679 &i_hash_mask,
1700 0); 1680 0);
1701 1681
1702 for (loop = 0; loop < (1 << i_hash_shift); loop++) 1682 for (loop = 0; loop < (1U << i_hash_shift); loop++)
1703 INIT_HLIST_HEAD(&inode_hashtable[loop]); 1683 INIT_HLIST_HEAD(&inode_hashtable[loop]);
1704} 1684}
1705 1685