提交 a2e7d2df 编写于 作者: R Ryusuke Konishi 提交者: Linus Torvalds

nilfs2: cleanup nilfs_clear_inode

This will remove the following unnecessary locks and cleanup code in
nilfs_clear_inode():

- unnecessary protection using nilfs_transaction_begin() and
  nilfs_transaction_end().

- cleanup code of i_dirty list field which is never chained
  when this function is called.

- spinlock used when releasing i_bh field.
Signed-off-by: NRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 3358b4aa
...@@ -184,8 +184,6 @@ static inline void nilfs_destroy_inode_cache(void) ...@@ -184,8 +184,6 @@ static inline void nilfs_destroy_inode_cache(void)
static void nilfs_clear_inode(struct inode *inode) static void nilfs_clear_inode(struct inode *inode)
{ {
struct nilfs_inode_info *ii = NILFS_I(inode); struct nilfs_inode_info *ii = NILFS_I(inode);
struct nilfs_transaction_info ti;
struct nilfs_sb_info *sbi = NILFS_SB(inode->i_sb);
#ifdef CONFIG_NILFS_POSIX_ACL #ifdef CONFIG_NILFS_POSIX_ACL
if (ii->i_acl && ii->i_acl != NILFS_ACL_NOT_CACHED) { if (ii->i_acl && ii->i_acl != NILFS_ACL_NOT_CACHED) {
...@@ -200,21 +198,14 @@ static void nilfs_clear_inode(struct inode *inode) ...@@ -200,21 +198,14 @@ static void nilfs_clear_inode(struct inode *inode)
/* /*
* Free resources allocated in nilfs_read_inode(), here. * Free resources allocated in nilfs_read_inode(), here.
*/ */
nilfs_transaction_begin(inode->i_sb, &ti, 0); BUG_ON(!list_empty(&ii->i_dirty));
spin_lock(&sbi->s_inode_lock);
if (!list_empty(&ii->i_dirty))
list_del_init(&ii->i_dirty);
brelse(ii->i_bh); brelse(ii->i_bh);
ii->i_bh = NULL; ii->i_bh = NULL;
spin_unlock(&sbi->s_inode_lock);
if (test_bit(NILFS_I_BMAP, &ii->i_state)) if (test_bit(NILFS_I_BMAP, &ii->i_state))
nilfs_bmap_clear(ii->i_bmap); nilfs_bmap_clear(ii->i_bmap);
nilfs_btnode_cache_clear(&ii->i_btnode_cache); nilfs_btnode_cache_clear(&ii->i_btnode_cache);
nilfs_transaction_end(inode->i_sb, 0);
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册