On Feb 7 2007 19:06, Christoph Hellwig wrote:
>On Wed, Feb 07, 2007 at 07:03:05PM +0100, Jan Engelhardt wrote:
>
>> With filesystems that can turn on their quota after mount time (about
>> every fs except xfs), I can surely have a ton of files open, and hence,
>> if I understand correctly, have lots of inodes instantiated.
>
>Yes, you can in theory. But turning on quota on a filesystem in full
>steam useage is not a common use case and thus there is no point in
>optimizing for it.
I put it to a test in a default scenario (quotaon sometime at boot).
SUSE Linux 10.1 with reiserfs(usrquota,grpquota).
This is the result:
add_dquot_ref: 30 files in sb->s_files for hda2
add_dquot_ref: Restarting after 12 files
add_dquot_ref: 30 files in sb->s_files for hda2
add_dquot_ref: Restarted 1 times
add_dquot_ref: 30 files in sb->s_files for hda2
add_dquot_ref: Restarting after 12 files
add_dquot_ref: 30 files in sb->s_files for hda2
add_dquot_ref: Restarted 1 times
Surprisingly few. I had expected to see more instantiated (but not necessarily
open) files.
Patch for reference:
Index: 18/fs/dquot.c
===================================================================
--- 18.orig/fs/dquot.c
+++ 18/fs/dquot.c
@@ -689,22 +689,35 @@ static int dqinit_needed(struct inode *i
static void add_dquot_ref(struct super_block *sb, int type)
{
struct list_head *p;
+ int restart = 0;
+ int num_files;
restart:
file_list_lock();
+ num_files = 0;
+ list_for_each(p, &sb->s_files) {
+ ++num_files;
+ }
+ printk(KERN_WARNING "add_dquot_ref: %d files in sb->s_files for %s\n",
+ num_files, sb->s_id);
+ num_files = 0;
list_for_each(p, &sb->s_files) {
struct file *filp = list_entry(p, struct file, f_u.fu_list);
struct inode *inode = filp->f_dentry->d_inode;
+ ++num_files;
if (filp->f_mode & FMODE_WRITE && dqinit_needed(inode, type)) {
struct dentry *dentry = dget(filp->f_dentry);
file_list_unlock();
sb->dq_op->initialize(inode, type);
dput(dentry);
/* As we may have blocked we had better restart... */
+ printk(KERN_WARNING "add_dquot_ref: Restarting after %d files\n", num_files);
+ ++restart;
goto restart;
}
}
file_list_unlock();
+ printk(KERN_WARNING "add_dquot_ref: Restarted %d times\n", restart);
}
/* Return 0 if dqput() won't block (note that 1 doesn't necessarily mean blocking) */
BTW, whilst looking for the function to return a readable name, I came
across reiserfs_bdevname() and bdevname(). The former uses sb->s_id, the
latter struct gendisk->hd_name+partition number.
Could someone elaborate on why there are two ways?
Jan
--
ft: http://freshmeat.net/p/chaostables/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]