diff options
Diffstat (limited to 'fs/quota/dquot.c')
-rw-r--r-- | fs/quota/dquot.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index e0b870f4749f..788b5802a7ce 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -80,8 +80,6 @@ | |||
80 | 80 | ||
81 | #include <asm/uaccess.h> | 81 | #include <asm/uaccess.h> |
82 | 82 | ||
83 | #define __DQUOT_PARANOIA | ||
84 | |||
85 | /* | 83 | /* |
86 | * There are three quota SMP locks. dq_list_lock protects all lists with quotas | 84 | * There are three quota SMP locks. dq_list_lock protects all lists with quotas |
87 | * and quota formats, dqstats structure containing statistics about the lists | 85 | * and quota formats, dqstats structure containing statistics about the lists |
@@ -695,7 +693,7 @@ void dqput(struct dquot *dquot) | |||
695 | 693 | ||
696 | if (!dquot) | 694 | if (!dquot) |
697 | return; | 695 | return; |
698 | #ifdef __DQUOT_PARANOIA | 696 | #ifdef CONFIG_QUOTA_DEBUG |
699 | if (!atomic_read(&dquot->dq_count)) { | 697 | if (!atomic_read(&dquot->dq_count)) { |
700 | printk("VFS: dqput: trying to free free dquot\n"); | 698 | printk("VFS: dqput: trying to free free dquot\n"); |
701 | printk("VFS: device %s, dquot of %s %d\n", | 699 | printk("VFS: device %s, dquot of %s %d\n", |
@@ -748,7 +746,7 @@ we_slept: | |||
748 | goto we_slept; | 746 | goto we_slept; |
749 | } | 747 | } |
750 | atomic_dec(&dquot->dq_count); | 748 | atomic_dec(&dquot->dq_count); |
751 | #ifdef __DQUOT_PARANOIA | 749 | #ifdef CONFIG_QUOTA_DEBUG |
752 | /* sanity check */ | 750 | /* sanity check */ |
753 | BUG_ON(!list_empty(&dquot->dq_free)); | 751 | BUG_ON(!list_empty(&dquot->dq_free)); |
754 | #endif | 752 | #endif |
@@ -845,7 +843,7 @@ we_slept: | |||
845 | dquot = NULL; | 843 | dquot = NULL; |
846 | goto out; | 844 | goto out; |
847 | } | 845 | } |
848 | #ifdef __DQUOT_PARANOIA | 846 | #ifdef CONFIG_QUOTA_DEBUG |
849 | BUG_ON(!dquot->dq_sb); /* Has somebody invalidated entry under us? */ | 847 | BUG_ON(!dquot->dq_sb); /* Has somebody invalidated entry under us? */ |
850 | #endif | 848 | #endif |
851 | out: | 849 | out: |
@@ -874,14 +872,18 @@ static int dqinit_needed(struct inode *inode, int type) | |||
874 | static void add_dquot_ref(struct super_block *sb, int type) | 872 | static void add_dquot_ref(struct super_block *sb, int type) |
875 | { | 873 | { |
876 | struct inode *inode, *old_inode = NULL; | 874 | struct inode *inode, *old_inode = NULL; |
875 | #ifdef CONFIG_QUOTA_DEBUG | ||
877 | int reserved = 0; | 876 | int reserved = 0; |
877 | #endif | ||
878 | 878 | ||
879 | spin_lock(&inode_lock); | 879 | spin_lock(&inode_lock); |
880 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { | 880 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { |
881 | if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE|I_NEW)) | 881 | if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE|I_NEW)) |
882 | continue; | 882 | continue; |
883 | #ifdef CONFIG_QUOTA_DEBUG | ||
883 | if (unlikely(inode_get_rsv_space(inode) > 0)) | 884 | if (unlikely(inode_get_rsv_space(inode) > 0)) |
884 | reserved = 1; | 885 | reserved = 1; |
886 | #endif | ||
885 | if (!atomic_read(&inode->i_writecount)) | 887 | if (!atomic_read(&inode->i_writecount)) |
886 | continue; | 888 | continue; |
887 | if (!dqinit_needed(inode, type)) | 889 | if (!dqinit_needed(inode, type)) |
@@ -903,11 +905,13 @@ static void add_dquot_ref(struct super_block *sb, int type) | |||
903 | spin_unlock(&inode_lock); | 905 | spin_unlock(&inode_lock); |
904 | iput(old_inode); | 906 | iput(old_inode); |
905 | 907 | ||
908 | #ifdef CONFIG_QUOTA_DEBUG | ||
906 | if (reserved) { | 909 | if (reserved) { |
907 | printk(KERN_WARNING "VFS (%s): Writes happened before quota" | 910 | printk(KERN_WARNING "VFS (%s): Writes happened before quota" |
908 | " was turned on thus quota information is probably " | 911 | " was turned on thus quota information is probably " |
909 | "inconsistent. Please run quotacheck(8).\n", sb->s_id); | 912 | "inconsistent. Please run quotacheck(8).\n", sb->s_id); |
910 | } | 913 | } |
914 | #endif | ||
911 | } | 915 | } |
912 | 916 | ||
913 | /* | 917 | /* |
@@ -934,7 +938,7 @@ static int remove_inode_dquot_ref(struct inode *inode, int type, | |||
934 | inode->i_dquot[type] = NULL; | 938 | inode->i_dquot[type] = NULL; |
935 | if (dquot) { | 939 | if (dquot) { |
936 | if (dqput_blocks(dquot)) { | 940 | if (dqput_blocks(dquot)) { |
937 | #ifdef __DQUOT_PARANOIA | 941 | #ifdef CONFIG_QUOTA_DEBUG |
938 | if (atomic_read(&dquot->dq_count) != 1) | 942 | if (atomic_read(&dquot->dq_count) != 1) |
939 | printk(KERN_WARNING "VFS: Adding dquot with dq_count %d to dispose list.\n", atomic_read(&dquot->dq_count)); | 943 | printk(KERN_WARNING "VFS: Adding dquot with dq_count %d to dispose list.\n", atomic_read(&dquot->dq_count)); |
940 | #endif | 944 | #endif |
@@ -2322,34 +2326,34 @@ static int do_set_dqblk(struct dquot *dquot, struct if_dqblk *di) | |||
2322 | if (di->dqb_valid & QIF_SPACE) { | 2326 | if (di->dqb_valid & QIF_SPACE) { |
2323 | dm->dqb_curspace = di->dqb_curspace - dm->dqb_rsvspace; | 2327 | dm->dqb_curspace = di->dqb_curspace - dm->dqb_rsvspace; |
2324 | check_blim = 1; | 2328 | check_blim = 1; |
2325 | __set_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags); | 2329 | set_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags); |
2326 | } | 2330 | } |
2327 | if (di->dqb_valid & QIF_BLIMITS) { | 2331 | if (di->dqb_valid & QIF_BLIMITS) { |
2328 | dm->dqb_bsoftlimit = qbtos(di->dqb_bsoftlimit); | 2332 | dm->dqb_bsoftlimit = qbtos(di->dqb_bsoftlimit); |
2329 | dm->dqb_bhardlimit = qbtos(di->dqb_bhardlimit); | 2333 | dm->dqb_bhardlimit = qbtos(di->dqb_bhardlimit); |
2330 | check_blim = 1; | 2334 | check_blim = 1; |
2331 | __set_bit(DQ_LASTSET_B + QIF_BLIMITS_B, &dquot->dq_flags); | 2335 | set_bit(DQ_LASTSET_B + QIF_BLIMITS_B, &dquot->dq_flags); |
2332 | } | 2336 | } |
2333 | if (di->dqb_valid & QIF_INODES) { | 2337 | if (di->dqb_valid & QIF_INODES) { |
2334 | dm->dqb_curinodes = di->dqb_curinodes; | 2338 | dm->dqb_curinodes = di->dqb_curinodes; |
2335 | check_ilim = 1; | 2339 | check_ilim = 1; |
2336 | __set_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags); | 2340 | set_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags); |
2337 | } | 2341 | } |
2338 | if (di->dqb_valid & QIF_ILIMITS) { | 2342 | if (di->dqb_valid & QIF_ILIMITS) { |
2339 | dm->dqb_isoftlimit = di->dqb_isoftlimit; | 2343 | dm->dqb_isoftlimit = di->dqb_isoftlimit; |
2340 | dm->dqb_ihardlimit = di->dqb_ihardlimit; | 2344 | dm->dqb_ihardlimit = di->dqb_ihardlimit; |
2341 | check_ilim = 1; | 2345 | check_ilim = 1; |
2342 | __set_bit(DQ_LASTSET_B + QIF_ILIMITS_B, &dquot->dq_flags); | 2346 | set_bit(DQ_LASTSET_B + QIF_ILIMITS_B, &dquot->dq_flags); |
2343 | } | 2347 | } |
2344 | if (di->dqb_valid & QIF_BTIME) { | 2348 | if (di->dqb_valid & QIF_BTIME) { |
2345 | dm->dqb_btime = di->dqb_btime; | 2349 | dm->dqb_btime = di->dqb_btime; |
2346 | check_blim = 1; | 2350 | check_blim = 1; |
2347 | __set_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags); | 2351 | set_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags); |
2348 | } | 2352 | } |
2349 | if (di->dqb_valid & QIF_ITIME) { | 2353 | if (di->dqb_valid & QIF_ITIME) { |
2350 | dm->dqb_itime = di->dqb_itime; | 2354 | dm->dqb_itime = di->dqb_itime; |
2351 | check_ilim = 1; | 2355 | check_ilim = 1; |
2352 | __set_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags); | 2356 | set_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags); |
2353 | } | 2357 | } |
2354 | 2358 | ||
2355 | if (check_blim) { | 2359 | if (check_blim) { |