[PATCH] move remove_dquot_ref to dqout.c
authorChristoph Hellwig <hch@lst.de>
Mon, 12 Feb 2007 08:51:57 +0000 (00:51 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 12 Feb 2007 17:48:28 +0000 (09:48 -0800)
Remove_dquot_ref can move to dqout.c instead of beeing in inode.c under
#ifdef CONFIG_QUOTA.  Also clean the resulting code up a tiny little bit by
testing sb->dq_op earlier - it's constant over a filesystems lifetime.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Jan Kara <jack@ucw.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/dquot.c
fs/inode.c
include/linux/fs.h

index a561fb29e2037e9f238b269404b14da50fc087bd..5bdc4b2a872a41818adac58bc7e2ece95ee956ec 100644 (file)
@@ -79,6 +79,7 @@
 #include <linux/buffer_head.h>
 #include <linux/capability.h>
 #include <linux/quotaops.h>
+#include <linux/writeback.h> /* for inode_lock, oddly enough.. */
 
 #include <asm/uaccess.h>
 
@@ -755,15 +756,30 @@ static void put_dquot_list(struct list_head *tofree_head)
        }
 }
 
+static void remove_dquot_ref(struct super_block *sb, int type,
+               struct list_head *tofree_head)
+{
+       struct inode *inode;
+
+       spin_lock(&inode_lock);
+       list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
+               if (!IS_NOQUOTA(inode))
+                       remove_inode_dquot_ref(inode, type, tofree_head);
+       }
+       spin_unlock(&inode_lock);
+}
+
 /* Gather all references from inodes and drop them */
 static void drop_dquot_ref(struct super_block *sb, int type)
 {
        LIST_HEAD(tofree_head);
 
-       down_write(&sb_dqopt(sb)->dqptr_sem);
-       remove_dquot_ref(sb, type, &tofree_head);
-       up_write(&sb_dqopt(sb)->dqptr_sem);
-       put_dquot_list(&tofree_head);
+       if (sb->dq_op) {
+               down_write(&sb_dqopt(sb)->dqptr_sem);
+               remove_dquot_ref(sb, type, &tofree_head);
+               up_write(&sb_dqopt(sb)->dqptr_sem);
+               put_dquot_list(&tofree_head);
+       }
 }
 
 static inline void dquot_incr_inodes(struct dquot *dquot, unsigned long number)
index e6d93070f1402e249f9f1be017b4831033eab1a4..5e32432a7608592834e194419f8b3dd0e7ab98f0 100644 (file)
@@ -1251,33 +1251,6 @@ int inode_needs_sync(struct inode *inode)
 
 EXPORT_SYMBOL(inode_needs_sync);
 
-/*
- *     Quota functions that want to walk the inode lists..
- */
-#ifdef CONFIG_QUOTA
-
-void remove_dquot_ref(struct super_block *sb, int type,
-                       struct list_head *tofree_head)
-{
-       struct inode *inode;
-
-       if (!sb->dq_op)
-               return; /* nothing to do */
-       spin_lock(&inode_lock); /* This lock is for inodes code */
-
-       /*
-        * We don't have to lock against quota code - test IS_QUOTAINIT is
-        * just for speedup...
-        */
-       list_for_each_entry(inode, &sb->s_inodes, i_sb_list)
-               if (!IS_NOQUOTA(inode))
-                       remove_inode_dquot_ref(inode, type, tofree_head);
-
-       spin_unlock(&inode_lock);
-}
-
-#endif
-
 int inode_wait(void *word)
 {
        schedule();
index 20fd1619ccfb0914c7e1e895c48240e0f42a45fb..990adcbc0df24e61325e50109183688a14b5ba0b 100644 (file)
@@ -1688,7 +1688,6 @@ extern struct inode *new_inode(struct super_block *);
 extern int __remove_suid(struct dentry *, int);
 extern int should_remove_suid(struct dentry *);
 extern int remove_suid(struct dentry *);
-extern void remove_dquot_ref(struct super_block *, int, struct list_head *);
 
 extern void __insert_inode_hash(struct inode *, unsigned long hashval);
 extern void remove_inode_hash(struct inode *);