LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jan Engelhardt <jengelh@linux01.gwdg.de>
To: Christoph Hellwig <hch@infradead.org>
Cc: Christoph Hellwig <hch@lst.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	jack@suse.cz, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] remove sb->s_files and file_list_lock usage in dquot.c
Date: Thu, 8 Feb 2007 13:22:22 +0100 (MET)	[thread overview]
Message-ID: <Pine.LNX.4.61.0702081315060.1364@yvahk01.tjqt.qr> (raw)
In-Reply-To: <20070207190632.GA3350@infradead.org>


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/

  reply	other threads:[~2007-02-08 12:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-06 13:23 Christoph Hellwig
2007-02-06 13:46 ` Jan Kara
2007-02-06 23:50 ` Andrew Morton
2007-02-07  7:22   ` Christoph Hellwig
2007-02-07 18:03     ` Jan Engelhardt
2007-02-07 19:06       ` Christoph Hellwig
2007-02-08 12:22         ` Jan Engelhardt [this message]
2007-02-07  8:35   ` Jan Kara
2007-02-08  9:01 ` Bill Huey
2007-02-09  7:14   ` Bill Huey
2007-02-09  7:23     ` Bill Huey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.61.0702081315060.1364@yvahk01.tjqt.qr \
    --to=jengelh@linux01.gwdg.de \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH] remove sb->s_files and file_list_lock usage in dquot.c' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).