Skip to content

Commit 661074e

Browse files
author
Al Viro
committed
Take ->i_bdev/->i_cdev handling out of clear_inode()
All call chains to clear_inode() pass through evict_inode() and clear_inode() should be called by evict_inode() exactly once. So we can pull i_bdev/i_cdev detaching up to evict_inode() itself. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent c628731 commit 661074e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎fs/inode.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,6 @@ void clear_inode(struct inode *inode)
313313
inode_sync_wait(inode);
314314
if (inode->i_sb->s_op->clear_inode)
315315
inode->i_sb->s_op->clear_inode(inode);
316-
if (S_ISBLK(inode->i_mode) && inode->i_bdev)
317-
bd_forget(inode);
318-
if (S_ISCHR(inode->i_mode) && inode->i_cdev)
319-
cd_forget(inode);
320316
inode->i_state = I_FREEING | I_CLEAR;
321317
}
322318
EXPORT_SYMBOL(clear_inode);
@@ -334,6 +330,10 @@ static void evict(struct inode *inode, int delete)
334330
truncate_inode_pages(&inode->i_data, 0);
335331
clear_inode(inode);
336332
}
333+
if (S_ISBLK(inode->i_mode) && inode->i_bdev)
334+
bd_forget(inode);
335+
if (S_ISCHR(inode->i_mode) && inode->i_cdev)
336+
cd_forget(inode);
337337
}
338338

339339
/*

0 commit comments

Comments
 (0)