Skip to content

Commit

Permalink
[PATCH] update filesystems for new delete_inode behavior
Browse files Browse the repository at this point in the history
Update the file systems in fs/ implementing a delete_inode() callback to
call truncate_inode_pages().  One implementation note: In developing this
patch I put the calls to truncate_inode_pages() at the very top of those
filesystems delete_inode() callbacks in order to retain the previous
behavior.  I'm guessing that some of those could probably be optimized.

Signed-off-by: Mark Fasheh <[email protected]>
Acked-by: Christoph Hellwig <[email protected]>
Signed-off-by: Hugh Dickins <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Mark Fasheh authored and Linus Torvalds committed Sep 9, 2005
1 parent e85b565 commit fef2665
Show file tree
Hide file tree
Showing 20 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions fs/affs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ void
affs_delete_inode(struct inode *inode)
{
pr_debug("AFFS: delete_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink);
truncate_inode_pages(&inode->i_data, 0);
inode->i_size = 0;
if (S_ISREG(inode->i_mode))
affs_truncate(inode);
Expand Down
2 changes: 2 additions & 0 deletions fs/bfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ static void bfs_delete_inode(struct inode * inode)

dprintf("ino=%08lx\n", inode->i_ino);

truncate_inode_pages(&inode->i_data, 0);

if (inode->i_ino < BFS_ROOT_INO || inode->i_ino > info->si_lasti) {
printf("invalid ino=%08lx\n", inode->i_ino);
return;
Expand Down
2 changes: 2 additions & 0 deletions fs/ext2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ void ext2_put_inode(struct inode *inode)
*/
void ext2_delete_inode (struct inode * inode)
{
truncate_inode_pages(&inode->i_data, 0);

if (is_bad_inode(inode))
goto no_delete;
EXT2_I(inode)->i_dtime = get_seconds();
Expand Down
2 changes: 2 additions & 0 deletions fs/ext3/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ void ext3_delete_inode (struct inode * inode)
{
handle_t *handle;

truncate_inode_pages(&inode->i_data, 0);

if (is_bad_inode(inode))
goto no_delete;

Expand Down
2 changes: 2 additions & 0 deletions fs/fat/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ EXPORT_SYMBOL(fat_build_inode);

static void fat_delete_inode(struct inode *inode)
{
truncate_inode_pages(&inode->i_data, 0);

if (!is_bad_inode(inode)) {
inode->i_size = 0;
fat_truncate(inode);
Expand Down
1 change: 1 addition & 0 deletions fs/hostfs/hostfs_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ static struct inode *hostfs_alloc_inode(struct super_block *sb)

static void hostfs_delete_inode(struct inode *inode)
{
truncate_inode_pages(&inode->i_data, 0);
if(HOSTFS_I(inode)->fd != -1) {
close_file(&HOSTFS_I(inode)->fd);
HOSTFS_I(inode)->fd = -1;
Expand Down
1 change: 1 addition & 0 deletions fs/hpfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ void hpfs_write_if_changed(struct inode *inode)

void hpfs_delete_inode(struct inode *inode)
{
truncate_inode_pages(&inode->i_data, 0);
lock_kernel();
hpfs_remove_fnode(inode->i_sb, inode->i_ino);
unlock_kernel();
Expand Down
1 change: 1 addition & 0 deletions fs/jffs/inode-v23.c
Original file line number Diff line number Diff line change
Expand Up @@ -1744,6 +1744,7 @@ jffs_delete_inode(struct inode *inode)
D3(printk("jffs_delete_inode(): inode->i_ino == %lu\n",
inode->i_ino));

truncate_inode_pages(&inode->i_data, 0);
lock_kernel();
inode->i_size = 0;
inode->i_blocks = 0;
Expand Down
2 changes: 2 additions & 0 deletions fs/jfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ void jfs_delete_inode(struct inode *inode)
(JFS_IP(inode)->fileset != cpu_to_le32(FILESYSTEM_I)))
return;

truncate_inode_pages(&inode->i_data, 0);

if (test_cflag(COMMIT_Freewmap, inode))
jfs_free_zero_link(inode);

Expand Down
1 change: 1 addition & 0 deletions fs/minix/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ static int minix_remount (struct super_block * sb, int * flags, char * data);

static void minix_delete_inode(struct inode *inode)
{
truncate_inode_pages(&inode->i_data, 0);
inode->i_size = 0;
minix_truncate(inode);
minix_free_inode(inode);
Expand Down
2 changes: 2 additions & 0 deletions fs/ncpfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ ncp_iget(struct super_block *sb, struct ncp_entry_info *info)
static void
ncp_delete_inode(struct inode *inode)
{
truncate_inode_pages(&inode->i_data, 0);

if (S_ISDIR(inode->i_mode)) {
DDPRINTK("ncp_delete_inode: put directory %ld\n", inode->i_ino);
}
Expand Down
2 changes: 2 additions & 0 deletions fs/nfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ nfs_delete_inode(struct inode * inode)
{
dprintk("NFS: delete_inode(%s/%ld)\n", inode->i_sb->s_id, inode->i_ino);

truncate_inode_pages(&inode->i_data, 0);

nfs_wb_all(inode);
/*
* The following should never happen...
Expand Down
2 changes: 2 additions & 0 deletions fs/proc/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ static void proc_delete_inode(struct inode *inode)
struct proc_dir_entry *de;
struct task_struct *tsk;

truncate_inode_pages(&inode->i_data, 0);

/* Let go of any associated process */
tsk = PROC_I(inode)->task;
if (tsk)
Expand Down
1 change: 1 addition & 0 deletions fs/qnx4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ int qnx4_sync_inode(struct inode *inode)
static void qnx4_delete_inode(struct inode *inode)
{
QNX4DEBUG(("qnx4: deleting inode [%lu]\n", (unsigned long) inode->i_ino));
truncate_inode_pages(&inode->i_data, 0);
inode->i_size = 0;
qnx4_truncate(inode);
lock_kernel();
Expand Down
2 changes: 2 additions & 0 deletions fs/reiserfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ void reiserfs_delete_inode(struct inode *inode)
2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb);
struct reiserfs_transaction_handle th;

truncate_inode_pages(&inode->i_data, 0);

reiserfs_write_lock(inode->i_sb);

/* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */
Expand Down
1 change: 1 addition & 0 deletions fs/smbfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ static void
smb_delete_inode(struct inode *ino)
{
DEBUG1("ino=%ld\n", ino->i_ino);
truncate_inode_pages(&ino->i_data, 0);
lock_kernel();
if (smb_close(ino))
PARANOIA("could not close inode %ld\n", ino->i_ino);
Expand Down
1 change: 1 addition & 0 deletions fs/sysv/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ int sysv_sync_inode(struct inode * inode)

static void sysv_delete_inode(struct inode *inode)
{
truncate_inode_pages(&inode->i_data, 0);
inode->i_size = 0;
sysv_truncate(inode);
lock_kernel();
Expand Down
2 changes: 2 additions & 0 deletions fs/udf/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ static int udf_get_block(struct inode *, sector_t, struct buffer_head *, int);
*/
void udf_delete_inode(struct inode * inode)
{
truncate_inode_pages(&inode->i_data, 0);

if (is_bad_inode(inode))
goto no_delete;

Expand Down
1 change: 1 addition & 0 deletions fs/ufs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,7 @@ int ufs_sync_inode (struct inode *inode)

void ufs_delete_inode (struct inode * inode)
{
truncate_inode_pages(&inode->i_data, 0);
/*UFS_I(inode)->i_dtime = CURRENT_TIME;*/
lock_kernel();
mark_inode_dirty(inode);
Expand Down
1 change: 1 addition & 0 deletions mm/shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ static void shmem_delete_inode(struct inode *inode)
struct shmem_inode_info *info = SHMEM_I(inode);

if (inode->i_op->truncate == shmem_truncate) {
truncate_inode_pages(inode->i_mapping, 0);
shmem_unacct_size(info->flags, inode->i_size);
inode->i_size = 0;
shmem_truncate(inode);
Expand Down

0 comments on commit fef2665

Please sign in to comment.