summaryrefslogtreecommitdiff
path: root/fs/dquot.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-02-12 00:51:57 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 09:48:28 -0800
commitfb58b7316a99703afb8d076b0e5f3e1e387e4b30 (patch)
treed2aabf3413fc3e94a6760c364caf0762915a6273 /fs/dquot.c
parentea6f3281a145d16ed53e88b0627f78d5cde6068f (diff)
[PATCH] move remove_dquot_ref to dqout.c
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>
Diffstat (limited to 'fs/dquot.c')
-rw-r--r--fs/dquot.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/fs/dquot.c b/fs/dquot.c
index a561fb29e203..5bdc4b2a872a 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -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)