diff options
-rw-r--r-- | drivers/staging/pohmelfs/inode.c | 4 | ||||
-rw-r--r-- | fs/btrfs/ctree.h | 2 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 11 | ||||
-rw-r--r-- | fs/cifs/cifsfs.c | 9 | ||||
-rw-r--r-- | fs/gfs2/super.c | 4 | ||||
-rw-r--r-- | fs/inode.c | 113 | ||||
-rw-r--r-- | fs/logfs/inode.c | 4 | ||||
-rw-r--r-- | fs/ocfs2/inode.c | 8 | ||||
-rw-r--r-- | fs/ocfs2/inode.h | 2 | ||||
-rw-r--r-- | include/linux/fs.h | 6 |
10 files changed, 60 insertions, 103 deletions
diff --git a/drivers/staging/pohmelfs/inode.c b/drivers/staging/pohmelfs/inode.c index e818f53ccfd7..100e3a3c1b10 100644 --- a/drivers/staging/pohmelfs/inode.c +++ b/drivers/staging/pohmelfs/inode.c | |||
@@ -1223,7 +1223,7 @@ void pohmelfs_fill_inode(struct inode *inode, struct netfs_inode_info *info) | |||
1223 | } | 1223 | } |
1224 | } | 1224 | } |
1225 | 1225 | ||
1226 | static void pohmelfs_drop_inode(struct inode *inode) | 1226 | static int pohmelfs_drop_inode(struct inode *inode) |
1227 | { | 1227 | { |
1228 | struct pohmelfs_sb *psb = POHMELFS_SB(inode->i_sb); | 1228 | struct pohmelfs_sb *psb = POHMELFS_SB(inode->i_sb); |
1229 | struct pohmelfs_inode *pi = POHMELFS_I(inode); | 1229 | struct pohmelfs_inode *pi = POHMELFS_I(inode); |
@@ -1232,7 +1232,7 @@ static void pohmelfs_drop_inode(struct inode *inode) | |||
1232 | list_del_init(&pi->inode_entry); | 1232 | list_del_init(&pi->inode_entry); |
1233 | spin_unlock(&psb->ino_lock); | 1233 | spin_unlock(&psb->ino_lock); |
1234 | 1234 | ||
1235 | generic_drop_inode(inode); | 1235 | return generic_drop_inode(inode); |
1236 | } | 1236 | } |
1237 | 1237 | ||
1238 | static struct pohmelfs_inode *pohmelfs_get_inode_from_list(struct pohmelfs_sb *psb, | 1238 | static struct pohmelfs_inode *pohmelfs_get_inode_from_list(struct pohmelfs_sb *psb, |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 394d5422ab6a..eaf286abad17 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -2395,7 +2395,7 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc); | |||
2395 | void btrfs_dirty_inode(struct inode *inode); | 2395 | void btrfs_dirty_inode(struct inode *inode); |
2396 | struct inode *btrfs_alloc_inode(struct super_block *sb); | 2396 | struct inode *btrfs_alloc_inode(struct super_block *sb); |
2397 | void btrfs_destroy_inode(struct inode *inode); | 2397 | void btrfs_destroy_inode(struct inode *inode); |
2398 | void btrfs_drop_inode(struct inode *inode); | 2398 | int btrfs_drop_inode(struct inode *inode); |
2399 | int btrfs_init_cachep(void); | 2399 | int btrfs_init_cachep(void); |
2400 | void btrfs_destroy_cachep(void); | 2400 | void btrfs_destroy_cachep(void); |
2401 | long btrfs_ioctl_trans_end(struct file *file); | 2401 | long btrfs_ioctl_trans_end(struct file *file); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index ce02199ec4e5..2c54f04a0bf5 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -3943,7 +3943,7 @@ again: | |||
3943 | if (atomic_read(&inode->i_count) > 1) | 3943 | if (atomic_read(&inode->i_count) > 1) |
3944 | d_prune_aliases(inode); | 3944 | d_prune_aliases(inode); |
3945 | /* | 3945 | /* |
3946 | * btrfs_drop_inode will remove it from | 3946 | * btrfs_drop_inode will have it removed from |
3947 | * the inode cache when its usage count | 3947 | * the inode cache when its usage count |
3948 | * hits zero. | 3948 | * hits zero. |
3949 | */ | 3949 | */ |
@@ -6337,13 +6337,14 @@ free: | |||
6337 | kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode)); | 6337 | kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode)); |
6338 | } | 6338 | } |
6339 | 6339 | ||
6340 | void btrfs_drop_inode(struct inode *inode) | 6340 | int btrfs_drop_inode(struct inode *inode) |
6341 | { | 6341 | { |
6342 | struct btrfs_root *root = BTRFS_I(inode)->root; | 6342 | struct btrfs_root *root = BTRFS_I(inode)->root; |
6343 | if (inode->i_nlink > 0 && btrfs_root_refs(&root->root_item) == 0) | 6343 | |
6344 | generic_delete_inode(inode); | 6344 | if (btrfs_root_refs(&root->root_item) == 0) |
6345 | return 1; | ||
6345 | else | 6346 | else |
6346 | generic_drop_inode(inode); | 6347 | return generic_drop_inode(inode); |
6347 | } | 6348 | } |
6348 | 6349 | ||
6349 | static void init_once(void *foo) | 6350 | static void init_once(void *foo) |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 8a2cf129e535..20914f5627dd 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -480,14 +480,13 @@ static int cifs_remount(struct super_block *sb, int *flags, char *data) | |||
480 | return 0; | 480 | return 0; |
481 | } | 481 | } |
482 | 482 | ||
483 | void cifs_drop_inode(struct inode *inode) | 483 | static int cifs_drop_inode(struct inode *inode) |
484 | { | 484 | { |
485 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 485 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
486 | 486 | ||
487 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) | 487 | /* no serverino => unconditional eviction */ |
488 | return generic_drop_inode(inode); | 488 | return !(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) || |
489 | 489 | generic_drop_inode(inode); | |
490 | return generic_delete_inode(inode); | ||
491 | } | 490 | } |
492 | 491 | ||
493 | static const struct super_operations cifs_super_ops = { | 492 | static const struct super_operations cifs_super_ops = { |
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 555f5a417c67..fa865ab37f12 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -1191,7 +1191,7 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data) | |||
1191 | * node for later deallocation. | 1191 | * node for later deallocation. |
1192 | */ | 1192 | */ |
1193 | 1193 | ||
1194 | static void gfs2_drop_inode(struct inode *inode) | 1194 | static int gfs2_drop_inode(struct inode *inode) |
1195 | { | 1195 | { |
1196 | struct gfs2_inode *ip = GFS2_I(inode); | 1196 | struct gfs2_inode *ip = GFS2_I(inode); |
1197 | 1197 | ||
@@ -1200,7 +1200,7 @@ static void gfs2_drop_inode(struct inode *inode) | |||
1200 | if (gl && test_bit(GLF_DEMOTE, &gl->gl_flags)) | 1200 | if (gl && test_bit(GLF_DEMOTE, &gl->gl_flags)) |
1201 | clear_nlink(inode); | 1201 | clear_nlink(inode); |
1202 | } | 1202 | } |
1203 | generic_drop_inode(inode); | 1203 | return generic_drop_inode(inode); |
1204 | } | 1204 | } |
1205 | 1205 | ||
1206 | static int is_ancestor(const struct dentry *d1, const struct dentry *d2) | 1206 | static int is_ancestor(const struct dentry *d1, const struct dentry *d2) |
diff --git a/fs/inode.c b/fs/inode.c index 82ca3562a688..0e077619cbf6 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -1183,58 +1183,51 @@ void remove_inode_hash(struct inode *inode) | |||
1183 | } | 1183 | } |
1184 | EXPORT_SYMBOL(remove_inode_hash); | 1184 | EXPORT_SYMBOL(remove_inode_hash); |
1185 | 1185 | ||
1186 | int generic_delete_inode(struct inode *inode) | ||
1187 | { | ||
1188 | return 1; | ||
1189 | } | ||
1190 | EXPORT_SYMBOL(generic_delete_inode); | ||
1191 | |||
1186 | /* | 1192 | /* |
1187 | * Tell the filesystem that this inode is no longer of any interest and should | 1193 | * Normal UNIX filesystem behaviour: delete the |
1188 | * be completely destroyed. | 1194 | * inode when the usage count drops to zero, and |
1189 | * | 1195 | * i_nlink is zero. |
1190 | * We leave the inode in the inode hash table until *after* the filesystem's | ||
1191 | * ->delete_inode completes. This ensures that an iget (such as nfsd might | ||
1192 | * instigate) will always find up-to-date information either in the hash or on | ||
1193 | * disk. | ||
1194 | * | ||
1195 | * I_FREEING is set so that no-one will take a new reference to the inode while | ||
1196 | * it is being deleted. | ||
1197 | */ | 1196 | */ |
1198 | void generic_delete_inode(struct inode *inode) | 1197 | int generic_drop_inode(struct inode *inode) |
1199 | { | 1198 | { |
1200 | list_del_init(&inode->i_list); | 1199 | return !inode->i_nlink || hlist_unhashed(&inode->i_hash); |
1201 | list_del_init(&inode->i_sb_list); | ||
1202 | WARN_ON(inode->i_state & I_NEW); | ||
1203 | inode->i_state |= I_FREEING; | ||
1204 | inodes_stat.nr_inodes--; | ||
1205 | spin_unlock(&inode_lock); | ||
1206 | |||
1207 | evict(inode); | ||
1208 | |||
1209 | spin_lock(&inode_lock); | ||
1210 | hlist_del_init(&inode->i_hash); | ||
1211 | spin_unlock(&inode_lock); | ||
1212 | wake_up_inode(inode); | ||
1213 | BUG_ON(inode->i_state != (I_FREEING | I_CLEAR)); | ||
1214 | destroy_inode(inode); | ||
1215 | } | 1200 | } |
1216 | EXPORT_SYMBOL(generic_delete_inode); | 1201 | EXPORT_SYMBOL_GPL(generic_drop_inode); |
1217 | 1202 | ||
1218 | /** | 1203 | /* |
1219 | * generic_detach_inode - remove inode from inode lists | 1204 | * Called when we're dropping the last reference |
1220 | * @inode: inode to remove | 1205 | * to an inode. |
1221 | * | ||
1222 | * Remove inode from inode lists, write it if it's dirty. This is just an | ||
1223 | * internal VFS helper exported for hugetlbfs. Do not use! | ||
1224 | * | 1206 | * |
1225 | * Returns 1 if inode should be completely destroyed. | 1207 | * Call the FS "drop_inode()" function, defaulting to |
1208 | * the legacy UNIX filesystem behaviour. If it tells | ||
1209 | * us to evict inode, do so. Otherwise, retain inode | ||
1210 | * in cache if fs is alive, sync and evict if fs is | ||
1211 | * shutting down. | ||
1226 | */ | 1212 | */ |
1227 | static int generic_detach_inode(struct inode *inode) | 1213 | static void iput_final(struct inode *inode) |
1228 | { | 1214 | { |
1229 | struct super_block *sb = inode->i_sb; | 1215 | struct super_block *sb = inode->i_sb; |
1216 | const struct super_operations *op = inode->i_sb->s_op; | ||
1217 | int drop; | ||
1218 | |||
1219 | if (op && op->drop_inode) | ||
1220 | drop = op->drop_inode(inode); | ||
1221 | else | ||
1222 | drop = generic_drop_inode(inode); | ||
1230 | 1223 | ||
1231 | if (!hlist_unhashed(&inode->i_hash)) { | 1224 | if (!drop) { |
1232 | if (!(inode->i_state & (I_DIRTY|I_SYNC))) | 1225 | if (!(inode->i_state & (I_DIRTY|I_SYNC))) |
1233 | list_move(&inode->i_list, &inode_unused); | 1226 | list_move(&inode->i_list, &inode_unused); |
1234 | inodes_stat.nr_unused++; | 1227 | inodes_stat.nr_unused++; |
1235 | if (sb->s_flags & MS_ACTIVE) { | 1228 | if (sb->s_flags & MS_ACTIVE) { |
1236 | spin_unlock(&inode_lock); | 1229 | spin_unlock(&inode_lock); |
1237 | return 0; | 1230 | return; |
1238 | } | 1231 | } |
1239 | WARN_ON(inode->i_state & I_NEW); | 1232 | WARN_ON(inode->i_state & I_NEW); |
1240 | inode->i_state |= I_WILL_FREE; | 1233 | inode->i_state |= I_WILL_FREE; |
@@ -1252,53 +1245,15 @@ static int generic_detach_inode(struct inode *inode) | |||
1252 | inode->i_state |= I_FREEING; | 1245 | inode->i_state |= I_FREEING; |
1253 | inodes_stat.nr_inodes--; | 1246 | inodes_stat.nr_inodes--; |
1254 | spin_unlock(&inode_lock); | 1247 | spin_unlock(&inode_lock); |
1255 | return 1; | ||
1256 | } | ||
1257 | |||
1258 | static void generic_forget_inode(struct inode *inode) | ||
1259 | { | ||
1260 | if (!generic_detach_inode(inode)) | ||
1261 | return; | ||
1262 | evict(inode); | 1248 | evict(inode); |
1249 | spin_lock(&inode_lock); | ||
1250 | hlist_del_init(&inode->i_hash); | ||
1251 | spin_unlock(&inode_lock); | ||
1263 | wake_up_inode(inode); | 1252 | wake_up_inode(inode); |
1253 | BUG_ON(inode->i_state != (I_FREEING | I_CLEAR)); | ||
1264 | destroy_inode(inode); | 1254 | destroy_inode(inode); |
1265 | } | 1255 | } |
1266 | 1256 | ||
1267 | /* | ||
1268 | * Normal UNIX filesystem behaviour: delete the | ||
1269 | * inode when the usage count drops to zero, and | ||
1270 | * i_nlink is zero. | ||
1271 | */ | ||
1272 | void generic_drop_inode(struct inode *inode) | ||
1273 | { | ||
1274 | if (!inode->i_nlink) | ||
1275 | generic_delete_inode(inode); | ||
1276 | else | ||
1277 | generic_forget_inode(inode); | ||
1278 | } | ||
1279 | EXPORT_SYMBOL_GPL(generic_drop_inode); | ||
1280 | |||
1281 | /* | ||
1282 | * Called when we're dropping the last reference | ||
1283 | * to an inode. | ||
1284 | * | ||
1285 | * Call the FS "drop()" function, defaulting to | ||
1286 | * the legacy UNIX filesystem behaviour.. | ||
1287 | * | ||
1288 | * NOTE! NOTE! NOTE! We're called with the inode lock | ||
1289 | * held, and the drop function is supposed to release | ||
1290 | * the lock! | ||
1291 | */ | ||
1292 | static inline void iput_final(struct inode *inode) | ||
1293 | { | ||
1294 | const struct super_operations *op = inode->i_sb->s_op; | ||
1295 | void (*drop)(struct inode *) = generic_drop_inode; | ||
1296 | |||
1297 | if (op && op->drop_inode) | ||
1298 | drop = op->drop_inode; | ||
1299 | drop(inode); | ||
1300 | } | ||
1301 | |||
1302 | /** | 1257 | /** |
1303 | * iput - put an inode | 1258 | * iput - put an inode |
1304 | * @inode: inode to put | 1259 | * @inode: inode to put |
diff --git a/fs/logfs/inode.c b/fs/logfs/inode.c index 78be674d95c8..d8c71ece098f 100644 --- a/fs/logfs/inode.c +++ b/fs/logfs/inode.c | |||
@@ -287,7 +287,7 @@ static int logfs_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
287 | } | 287 | } |
288 | 288 | ||
289 | /* called with inode_lock held */ | 289 | /* called with inode_lock held */ |
290 | static void logfs_drop_inode(struct inode *inode) | 290 | static int logfs_drop_inode(struct inode *inode) |
291 | { | 291 | { |
292 | struct logfs_super *super = logfs_super(inode->i_sb); | 292 | struct logfs_super *super = logfs_super(inode->i_sb); |
293 | struct logfs_inode *li = logfs_inode(inode); | 293 | struct logfs_inode *li = logfs_inode(inode); |
@@ -295,7 +295,7 @@ static void logfs_drop_inode(struct inode *inode) | |||
295 | spin_lock(&logfs_inode_lock); | 295 | spin_lock(&logfs_inode_lock); |
296 | list_move(&li->li_freeing_list, &super->s_freeing_list); | 296 | list_move(&li->li_freeing_list, &super->s_freeing_list); |
297 | spin_unlock(&logfs_inode_lock); | 297 | spin_unlock(&logfs_inode_lock); |
298 | generic_drop_inode(inode); | 298 | return generic_drop_inode(inode); |
299 | } | 299 | } |
300 | 300 | ||
301 | static void logfs_set_ino_generation(struct super_block *sb, | 301 | static void logfs_set_ino_generation(struct super_block *sb, |
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index eb7fd07c90f2..0492464916b1 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -1194,9 +1194,10 @@ void ocfs2_evict_inode(struct inode *inode) | |||
1194 | /* Called under inode_lock, with no more references on the | 1194 | /* Called under inode_lock, with no more references on the |
1195 | * struct inode, so it's safe here to check the flags field | 1195 | * struct inode, so it's safe here to check the flags field |
1196 | * and to manipulate i_nlink without any other locks. */ | 1196 | * and to manipulate i_nlink without any other locks. */ |
1197 | void ocfs2_drop_inode(struct inode *inode) | 1197 | int ocfs2_drop_inode(struct inode *inode) |
1198 | { | 1198 | { |
1199 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 1199 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
1200 | int res; | ||
1200 | 1201 | ||
1201 | mlog_entry_void(); | 1202 | mlog_entry_void(); |
1202 | 1203 | ||
@@ -1204,11 +1205,12 @@ void ocfs2_drop_inode(struct inode *inode) | |||
1204 | (unsigned long long)oi->ip_blkno, inode->i_nlink, oi->ip_flags); | 1205 | (unsigned long long)oi->ip_blkno, inode->i_nlink, oi->ip_flags); |
1205 | 1206 | ||
1206 | if (oi->ip_flags & OCFS2_INODE_MAYBE_ORPHANED) | 1207 | if (oi->ip_flags & OCFS2_INODE_MAYBE_ORPHANED) |
1207 | generic_delete_inode(inode); | 1208 | res = 1; |
1208 | else | 1209 | else |
1209 | generic_drop_inode(inode); | 1210 | res = generic_drop_inode(inode); |
1210 | 1211 | ||
1211 | mlog_exit_void(); | 1212 | mlog_exit_void(); |
1213 | return res; | ||
1212 | } | 1214 | } |
1213 | 1215 | ||
1214 | /* | 1216 | /* |
diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h index 975eedd7b243..6de5a869db30 100644 --- a/fs/ocfs2/inode.h +++ b/fs/ocfs2/inode.h | |||
@@ -124,7 +124,7 @@ static inline struct ocfs2_caching_info *INODE_CACHE(struct inode *inode) | |||
124 | } | 124 | } |
125 | 125 | ||
126 | void ocfs2_evict_inode(struct inode *inode); | 126 | void ocfs2_evict_inode(struct inode *inode); |
127 | void ocfs2_drop_inode(struct inode *inode); | 127 | int ocfs2_drop_inode(struct inode *inode); |
128 | 128 | ||
129 | /* Flags for ocfs2_iget() */ | 129 | /* Flags for ocfs2_iget() */ |
130 | #define OCFS2_FI_FLAG_SYSFILE 0x1 | 130 | #define OCFS2_FI_FLAG_SYSFILE 0x1 |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 4eaa6b2e35db..8553adbda57b 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1562,7 +1562,7 @@ struct super_operations { | |||
1562 | 1562 | ||
1563 | void (*dirty_inode) (struct inode *); | 1563 | void (*dirty_inode) (struct inode *); |
1564 | int (*write_inode) (struct inode *, struct writeback_control *wbc); | 1564 | int (*write_inode) (struct inode *, struct writeback_control *wbc); |
1565 | void (*drop_inode) (struct inode *); | 1565 | int (*drop_inode) (struct inode *); |
1566 | void (*evict_inode) (struct inode *); | 1566 | void (*evict_inode) (struct inode *); |
1567 | void (*put_super) (struct super_block *); | 1567 | void (*put_super) (struct super_block *); |
1568 | void (*write_super) (struct super_block *); | 1568 | void (*write_super) (struct super_block *); |
@@ -2164,8 +2164,8 @@ extern void iput(struct inode *); | |||
2164 | extern struct inode * igrab(struct inode *); | 2164 | extern struct inode * igrab(struct inode *); |
2165 | extern ino_t iunique(struct super_block *, ino_t); | 2165 | extern ino_t iunique(struct super_block *, ino_t); |
2166 | extern int inode_needs_sync(struct inode *inode); | 2166 | extern int inode_needs_sync(struct inode *inode); |
2167 | extern void generic_delete_inode(struct inode *inode); | 2167 | extern int generic_delete_inode(struct inode *inode); |
2168 | extern void generic_drop_inode(struct inode *inode); | 2168 | extern int generic_drop_inode(struct inode *inode); |
2169 | 2169 | ||
2170 | extern struct inode *ilookup5_nowait(struct super_block *sb, | 2170 | extern struct inode *ilookup5_nowait(struct super_block *sb, |
2171 | unsigned long hashval, int (*test)(struct inode *, void *), | 2171 | unsigned long hashval, int (*test)(struct inode *, void *), |