Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6:
  quota: Convert __DQUOT_PARANOIA symbol to standard config option
This commit is contained in:
Linus Torvalds 2010-04-20 09:39:40 -07:00
commit 05ce7bfe54
2 changed files with 15 additions and 9 deletions

View file

@ -33,6 +33,14 @@ config PRINT_QUOTA_WARNING
Note that this behavior is currently deprecated and may go away in Note that this behavior is currently deprecated and may go away in
future. Please use notification via netlink socket instead. future. Please use notification via netlink socket instead.
config QUOTA_DEBUG
bool "Additional quota sanity checks"
depends on QUOTA
default n
help
If you say Y here, quota subsystem will perform some additional
sanity checks of quota internal structures. If unsure, say N.
# Generic support for tree structured quota files. Selected when needed. # Generic support for tree structured quota files. Selected when needed.
config QUOTA_TREE config QUOTA_TREE
tristate tristate

View file

@ -80,8 +80,6 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#define __DQUOT_PARANOIA
/* /*
* There are three quota SMP locks. dq_list_lock protects all lists with quotas * There are three quota SMP locks. dq_list_lock protects all lists with quotas
* and quota formats, dqstats structure containing statistics about the lists * and quota formats, dqstats structure containing statistics about the lists
@ -695,7 +693,7 @@ void dqput(struct dquot *dquot)
if (!dquot) if (!dquot)
return; return;
#ifdef __DQUOT_PARANOIA #ifdef CONFIG_QUOTA_DEBUG
if (!atomic_read(&dquot->dq_count)) { if (!atomic_read(&dquot->dq_count)) {
printk("VFS: dqput: trying to free free dquot\n"); printk("VFS: dqput: trying to free free dquot\n");
printk("VFS: device %s, dquot of %s %d\n", printk("VFS: device %s, dquot of %s %d\n",
@ -748,7 +746,7 @@ void dqput(struct dquot *dquot)
goto we_slept; goto we_slept;
} }
atomic_dec(&dquot->dq_count); atomic_dec(&dquot->dq_count);
#ifdef __DQUOT_PARANOIA #ifdef CONFIG_QUOTA_DEBUG
/* sanity check */ /* sanity check */
BUG_ON(!list_empty(&dquot->dq_free)); BUG_ON(!list_empty(&dquot->dq_free));
#endif #endif
@ -845,7 +843,7 @@ struct dquot *dqget(struct super_block *sb, unsigned int id, int type)
dquot = NULL; dquot = NULL;
goto out; goto out;
} }
#ifdef __DQUOT_PARANOIA #ifdef CONFIG_QUOTA_DEBUG
BUG_ON(!dquot->dq_sb); /* Has somebody invalidated entry under us? */ BUG_ON(!dquot->dq_sb); /* Has somebody invalidated entry under us? */
#endif #endif
out: out:
@ -874,7 +872,7 @@ static int dqinit_needed(struct inode *inode, int type)
static void add_dquot_ref(struct super_block *sb, int type) static void add_dquot_ref(struct super_block *sb, int type)
{ {
struct inode *inode, *old_inode = NULL; struct inode *inode, *old_inode = NULL;
#ifdef __DQUOT_PARANOIA #ifdef CONFIG_QUOTA_DEBUG
int reserved = 0; int reserved = 0;
#endif #endif
@ -882,7 +880,7 @@ static void add_dquot_ref(struct super_block *sb, int type)
list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE|I_NEW)) if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE|I_NEW))
continue; continue;
#ifdef __DQUOT_PARANOIA #ifdef CONFIG_QUOTA_DEBUG
if (unlikely(inode_get_rsv_space(inode) > 0)) if (unlikely(inode_get_rsv_space(inode) > 0))
reserved = 1; reserved = 1;
#endif #endif
@ -907,7 +905,7 @@ static void add_dquot_ref(struct super_block *sb, int type)
spin_unlock(&inode_lock); spin_unlock(&inode_lock);
iput(old_inode); iput(old_inode);
#ifdef __DQUOT_PARANOIA #ifdef CONFIG_QUOTA_DEBUG
if (reserved) { if (reserved) {
printk(KERN_WARNING "VFS (%s): Writes happened before quota" printk(KERN_WARNING "VFS (%s): Writes happened before quota"
" was turned on thus quota information is probably " " was turned on thus quota information is probably "
@ -940,7 +938,7 @@ static int remove_inode_dquot_ref(struct inode *inode, int type,
inode->i_dquot[type] = NULL; inode->i_dquot[type] = NULL;
if (dquot) { if (dquot) {
if (dqput_blocks(dquot)) { if (dqput_blocks(dquot)) {
#ifdef __DQUOT_PARANOIA #ifdef CONFIG_QUOTA_DEBUG
if (atomic_read(&dquot->dq_count) != 1) if (atomic_read(&dquot->dq_count) != 1)
printk(KERN_WARNING "VFS: Adding dquot with dq_count %d to dispose list.\n", atomic_read(&dquot->dq_count)); printk(KERN_WARNING "VFS: Adding dquot with dq_count %d to dispose list.\n", atomic_read(&dquot->dq_count));
#endif #endif