Currently clear_inode calls vfs_dq_drop directly. This means we tie the quota code into the VFS. Get rid of that and make the filesystem responsibly for the drop inside the ->clear_inode superblock operation. Signed-off-by: Christoph Hellwig <hch@xxxxxx> Index: linux-2.6/fs/ext2/super.c =================================================================== --- linux-2.6.orig/fs/ext2/super.c 2010-03-03 14:03:29.402003543 +0100 +++ linux-2.6/fs/ext2/super.c 2010-03-03 14:10:04.511274110 +0100 @@ -194,6 +194,8 @@ static void destroy_inodecache(void) static void ext2_clear_inode(struct inode *inode) { struct ext2_block_alloc_info *rsv = EXT2_I(inode)->i_block_alloc_info; + + vfs_dq_drop(inode); ext2_discard_reservation(inode); EXT2_I(inode)->i_block_alloc_info = NULL; if (unlikely(rsv)) Index: linux-2.6/fs/ext3/super.c =================================================================== --- linux-2.6.orig/fs/ext3/super.c 2010-03-03 14:09:20.193022398 +0100 +++ linux-2.6/fs/ext3/super.c 2010-03-03 14:10:04.512272573 +0100 @@ -528,6 +528,8 @@ static void destroy_inodecache(void) static void ext3_clear_inode(struct inode *inode) { struct ext3_block_alloc_info *rsv = EXT3_I(inode)->i_block_alloc_info; + + vfs_dq_drop(inode); ext3_discard_reservation(inode); EXT3_I(inode)->i_block_alloc_info = NULL; if (unlikely(rsv)) Index: linux-2.6/fs/ext4/super.c =================================================================== --- linux-2.6.orig/fs/ext4/super.c 2010-03-03 14:09:20.205261118 +0100 +++ linux-2.6/fs/ext4/super.c 2010-03-03 14:10:04.528005636 +0100 @@ -761,6 +761,7 @@ static void destroy_inodecache(void) static void ext4_clear_inode(struct inode *inode) { + vfs_dq_drop(inode); ext4_discard_preallocations(inode); if (EXT4_JOURNAL(inode)) jbd2_journal_release_jbd_inode(EXT4_SB(inode->i_sb)->s_journal, Index: linux-2.6/fs/inode.c =================================================================== --- linux-2.6.orig/fs/inode.c 2010-03-03 14:03:29.409003752 +0100 +++ linux-2.6/fs/inode.c 2010-03-03 14:10:04.536066818 +0100 @@ -314,7 +314,6 @@ void clear_inode(struct inode *inode) BUG_ON(!(inode->i_state & I_FREEING)); BUG_ON(inode->i_state & I_CLEAR); inode_sync_wait(inode); - vfs_dq_drop(inode); if (inode->i_sb->s_op->clear_inode) inode->i_sb->s_op->clear_inode(inode); if (S_ISBLK(inode->i_mode) && inode->i_bdev) Index: linux-2.6/fs/jfs/super.c =================================================================== --- linux-2.6.orig/fs/jfs/super.c 2010-03-03 14:03:29.411003822 +0100 +++ linux-2.6/fs/jfs/super.c 2010-03-03 14:10:04.541005706 +0100 @@ -131,6 +131,11 @@ static void jfs_destroy_inode(struct ino kmem_cache_free(jfs_inode_cachep, ji); } +static void jfs_clear_inode(struct inode *inode) +{ + vfs_dq_drop(inode); +} + static int jfs_statfs(struct dentry *dentry, struct kstatfs *buf) { struct jfs_sb_info *sbi = JFS_SBI(dentry->d_sb); @@ -745,6 +750,7 @@ static const struct super_operations jfs .dirty_inode = jfs_dirty_inode, .write_inode = jfs_write_inode, .delete_inode = jfs_delete_inode, + .clear_inode = jfs_clear_inode, .put_super = jfs_put_super, .sync_fs = jfs_sync_fs, .freeze_fs = jfs_freeze, Index: linux-2.6/fs/ocfs2/inode.c =================================================================== --- linux-2.6.orig/fs/ocfs2/inode.c 2010-03-03 14:05:27.256255322 +0100 +++ linux-2.6/fs/ocfs2/inode.c 2010-03-03 14:10:04.544008918 +0100 @@ -1087,6 +1087,8 @@ void ocfs2_clear_inode(struct inode *ino mlog_bug_on_msg(OCFS2_SB(inode->i_sb) == NULL, "Inode=%lu\n", inode->i_ino); + vfs_dq_drop(inode); + /* To preven remote deletes we hold open lock before, now it * is time to unlock PR and EX open locks. */ ocfs2_open_unlock(inode); Index: linux-2.6/fs/reiserfs/super.c =================================================================== --- linux-2.6.orig/fs/reiserfs/super.c 2010-03-03 14:09:20.255255322 +0100 +++ linux-2.6/fs/reiserfs/super.c 2010-03-03 14:10:04.553006125 +0100 @@ -578,6 +578,11 @@ out: reiserfs_write_unlock_once(inode->i_sb, lock_depth); } +static void reiserfs_clear_inode(struct inode *inode) +{ + vfs_dq_drop(inode); +} + #ifdef CONFIG_QUOTA static ssize_t reiserfs_quota_write(struct super_block *, int, const char *, size_t, loff_t); @@ -590,6 +595,7 @@ static const struct super_operations rei .destroy_inode = reiserfs_destroy_inode, .write_inode = reiserfs_write_inode, .dirty_inode = reiserfs_dirty_inode, + .clear_inode = reiserfs_clear_inode, .delete_inode = reiserfs_delete_inode, .put_super = reiserfs_put_super, .write_super = reiserfs_write_super, Index: linux-2.6/fs/ufs/super.c =================================================================== --- linux-2.6.orig/fs/ufs/super.c 2010-03-03 14:03:29.417004031 +0100 +++ linux-2.6/fs/ufs/super.c 2010-03-03 14:10:04.569006195 +0100 @@ -1432,6 +1432,11 @@ static void destroy_inodecache(void) kmem_cache_destroy(ufs_inode_cachep); } +static void ufs_clear_inode(struct inode *inode) +{ + vfs_dq_drop(inode); +} + #ifdef CONFIG_QUOTA static ssize_t ufs_quota_read(struct super_block *, int, char *,size_t, loff_t); static ssize_t ufs_quota_write(struct super_block *, int, const char *, size_t, loff_t); @@ -1442,6 +1447,7 @@ static const struct super_operations ufs .destroy_inode = ufs_destroy_inode, .write_inode = ufs_write_inode, .delete_inode = ufs_delete_inode, + .clear_inode = ufs_clear_inode, .put_super = ufs_put_super, .write_super = ufs_write_super, .sync_fs = ufs_sync_fs, Index: linux-2.6/fs/udf/inode.c =================================================================== --- linux-2.6.orig/fs/udf/inode.c 2010-03-03 14:10:30.638010386 +0100 +++ linux-2.6/fs/udf/inode.c 2010-03-03 14:10:47.163255604 +0100 @@ -108,6 +108,8 @@ void udf_clear_inode(struct inode *inode (unsigned long long)inode->i_size, (unsigned long long)iinfo->i_lenExtents); } + + vfs_dq_drop(inode); kfree(iinfo->i_ext.i_data); iinfo->i_ext.i_data = NULL; } -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html