diff options
author | Christoph Hellwig <hch@lst.de> | 2007-02-12 03:51:57 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-12 12:48:28 -0500 |
commit | fb58b7316a99703afb8d076b0e5f3e1e387e4b30 (patch) | |
tree | d2aabf3413fc3e94a6760c364caf0762915a6273 /fs/dquot.c | |
parent | ea6f3281a145d16ed53e88b0627f78d5cde6068f (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.c | 24 |
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 @@ | |||
79 | #include <linux/buffer_head.h> | 79 | #include <linux/buffer_head.h> |
80 | #include <linux/capability.h> | 80 | #include <linux/capability.h> |
81 | #include <linux/quotaops.h> | 81 | #include <linux/quotaops.h> |
82 | #include <linux/writeback.h> /* for inode_lock, oddly enough.. */ | ||
82 | 83 | ||
83 | #include <asm/uaccess.h> | 84 | #include <asm/uaccess.h> |
84 | 85 | ||
@@ -755,15 +756,30 @@ static void put_dquot_list(struct list_head *tofree_head) | |||
755 | } | 756 | } |
756 | } | 757 | } |
757 | 758 | ||
759 | static void remove_dquot_ref(struct super_block *sb, int type, | ||
760 | struct list_head *tofree_head) | ||
761 | { | ||
762 | struct inode *inode; | ||
763 | |||
764 | spin_lock(&inode_lock); | ||
765 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { | ||
766 | if (!IS_NOQUOTA(inode)) | ||
767 | remove_inode_dquot_ref(inode, type, tofree_head); | ||
768 | } | ||
769 | spin_unlock(&inode_lock); | ||
770 | } | ||
771 | |||
758 | /* Gather all references from inodes and drop them */ | 772 | /* Gather all references from inodes and drop them */ |
759 | static void drop_dquot_ref(struct super_block *sb, int type) | 773 | static void drop_dquot_ref(struct super_block *sb, int type) |
760 | { | 774 | { |
761 | LIST_HEAD(tofree_head); | 775 | LIST_HEAD(tofree_head); |
762 | 776 | ||
763 | down_write(&sb_dqopt(sb)->dqptr_sem); | 777 | if (sb->dq_op) { |
764 | remove_dquot_ref(sb, type, &tofree_head); | 778 | down_write(&sb_dqopt(sb)->dqptr_sem); |
765 | up_write(&sb_dqopt(sb)->dqptr_sem); | 779 | remove_dquot_ref(sb, type, &tofree_head); |
766 | put_dquot_list(&tofree_head); | 780 | up_write(&sb_dqopt(sb)->dqptr_sem); |
781 | put_dquot_list(&tofree_head); | ||
782 | } | ||
767 | } | 783 | } |
768 | 784 | ||
769 | static inline void dquot_incr_inodes(struct dquot *dquot, unsigned long number) | 785 | static inline void dquot_incr_inodes(struct dquot *dquot, unsigned long number) |