[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.61.0702081315060.1364@yvahk01.tjqt.qr>
Date: Thu, 8 Feb 2007 13:22:22 +0100 (MET)
From: Jan Engelhardt <jengelh@...ux01.gwdg.de>
To: Christoph Hellwig <hch@...radead.org>
cc: Christoph Hellwig <hch@....de>,
Andrew Morton <akpm@...ux-foundation.org>, jack@...e.cz,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] remove sb->s_files and file_list_lock usage in dquot.c
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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists