* Unused dquots (dq_count == 0) are added to the free_dquots list when freed,
* and this list is searched whenever we need an available dquot. Dquots are
* removed from the list as soon as they are used again, and
- * dqstats_array[DQSTATS_FREE] gives the number of dquots on the list. When
+ * dqstats.free_dquots gives the number of dquots on the list. When
* dquot is invalidated it's completely released from memory.
*
* Dquots with a specific identity (device, type and id) are placed on
static LIST_HEAD(free_dquots);
static struct list_head dquot_hash[NR_DQHASH];
-__u32 dqstats_array[DQSTATS_SIZE];
+struct dqstats dqstats;
static void dqput(struct dquot *);
static struct dquot *dqduplicate(struct dquot *);
static inline void put_dquot_head(struct dquot *dquot)
{
list_add(&dquot->dq_free, &free_dquots);
- ++dqstats_array[DQSTATS_FREE];
+ dqstats.free_dquots++;
}
/* Add a dquot to the tail of the free list */
static inline void put_dquot_last(struct dquot *dquot)
{
list_add(&dquot->dq_free, free_dquots.prev);
- ++dqstats_array[DQSTATS_FREE];
+ dqstats.free_dquots++;
}
/* Move dquot to the head of free list (it must be already on it) */
return;
list_del(&dquot->dq_free);
INIT_LIST_HEAD(&dquot->dq_free);
- --dqstats_array[DQSTATS_FREE];
+ dqstats.free_dquots--;
}
static inline void put_inuse(struct dquot *dquot)
/* We add to the back of inuse list so we don't have to restart
* when traversing this list and we block */
list_add(&dquot->dq_inuse, inuse_list.prev);
- ++dqstats_array[DQSTATS_ALLOCATED];
+ dqstats.allocated_dquots++;
}
static inline void remove_inuse(struct dquot *dquot)
{
- --dqstats_array[DQSTATS_ALLOCATED];
+ dqstats.allocated_dquots--;
list_del(&dquot->dq_inuse);
}
for (cnt = 0; cnt < MAXQUOTAS; cnt++)
if ((cnt == type || type == -1) && sb_has_quota_enabled(sb, cnt) && info_dirty(&dqopt->info[cnt]))
dqopt->ops[cnt]->write_file_info(sb, cnt);
- ++dqstats_array[DQSTATS_SYNCS];
+ dqstats.syncs++;
return 0;
}
int count = 0;
lock_kernel();
- count = dqstats_array[DQSTATS_FREE] / priority;
+ count = dqstats.free_dquots / priority;
prune_dqcache(count);
unlock_kernel();
kmem_cache_shrink(dquot_cachep);
}
#endif
- ++dqstats_array[DQSTATS_DROPS];
+ dqstats.drops++;
we_slept:
if (dquot->dq_dup_ref && dquot->dq_count - dquot->dq_dup_ref <= 1) { /* Last unduplicated reference? */
__wait_dup_drop(dquot);
if (!dquot->dq_count)
remove_free_dquot(dquot);
get_dquot_ref(dquot);
- ++dqstats_array[DQSTATS_CACHE_HITS];
+ dqstats.cache_hits++;
wait_on_dquot(dquot);
if (empty)
dqput(empty);
return NODQUOT;
}
++dquot->dq_referenced;
- ++dqstats_array[DQSTATS_LOOKUPS];
+ dqstats.lookups++;
return dquot;
}
printk(KERN_ERR "VFS: dqduplicate(): Locked quota to be duplicated!\n");
get_dquot_dup_ref(dquot);
dquot->dq_referenced++;
- ++dqstats_array[DQSTATS_LOOKUPS];
+ dqstats.lookups++;
return dquot;
}
if (!dquot->dq_dup_ref)
wake_up(&dquot->dq_wait_free);
put_dquot_ref(dquot);
- ++dqstats_array[DQSTATS_DROPS];
+ dqstats.drops++;
}
static int dqinit_needed(struct inode *inode, int type)
set_dqblk: vfs_set_dqblk
};
+static ctl_table fs_dqstats_table[] = {
+ {FS_DQ_LOOKUPS, "lookups", &dqstats.lookups, sizeof(int), 0444, NULL, &proc_dointvec},
+ {FS_DQ_DROPS, "drops", &dqstats.drops, sizeof(int), 0444, NULL, &proc_dointvec},
+ {FS_DQ_READS, "reads", &dqstats.reads, sizeof(int), 0444, NULL, &proc_dointvec},
+ {FS_DQ_WRITES, "writes", &dqstats.writes, sizeof(int), 0444, NULL, &proc_dointvec},
+ {FS_DQ_CACHE_HITS, "cache_hits", &dqstats.cache_hits, sizeof(int), 0444, NULL, &proc_dointvec},
+ {FS_DQ_ALLOCATED, "allocated_dquots", &dqstats.allocated_dquots, sizeof(int), 0444, NULL, &proc_dointvec},
+ {FS_DQ_FREE, "free_dquots", &dqstats.free_dquots, sizeof(int), 0444, NULL, &proc_dointvec},
+ {FS_DQ_SYNCS, "syncs", &dqstats.syncs, sizeof(int), 0444, NULL, &proc_dointvec},
+ {},
+};
+
static ctl_table fs_table[] = {
- {FS_DQSTATS, "dqstats", dqstats_array, sizeof(dqstats_array), 0444, NULL, &proc_dointvec},
+ {FS_DQSTATS, "quota", NULL, 0, 0555, fs_dqstats_table},
{},
};
-static ctl_table dquot_table[] = {
+static ctl_table sys_table[] = {
{CTL_FS, "fs", NULL, 0, 0555, fs_table},
{},
};
{
int i;
- register_sysctl_table(dquot_table, 0);
+ register_sysctl_table(sys_table, 0);
for (i = 0; i < NR_DQHASH; i++)
INIT_LIST_HEAD(dquot_hash + i);
printk(KERN_NOTICE "VFS: Disk quotas v%s\n", __DQUOT_VERSION__);
EXPORT_SYMBOL(register_quota_format);
EXPORT_SYMBOL(unregister_quota_format);
-EXPORT_SYMBOL(dqstats_array);
+EXPORT_SYMBOL(dqstats);