]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - mm/shmem.c
stmmac: add init/exit callback in plat_stmmacenet_data struct
[net-next-2.6.git] / mm / shmem.c
index dfaa0f4e9789f5e8f395ac1dee7975c1abffdc1d..47fdeeb9d63685e708d2775216768dfc49f735dc 100644 (file)
@@ -1586,6 +1586,7 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode
 
        inode = new_inode(sb);
        if (inode) {
+               inode->i_ino = get_next_ino();
                inode_init_owner(inode, dir, mode);
                inode->i_blocks = 0;
                inode->i_mapping->backing_dev_info = &shmem_backing_dev_info;
@@ -1903,7 +1904,7 @@ static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentr
        dir->i_size += BOGO_DIRENT_SIZE;
        inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
        inc_nlink(inode);
-       atomic_inc(&inode->i_count);    /* New dentry reference */
+       ihold(inode);   /* New dentry reference */
        dget(dentry);           /* Extra pinning count for the created dentry */
        d_instantiate(dentry, inode);
 out:
@@ -2146,7 +2147,7 @@ static int shmem_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
        if (*len < 3)
                return 255;
 
-       if (hlist_unhashed(&inode->i_hash)) {
+       if (inode_unhashed(inode)) {
                /* Unfortunately insert_inode_hash is not idempotent,
                 * so as we hash inodes here rather than at creation
                 * time, we need a lock to ensure we only try
@@ -2154,7 +2155,7 @@ static int shmem_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
                 */
                static DEFINE_SPINLOCK(lock);
                spin_lock(&lock);
-               if (hlist_unhashed(&inode->i_hash))
+               if (inode_unhashed(inode))
                        __insert_inode_hash(inode,
                                            inode->i_ino + inode->i_generation);
                spin_unlock(&lock);
@@ -2325,7 +2326,10 @@ static int shmem_show_options(struct seq_file *seq, struct vfsmount *vfs)
 
 static void shmem_put_super(struct super_block *sb)
 {
-       kfree(sb->s_fs_info);
+       struct shmem_sb_info *sbinfo = SHMEM_SB(sb);
+
+       percpu_counter_destroy(&sbinfo->used_blocks);
+       kfree(sbinfo);
        sb->s_fs_info = NULL;
 }
 
@@ -2367,7 +2371,8 @@ int shmem_fill_super(struct super_block *sb, void *data, int silent)
 #endif
 
        spin_lock_init(&sbinfo->stat_lock);
-       percpu_counter_init(&sbinfo->used_blocks, 0);
+       if (percpu_counter_init(&sbinfo->used_blocks, 0))
+               goto failed;
        sbinfo->free_inodes = sbinfo->max_inodes;
 
        sb->s_maxbytes = SHMEM_MAX_BYTES;
@@ -2533,16 +2538,16 @@ static const struct vm_operations_struct shmem_vm_ops = {
 };
 
 
-static int shmem_get_sb(struct file_system_type *fs_type,
-       int flags, const char *dev_name, void *data, struct vfsmount *mnt)
+static struct dentry *shmem_mount(struct file_system_type *fs_type,
+       int flags, const char *dev_name, void *data)
 {
-       return get_sb_nodev(fs_type, flags, data, shmem_fill_super, mnt);
+       return mount_nodev(fs_type, flags, data, shmem_fill_super);
 }
 
 static struct file_system_type tmpfs_fs_type = {
        .owner          = THIS_MODULE,
        .name           = "tmpfs",
-       .get_sb         = shmem_get_sb,
+       .mount          = shmem_mount,
        .kill_sb        = kill_litter_super,
 };
 
@@ -2638,7 +2643,7 @@ out:
 
 static struct file_system_type tmpfs_fs_type = {
        .name           = "tmpfs",
-       .get_sb         = ramfs_get_sb,
+       .mount          = ramfs_mount,
        .kill_sb        = kill_litter_super,
 };