aboutsummaryrefslogtreecommitdiffstats
path: root/fs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/fs/inode.c b/fs/inode.c
index 7de1cda92489..0013ac1af8e7 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -22,6 +22,7 @@
22#include <linux/bootmem.h> 22#include <linux/bootmem.h>
23#include <linux/inotify.h> 23#include <linux/inotify.h>
24#include <linux/mount.h> 24#include <linux/mount.h>
25#include <linux/async.h>
25 26
26/* 27/*
27 * This is needed for the following functions: 28 * This is needed for the following functions:
@@ -110,8 +111,8 @@ static void wake_up_inode(struct inode *inode)
110 111
111/** 112/**
112 * inode_init_always - perform inode structure intialisation 113 * inode_init_always - perform inode structure intialisation
113 * @sb - superblock inode belongs to. 114 * @sb: superblock inode belongs to
114 * @inode - inode to initialise 115 * @inode: inode to initialise
115 * 116 *
116 * These are initializations that need to be done on every inode 117 * These are initializations that need to be done on every inode
117 * allocation as the fields are not initialised by slab allocation. 118 * allocation as the fields are not initialised by slab allocation.
@@ -131,6 +132,8 @@ struct inode *inode_init_always(struct super_block *sb, struct inode *inode)
131 inode->i_op = &empty_iops; 132 inode->i_op = &empty_iops;
132 inode->i_fop = &empty_fops; 133 inode->i_fop = &empty_fops;
133 inode->i_nlink = 1; 134 inode->i_nlink = 1;
135 inode->i_uid = 0;
136 inode->i_gid = 0;
134 atomic_set(&inode->i_writecount, 0); 137 atomic_set(&inode->i_writecount, 0);
135 inode->i_size = 0; 138 inode->i_size = 0;
136 inode->i_blocks = 0; 139 inode->i_blocks = 0;
@@ -164,7 +167,7 @@ struct inode *inode_init_always(struct super_block *sb, struct inode *inode)
164 mapping->a_ops = &empty_aops; 167 mapping->a_ops = &empty_aops;
165 mapping->host = inode; 168 mapping->host = inode;
166 mapping->flags = 0; 169 mapping->flags = 0;
167 mapping_set_gfp_mask(mapping, GFP_HIGHUSER_PAGECACHE); 170 mapping_set_gfp_mask(mapping, GFP_HIGHUSER_MOVABLE);
168 mapping->assoc_mapping = NULL; 171 mapping->assoc_mapping = NULL;
169 mapping->backing_dev_info = &default_backing_dev_info; 172 mapping->backing_dev_info = &default_backing_dev_info;
170 mapping->writeback_index = 0; 173 mapping->writeback_index = 0;
@@ -574,8 +577,8 @@ __inode_add_to_lists(struct super_block *sb, struct hlist_head *head,
574 577
575/** 578/**
576 * inode_add_to_lists - add a new inode to relevant lists 579 * inode_add_to_lists - add a new inode to relevant lists
577 * @sb - superblock inode belongs to. 580 * @sb: superblock inode belongs to
578 * @inode - inode to mark in use 581 * @inode: inode to mark in use
579 * 582 *
580 * When an inode is allocated it needs to be accounted for, added to the in use 583 * When an inode is allocated it needs to be accounted for, added to the in use
581 * list, the owning superblock and the inode hash. This needs to be done under 584 * list, the owning superblock and the inode hash. This needs to be done under
@@ -599,7 +602,7 @@ EXPORT_SYMBOL_GPL(inode_add_to_lists);
599 * @sb: superblock 602 * @sb: superblock
600 * 603 *
601 * Allocates a new inode for given superblock. The default gfp_mask 604 * Allocates a new inode for given superblock. The default gfp_mask
602 * for allocations related to inode->i_mapping is GFP_HIGHUSER_PAGECACHE. 605 * for allocations related to inode->i_mapping is GFP_HIGHUSER_MOVABLE.
603 * If HIGHMEM pages are unsuitable or it is known that pages allocated 606 * If HIGHMEM pages are unsuitable or it is known that pages allocated
604 * for the page cache are not reclaimable or migratable, 607 * for the page cache are not reclaimable or migratable,
605 * mapping_set_gfp_mask() must be called with suitable flags on the 608 * mapping_set_gfp_mask() must be called with suitable flags on the
@@ -1136,16 +1139,11 @@ EXPORT_SYMBOL(remove_inode_hash);
1136 * I_FREEING is set so that no-one will take a new reference to the inode while 1139 * I_FREEING is set so that no-one will take a new reference to the inode while
1137 * it is being deleted. 1140 * it is being deleted.
1138 */ 1141 */
1139void generic_delete_inode(struct inode *inode) 1142static void generic_delete_inode_async(void *data, async_cookie_t cookie)
1140{ 1143{
1144 struct inode *inode = data;
1141 const struct super_operations *op = inode->i_sb->s_op; 1145 const struct super_operations *op = inode->i_sb->s_op;
1142 1146
1143 list_del_init(&inode->i_list);
1144 list_del_init(&inode->i_sb_list);
1145 inode->i_state |= I_FREEING;
1146 inodes_stat.nr_inodes--;
1147 spin_unlock(&inode_lock);
1148
1149 security_inode_delete(inode); 1147 security_inode_delete(inode);
1150 1148
1151 if (op->delete_inode) { 1149 if (op->delete_inode) {
@@ -1169,6 +1167,16 @@ void generic_delete_inode(struct inode *inode)
1169 destroy_inode(inode); 1167 destroy_inode(inode);
1170} 1168}
1171 1169
1170void generic_delete_inode(struct inode *inode)
1171{
1172 list_del_init(&inode->i_list);
1173 list_del_init(&inode->i_sb_list);
1174 inode->i_state |= I_FREEING;
1175 inodes_stat.nr_inodes--;
1176 spin_unlock(&inode_lock);
1177 async_schedule_special(generic_delete_inode_async, inode, &inode->i_sb->s_async_list);
1178}
1179
1172EXPORT_SYMBOL(generic_delete_inode); 1180EXPORT_SYMBOL(generic_delete_inode);
1173 1181
1174static void generic_forget_inode(struct inode *inode) 1182static void generic_forget_inode(struct inode *inode)