Re: [PATCH] Increase number of dynamic inodes in procfs (2.6.5)

From: Andrew Morton
Date: Wed Apr 14 2004 - 21:54:58 EST


Nathan Lynch <nathanl@xxxxxxxxxxxxxx> wrote:
>
> > This open-codes a simple version of lib/idr.c. Please use lib/idr.c
> > instead. There's an example in fs/super.c
>
> Ok, thanks for the tip. Is this better?

Looks OK. How well tested was it? Nothing calls init_proc_inum_idr().
Maybe all-zeroes happens to work.

Happily, there's an idr patch in -mm which allows us to initialise these
guys at compile time, so...


diff -puN fs/proc/generic.c~increase-number-of-dynamic-inodes-in-procfs-265-idr-init fs/proc/generic.c
--- 25/fs/proc/generic.c~increase-number-of-dynamic-inodes-in-procfs-265-idr-init 2004-04-14 19:47:41.313236640 -0700
+++ 25-akpm/fs/proc/generic.c 2004-04-14 19:48:42.484937128 -0700
@@ -277,16 +277,11 @@ static int xlate_proc_name(const char *n
return 0;
}

-static struct idr proc_inum_idr;
+static DEFINE_IDR(proc_inum_idr);
static spinlock_t proc_inum_lock = SPIN_LOCK_UNLOCKED; /* protects the above */

#define PROC_DYNAMIC_FIRST 0xF0000000UL

-void __init init_proc_inum_idr(void)
-{
- idr_init(&proc_inum_idr);
-}
-
/*
* Return an inode number between PROC_DYNAMIC_FIRST and
* 0xffffffff, or zero on failure.
@@ -376,6 +371,7 @@ struct dentry *proc_lookup(struct inode
continue;
if (!memcmp(dentry->d_name.name, de->name, de->namelen)) {
unsigned int ino = de->low_ino;
+
error = -EINVAL;
inode = proc_get_inode(dir->i_sb, ino, de);
break;

_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/