Commit c69c6a6e authored by Jeff Garzik's avatar Jeff Garzik

Merge rum.normnet.org:/spare/vanilla/linus-2.5

into rum.normnet.org:/spare/vanilla/net-drivers-2.5
parents 339c84ae 0431923f
...@@ -279,13 +279,13 @@ int cb_alloc(socket_info_t * s) ...@@ -279,13 +279,13 @@ int cb_alloc(socket_info_t * s)
pci_readw(dev, PCI_DEVICE_ID, &dev->device); pci_readw(dev, PCI_DEVICE_ID, &dev->device);
dev->hdr_type = hdr & 0x7f; dev->hdr_type = hdr & 0x7f;
pci_setup_device(dev);
dev->dev.parent = bus->dev; dev->dev.parent = bus->dev;
strcpy(dev->dev.name, dev->name); strcpy(dev->dev.name, dev->name);
strcpy(dev->dev.bus_id, dev->slot_name); strcpy(dev->dev.bus_id, dev->slot_name);
device_register(&dev->dev); device_register(&dev->dev);
pci_setup_device(dev);
/* FIXME: Do we need to enable the expansion ROM? */ /* FIXME: Do we need to enable the expansion ROM? */
for (r = 0; r < 7; r++) { for (r = 0; r < 7; r++) {
struct resource *res = dev->resource + r; struct resource *res = dev->resource + r;
......
...@@ -270,9 +270,8 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -270,9 +270,8 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
struct buffer_head *root_bh = NULL; struct buffer_head *root_bh = NULL;
struct buffer_head *boot_bh; struct buffer_head *boot_bh;
struct inode *root_inode = NULL; struct inode *root_inode = NULL;
kdev_t dev = sb->s_dev;
s32 root_block; s32 root_block;
int blocks, size, blocksize; int size, blocksize;
u32 chksum; u32 chksum;
int num_bm; int num_bm;
int i, j; int i, j;
...@@ -308,12 +307,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -308,12 +307,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
* blocks, we will have to change it. * blocks, we will have to change it.
*/ */
blocks = blk_size[major(dev)] ? blk_size[major(dev)][minor(dev)] : 0; size = sb->s_bdev->bd_inode->i_size >> 9;
if (!blocks) {
printk(KERN_ERR "AFFS: Could not determine device size\n");
goto out_error;
}
size = (BLOCK_SIZE / 512) * blocks;
pr_debug("AFFS: initial blksize=%d, blocks=%d\n", 512, blocks); pr_debug("AFFS: initial blksize=%d, blocks=%d\n", 512, blocks);
affs_set_blocksize(sb, PAGE_SIZE); affs_set_blocksize(sb, PAGE_SIZE);
......
...@@ -289,7 +289,7 @@ static void write_dquot(struct dquot *dquot) ...@@ -289,7 +289,7 @@ static void write_dquot(struct dquot *dquot)
sizeof(struct dqblk), &offset); sizeof(struct dqblk), &offset);
if (ret != sizeof(struct dqblk)) if (ret != sizeof(struct dqblk))
printk(KERN_WARNING "VFS: dquota write failed on dev %s\n", printk(KERN_WARNING "VFS: dquota write failed on dev %s\n",
kdevname(dquot->dq_sb->s_dev)); dquot->dq_sb->s_id);
set_fs(fs); set_fs(fs);
up(sem); up(sem);
...@@ -440,7 +440,7 @@ static void dqput(struct dquot *dquot) ...@@ -440,7 +440,7 @@ static void dqput(struct dquot *dquot)
if (!dquot->dq_count) { if (!dquot->dq_count) {
printk("VFS: dqput: trying to free free dquot\n"); printk("VFS: dqput: trying to free free dquot\n");
printk("VFS: device %s, dquot of %s %d\n", printk("VFS: device %s, dquot of %s %d\n",
kdevname(dquot->dq_sb->s_dev), dquot->dq_sb->s_id,
quotatypes[dquot->dq_type], quotatypes[dquot->dq_type],
dquot->dq_id); dquot->dq_id);
return; return;
...@@ -715,7 +715,7 @@ static void print_warning(struct dquot *dquot, const char warntype) ...@@ -715,7 +715,7 @@ static void print_warning(struct dquot *dquot, const char warntype)
if (!need_print_warning(dquot, flag)) if (!need_print_warning(dquot, flag))
return; return;
dquot->dq_flags |= flag; dquot->dq_flags |= flag;
tty_write_message(current->tty, (char *)bdevname(dquot->dq_sb->s_dev)); tty_write_message(current->tty, dquot->dq_sb->s_id);
if (warntype == ISOFTWARN || warntype == BSOFTWARN) if (warntype == ISOFTWARN || warntype == BSOFTWARN)
tty_write_message(current->tty, ": warning, "); tty_write_message(current->tty, ": warning, ");
else else
......
...@@ -404,7 +404,7 @@ int ext2_new_block (struct inode * inode, unsigned long goal, ...@@ -404,7 +404,7 @@ int ext2_new_block (struct inode * inode, unsigned long goal,
if (DQUOT_ALLOC_BLOCK(inode, 1)) if (DQUOT_ALLOC_BLOCK(inode, 1))
goto out; goto out;
while (prealloc_goal && !DQUOT_PREALLOC_BLOCK(inode, prealloc_goal)) while (prealloc_goal && DQUOT_PREALLOC_BLOCK(inode, prealloc_goal))
prealloc_goal--; prealloc_goal--;
dq_alloc = prealloc_goal + 1; dq_alloc = prealloc_goal + 1;
......
...@@ -306,9 +306,8 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file, ...@@ -306,9 +306,8 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
struct nlm_block *block; struct nlm_block *block;
int error; int error;
dprintk("lockd: nlmsvc_lock(%02x:%02x/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n", dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n",
major(file->f_file.f_dentry->d_inode->i_dev), file->f_file.f_dentry->d_inode->i_sb->s_id,
minor(file->f_file.f_dentry->d_inode->i_dev),
file->f_file.f_dentry->d_inode->i_ino, file->f_file.f_dentry->d_inode->i_ino,
lock->fl.fl_type, lock->fl.fl_pid, lock->fl.fl_type, lock->fl.fl_pid,
(long long)lock->fl.fl_start, (long long)lock->fl.fl_start,
...@@ -386,9 +385,8 @@ nlmsvc_testlock(struct nlm_file *file, struct nlm_lock *lock, ...@@ -386,9 +385,8 @@ nlmsvc_testlock(struct nlm_file *file, struct nlm_lock *lock,
{ {
struct file_lock *fl; struct file_lock *fl;
dprintk("lockd: nlmsvc_testlock(%02x:%02x/%ld, ty=%d, %Ld-%Ld)\n", dprintk("lockd: nlmsvc_testlock(%s/%ld, ty=%d, %Ld-%Ld)\n",
major(file->f_file.f_dentry->d_inode->i_dev), file->f_file.f_dentry->d_inode->i_sb->s_id,
minor(file->f_file.f_dentry->d_inode->i_dev),
file->f_file.f_dentry->d_inode->i_ino, file->f_file.f_dentry->d_inode->i_ino,
lock->fl.fl_type, lock->fl.fl_type,
(long long)lock->fl.fl_start, (long long)lock->fl.fl_start,
...@@ -419,9 +417,8 @@ nlmsvc_unlock(struct nlm_file *file, struct nlm_lock *lock) ...@@ -419,9 +417,8 @@ nlmsvc_unlock(struct nlm_file *file, struct nlm_lock *lock)
{ {
int error; int error;
dprintk("lockd: nlmsvc_unlock(%02x:%02x/%ld, pi=%d, %Ld-%Ld)\n", dprintk("lockd: nlmsvc_unlock(%s/%ld, pi=%d, %Ld-%Ld)\n",
major(file->f_file.f_dentry->d_inode->i_dev), file->f_file.f_dentry->d_inode->i_sb->s_id,
minor(file->f_file.f_dentry->d_inode->i_dev),
file->f_file.f_dentry->d_inode->i_ino, file->f_file.f_dentry->d_inode->i_ino,
lock->fl.fl_pid, lock->fl.fl_pid,
(long long)lock->fl.fl_start, (long long)lock->fl.fl_start,
...@@ -448,9 +445,8 @@ nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock) ...@@ -448,9 +445,8 @@ nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock)
{ {
struct nlm_block *block; struct nlm_block *block;
dprintk("lockd: nlmsvc_cancel(%02x:%02x/%ld, pi=%d, %Ld-%Ld)\n", dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n",
major(file->f_file.f_dentry->d_inode->i_dev), file->f_file.f_dentry->d_inode->i_sb->s_id,
minor(file->f_file.f_dentry->d_inode->i_dev),
file->f_file.f_dentry->d_inode->i_ino, file->f_file.f_dentry->d_inode->i_ino,
lock->fl.fl_pid, lock->fl.fl_pid,
(long long)lock->fl.fl_start, (long long)lock->fl.fl_start,
......
...@@ -128,7 +128,7 @@ nlm_delete_file(struct nlm_file *file) ...@@ -128,7 +128,7 @@ nlm_delete_file(struct nlm_file *file)
struct nlm_file **fp, *f; struct nlm_file **fp, *f;
dprintk("lockd: closing file %s/%ld\n", dprintk("lockd: closing file %s/%ld\n",
kdevname(inode->i_dev), inode->i_ino); inode->i_sb->s_id, inode->i_ino);
fp = nlm_files + file->f_hash; fp = nlm_files + file->f_hash;
while ((f = *fp) != NULL) { while ((f = *fp) != NULL) {
if (f == file) { if (f == file) {
......
...@@ -375,7 +375,6 @@ exp_rootfh(struct svc_client *clp, char *path, struct knfsd_fh *f, int maxsize) ...@@ -375,7 +375,6 @@ exp_rootfh(struct svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
struct nameidata nd; struct nameidata nd;
struct inode *inode; struct inode *inode;
struct svc_fh fh; struct svc_fh fh;
kdev_t dev;
int err; int err;
err = -EPERM; err = -EPERM;
...@@ -386,11 +385,10 @@ exp_rootfh(struct svc_client *clp, char *path, struct knfsd_fh *f, int maxsize) ...@@ -386,11 +385,10 @@ exp_rootfh(struct svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
return err; return err;
} }
inode = nd.dentry->d_inode; inode = nd.dentry->d_inode;
dev = inode->i_dev;
dprintk("nfsd: exp_rootfh(%s [%p] %s:%02x:%02x/%ld)\n", dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n",
path, nd.dentry, clp->cl_ident, path, nd.dentry, clp->cl_ident,
major(dev), minor(dev), (long) inode->i_ino); inode->i_sb->s_id, inode->i_ino);
exp = exp_parent(clp, inode->i_sb, nd.dentry); exp = exp_parent(clp, inode->i_sb, nd.dentry);
if (!exp) { if (!exp) {
dprintk("nfsd: exp_rootfh export not found.\n"); dprintk("nfsd: exp_rootfh export not found.\n");
......
...@@ -424,8 +424,7 @@ find_fh_dentry(struct super_block *sb, __u32 *datap, int len, int fhtype, int ne ...@@ -424,8 +424,7 @@ find_fh_dentry(struct super_block *sb, __u32 *datap, int len, int fhtype, int ne
/* It's a directory, or we are required to confirm the file's /* It's a directory, or we are required to confirm the file's
* location in the tree. * location in the tree.
*/ */
dprintk("nfs_fh: need to look harder for %02x:%02x/%d\n", dprintk("nfs_fh: need to look harder for %s/%d\n", sb->s_id, datap[0]);
major(sb->s_dev), minor(sb->s_dev), datap[0]);
if (!S_ISDIR(result->d_inode->i_mode)) { if (!S_ISDIR(result->d_inode->i_mode)) {
nfsdstats.fh_nocache_nondir++; nfsdstats.fh_nocache_nondir++;
......
...@@ -1410,8 +1410,8 @@ nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset, ...@@ -1410,8 +1410,8 @@ nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
oldlen = cd.buflen; oldlen = cd.buflen;
/* /*
dprintk("nfsd: f_op->readdir(%x/%ld @ %d) buflen = %d (%d)\n", dprintk("nfsd: f_op->readdir(%s/%ld @ %d) buflen = %d (%d)\n",
file.f_inode->i_dev, file.f_inode->i_ino, file.f_inode->i_sb->s_id, file.f_inode->i_ino,
(int) file.f_pos, (int) oldlen, (int) cd.buflen); (int) file.f_pos, (int) oldlen, (int) cd.buflen);
*/ */
err = file.f_op->readdir(&file, &cd, (filldir_t) func); err = file.f_op->readdir(&file, &cd, (filldir_t) func);
......
...@@ -50,9 +50,6 @@ ...@@ -50,9 +50,6 @@
* have a way to deal with that gracefully. Right now I used straightforward * have a way to deal with that gracefully. Right now I used straightforward
* wrappers, but this needs further analysis wrt potential overflows. * wrappers, but this needs further analysis wrt potential overflows.
*/ */
#ifdef CONFIG_MODULES
extern int get_module_list(char *);
#endif
extern int get_device_list(char *); extern int get_device_list(char *);
extern int get_partition_list(char *, char **, off_t, int); extern int get_partition_list(char *, char **, off_t, int);
extern int get_filesystem_list(char *); extern int get_filesystem_list(char *);
...@@ -203,13 +200,17 @@ static struct file_operations proc_cpuinfo_operations = { ...@@ -203,13 +200,17 @@ static struct file_operations proc_cpuinfo_operations = {
}; };
#ifdef CONFIG_MODULES #ifdef CONFIG_MODULES
static int modules_read_proc(char *page, char **start, off_t off, extern struct seq_operations modules_op;
int count, int *eof, void *data) static int modules_open(struct inode *inode, struct file *file)
{ {
int len = get_module_list(page); return seq_open(file, &modules_op);
return proc_calc_metrics(page, start, off, count, eof, len);
} }
static struct file_operations proc_modules_operations = {
open: modules_open,
read: seq_read,
llseek: seq_lseek,
release: seq_release,
};
extern struct seq_operations ksyms_op; extern struct seq_operations ksyms_op;
static int ksyms_open(struct inode *inode, struct file *file) static int ksyms_open(struct inode *inode, struct file *file)
{ {
...@@ -223,6 +224,20 @@ static struct file_operations proc_ksyms_operations = { ...@@ -223,6 +224,20 @@ static struct file_operations proc_ksyms_operations = {
}; };
#endif #endif
extern struct seq_operations slabinfo_op;
extern ssize_t slabinfo_write(struct file *, const char *, size_t, loff_t *);
static int slabinfo_open(struct inode *inode, struct file *file)
{
return seq_open(file, &slabinfo_op);
}
static struct file_operations proc_slabinfo_operations = {
open: slabinfo_open,
read: seq_read,
write: slabinfo_write,
llseek: seq_lseek,
release: seq_release,
};
static int kstat_read_proc(char *page, char **start, off_t off, static int kstat_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data) int count, int *eof, void *data)
{ {
...@@ -521,9 +536,6 @@ void __init proc_misc_init(void) ...@@ -521,9 +536,6 @@ void __init proc_misc_init(void)
{"uptime", uptime_read_proc}, {"uptime", uptime_read_proc},
{"meminfo", meminfo_read_proc}, {"meminfo", meminfo_read_proc},
{"version", version_read_proc}, {"version", version_read_proc},
#ifdef CONFIG_MODULES
{"modules", modules_read_proc},
#endif
{"stat", kstat_read_proc}, {"stat", kstat_read_proc},
{"devices", devices_read_proc}, {"devices", devices_read_proc},
{"partitions", partitions_read_proc}, {"partitions", partitions_read_proc},
...@@ -551,7 +563,9 @@ void __init proc_misc_init(void) ...@@ -551,7 +563,9 @@ void __init proc_misc_init(void)
entry->proc_fops = &proc_kmsg_operations; entry->proc_fops = &proc_kmsg_operations;
create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations); create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);
create_seq_entry("interrupts", 0, &proc_interrupts_operations); create_seq_entry("interrupts", 0, &proc_interrupts_operations);
create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations);
#ifdef CONFIG_MODULES #ifdef CONFIG_MODULES
create_seq_entry("modules", 0, &proc_modules_operations);
create_seq_entry("ksyms", 0, &proc_ksyms_operations); create_seq_entry("ksyms", 0, &proc_ksyms_operations);
#endif #endif
proc_root_kcore = create_proc_entry("kcore", S_IRUSR, NULL); proc_root_kcore = create_proc_entry("kcore", S_IRUSR, NULL);
...@@ -575,8 +589,4 @@ void __init proc_misc_init(void) ...@@ -575,8 +589,4 @@ void __init proc_misc_init(void)
entry->proc_fops = &ppc_htab_operations; entry->proc_fops = &ppc_htab_operations;
} }
#endif #endif
entry = create_proc_read_entry("slabinfo", S_IWUSR | S_IRUGO, NULL,
slabinfo_read_proc, NULL);
if (entry)
entry->write_proc = slabinfo_write_proc;
} }
...@@ -62,11 +62,6 @@ extern void *kmalloc(size_t, int); ...@@ -62,11 +62,6 @@ extern void *kmalloc(size_t, int);
extern void kfree(const void *); extern void kfree(const void *);
extern int FASTCALL(kmem_cache_reap(int)); extern int FASTCALL(kmem_cache_reap(int));
extern int slabinfo_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data);
struct file;
extern int slabinfo_write_proc(struct file *file, const char *buffer,
unsigned long count, void *data);
/* System wide caches */ /* System wide caches */
extern kmem_cache_t *vm_area_cachep; extern kmem_cache_t *vm_area_cachep;
......
...@@ -1075,84 +1075,67 @@ free_module(struct module *mod, int tag_freed) ...@@ -1075,84 +1075,67 @@ free_module(struct module *mod, int tag_freed)
/* /*
* Called by the /proc file system to return a current list of modules. * Called by the /proc file system to return a current list of modules.
*/ */
static void *m_start(struct seq_file *m, loff_t *pos)
int get_module_list(char *p)
{ {
size_t left = PAGE_SIZE; struct module *v;
struct module *mod; loff_t n = *pos;
char tmpstr[64]; lock_kernel();
struct module_ref *ref; for (v = module_list; v && n--; v = v->next)
;
for (mod = module_list; mod != &kernel_module; mod = mod->next) { return v;
long len; }
const char *q; static void *m_next(struct seq_file *m, void *p, loff_t *pos)
{
#define safe_copy_str(str, len) \ struct module *v = p;
do { \ (*pos)++;
if (left < len) \ return v->next;
goto fini; \ }
memcpy(p, str, len); p += len, left -= len; \ static void m_stop(struct seq_file *m, void *p)
} while (0) {
#define safe_copy_cstr(str) safe_copy_str(str, sizeof(str)-1) unlock_kernel();
}
len = strlen(mod->name); static int m_show(struct seq_file *m, void *p)
safe_copy_str(mod->name, len); {
struct module *mod = p;
if ((len = 20 - len) > 0) { struct module_ref *ref = mod->refs;
if (left < len)
goto fini;
memset(p, ' ', len);
p += len;
left -= len;
}
len = sprintf(tmpstr, "%8lu", mod->size); if (mod == &kernel_module)
safe_copy_str(tmpstr, len); return 0;
if (mod->flags & MOD_RUNNING) { seq_printf(m, "%-20s%8lu", mod->name, mod->size);
len = sprintf(tmpstr, "%4ld", if (mod->flags & MOD_RUNNING)
seq_printf(m, "%4ld",
(mod_member_present(mod, can_unload) (mod_member_present(mod, can_unload)
&& mod->can_unload && mod->can_unload
? -1L : (long)atomic_read(&mod->uc.usecount))); ? -1L : (long)atomic_read(&mod->uc.usecount)));
safe_copy_str(tmpstr, len);
}
if (mod->flags & MOD_DELETED) if (mod->flags & MOD_DELETED)
safe_copy_cstr(" (deleted)"); seq_puts(m, " (deleted)");
else if (mod->flags & MOD_RUNNING) { else if (mod->flags & MOD_RUNNING) {
if (mod->flags & MOD_AUTOCLEAN) if (mod->flags & MOD_AUTOCLEAN)
safe_copy_cstr(" (autoclean)"); seq_puts(m, " (autoclean)");
if (!(mod->flags & MOD_USED_ONCE)) if (!(mod->flags & MOD_USED_ONCE))
safe_copy_cstr(" (unused)"); seq_puts(m, " (unused)");
} } else if (mod->flags & MOD_INITIALIZING)
else if (mod->flags & MOD_INITIALIZING) seq_puts(m, " (initializing)");
safe_copy_cstr(" (initializing)");
else
safe_copy_cstr(" (uninitialized)");
if ((ref = mod->refs) != NULL) {
safe_copy_cstr(" [");
while (1) {
q = ref->ref->name;
len = strlen(q);
safe_copy_str(q, len);
if ((ref = ref->next_ref) != NULL)
safe_copy_cstr(" ");
else else
break; seq_puts(m, " (uninitialized)");
} if (ref) {
safe_copy_cstr("]"); char c;
} seq_putc(m, ' ');
safe_copy_cstr("\n"); for (c = '[' ; ref; c = ' ', ref = ref->next_ref)
seq_printf(m, "%c%s", c, ref->ref->name);
#undef safe_copy_str seq_putc(m, ']');
#undef safe_copy_cstr }
} seq_putc(m, '\n');
return 0;
fini:
return PAGE_SIZE - left;
} }
struct seq_operations modules_op = {
start: m_start,
next: m_next,
stop: m_stop,
show: m_show
};
/* /*
* Called by the /proc file system to return a current list of ksyms. * Called by the /proc file system to return a current list of ksyms.
......
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
/* /*
...@@ -1869,44 +1870,42 @@ int kmem_cache_reap (int gfp_mask) ...@@ -1869,44 +1870,42 @@ int kmem_cache_reap (int gfp_mask)
} }
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
/* /proc/slabinfo
* cache-name num-active-objs total-objs
* obj-size num-active-slabs total-slabs
* num-pages-per-slab
*/
#define FIXUP(t) \
do { \
if (len <= off) { \
off -= len; \
len = 0; \
} else { \
if (len-off > count) \
goto t; \
} \
} while (0)
static int proc_getdata (char*page, char**start, off_t off, int count) static void *s_start(struct seq_file *m, loff_t *pos)
{ {
loff_t n = *pos;
struct list_head *p; struct list_head *p;
int len = 0;
/* Output format version, so at least we can change it without _too_
* many complaints.
*/
len += sprintf(page+len, "slabinfo - version: 1.1"
#if STATS
" (statistics)"
#endif
#ifdef CONFIG_SMP
" (SMP)"
#endif
"\n");
FIXUP(got_data);
down(&cache_chain_sem); down(&cache_chain_sem);
if (!n)
return (void *)1;
p = &cache_cache.next; p = &cache_cache.next;
do { while (--n) {
kmem_cache_t *cachep; p = p->next;
if (p == &cache_cache.next)
return NULL;
}
return list_entry(p, kmem_cache_t, next);
}
static void *s_next(struct seq_file *m, void *p, loff_t *pos)
{
kmem_cache_t *cachep = p;
++*pos;
if (p == (void *)1)
return &cache_cache;
cachep = list_entry(cachep->next.next, kmem_cache_t, next);
return cachep == &cache_cache ? NULL : cachep;
}
static void s_stop(struct seq_file *m, void *p)
{
up(&cache_chain_sem);
}
static int s_show(struct seq_file *m, void *p)
{
kmem_cache_t *cachep = p;
struct list_head *q; struct list_head *q;
slab_t *slabp; slab_t *slabp;
unsigned long active_objs; unsigned long active_objs;
...@@ -1914,7 +1913,22 @@ static int proc_getdata (char*page, char**start, off_t off, int count) ...@@ -1914,7 +1913,22 @@ static int proc_getdata (char*page, char**start, off_t off, int count)
unsigned long active_slabs = 0; unsigned long active_slabs = 0;
unsigned long num_slabs; unsigned long num_slabs;
const char *name; const char *name;
cachep = list_entry(p, kmem_cache_t, next);
if (p == (void*)1) {
/*
* Output format version, so at least we can change it
* without _too_ many complaints.
*/
seq_puts(m, "slabinfo - version: 1.1"
#if STATS
" (statistics)"
#endif
#ifdef CONFIG_SMP
" (SMP)"
#endif
"\n");
return 0;
}
spin_lock_irq(&cachep->spinlock); spin_lock_irq(&cachep->spinlock);
active_objs = 0; active_objs = 0;
...@@ -1949,7 +1963,7 @@ static int proc_getdata (char*page, char**start, off_t off, int count) ...@@ -1949,7 +1963,7 @@ static int proc_getdata (char*page, char**start, off_t off, int count)
name = "broken"; name = "broken";
} }
len += sprintf(page+len, "%-17s %6lu %6lu %6u %4lu %4lu %4u", seq_printf(m, "%-17s %6lu %6lu %6u %4lu %4lu %4u",
name, active_objs, num_objs, cachep->objsize, name, active_objs, num_objs, cachep->objsize,
active_slabs, num_slabs, (1<<cachep->gfporder)); active_slabs, num_slabs, (1<<cachep->gfporder));
...@@ -1961,7 +1975,7 @@ static int proc_getdata (char*page, char**start, off_t off, int count) ...@@ -1961,7 +1975,7 @@ static int proc_getdata (char*page, char**start, off_t off, int count)
unsigned long reaped = cachep->reaped; unsigned long reaped = cachep->reaped;
unsigned long allocs = cachep->num_allocations; unsigned long allocs = cachep->num_allocations;
len += sprintf(page+len, " : %6lu %7lu %5lu %4lu %4lu", seq_printf(m, " : %6lu %7lu %5lu %4lu %4lu",
high, allocs, grown, reaped, errors); high, allocs, grown, reaped, errors);
} }
#endif #endif
...@@ -1974,8 +1988,7 @@ static int proc_getdata (char*page, char**start, off_t off, int count) ...@@ -1974,8 +1988,7 @@ static int proc_getdata (char*page, char**start, off_t off, int count)
limit = cc_data(cachep)->limit; limit = cc_data(cachep)->limit;
else else
limit = 0; limit = 0;
len += sprintf(page+len, " : %4u %4u", seq_printf(m, " : %4u %4u", limit, batchcount);
limit, batchcount);
} }
#endif #endif
#if STATS && defined(CONFIG_SMP) #if STATS && defined(CONFIG_SMP)
...@@ -1984,33 +1997,19 @@ static int proc_getdata (char*page, char**start, off_t off, int count) ...@@ -1984,33 +1997,19 @@ static int proc_getdata (char*page, char**start, off_t off, int count)
unsigned long allocmiss = atomic_read(&cachep->allocmiss); unsigned long allocmiss = atomic_read(&cachep->allocmiss);
unsigned long freehit = atomic_read(&cachep->freehit); unsigned long freehit = atomic_read(&cachep->freehit);
unsigned long freemiss = atomic_read(&cachep->freemiss); unsigned long freemiss = atomic_read(&cachep->freemiss);
len += sprintf(page+len, " : %6lu %6lu %6lu %6lu", seq_printf(m, " : %6lu %6lu %6lu %6lu",
allochit, allocmiss, freehit, freemiss); allochit, allocmiss, freehit, freemiss);
} }
#endif #endif
len += sprintf(page+len,"\n");
spin_unlock_irq(&cachep->spinlock); spin_unlock_irq(&cachep->spinlock);
FIXUP(got_data_up); seq_putc(m, '\n');
p = cachep->next.next; return 0;
} while (p != &cache_cache.next);
got_data_up:
up(&cache_chain_sem);
got_data:
*start = page+off;
return len;
} }
/** /**
* slabinfo_read_proc - generates /proc/slabinfo * slabinfo_op - iterator that generates /proc/slabinfo
* @page: scratch area, one page long
* @start: pointer to the pointer to the output buffer
* @off: offset within /proc/slabinfo the caller is interested in
* @count: requested len in bytes
* @eof: eof marker
* @data: unused
* *
* The contents of the buffer are * Output layout:
* cache-name * cache-name
* num-active-objs * num-active-objs
* total-objs * total-objs
...@@ -2020,28 +2019,24 @@ static int proc_getdata (char*page, char**start, off_t off, int count) ...@@ -2020,28 +2019,24 @@ static int proc_getdata (char*page, char**start, off_t off, int count)
* num-pages-per-slab * num-pages-per-slab
* + further values on SMP and with statistics enabled * + further values on SMP and with statistics enabled
*/ */
int slabinfo_read_proc (char *page, char **start, off_t off,
int count, int *eof, void *data) struct seq_operations slabinfo_op = {
{ start: s_start,
int len = proc_getdata(page, start, off, count); next: s_next,
len -= (*start-page); stop: s_stop,
if (len <= count) show: s_show
*eof = 1; };
if (len>count) len = count;
if (len<0) len = 0;
return len;
}
#define MAX_SLABINFO_WRITE 128 #define MAX_SLABINFO_WRITE 128
/** /**
* slabinfo_write_proc - SMP tuning for the slab allocator * slabinfo_write - SMP tuning for the slab allocator
* @file: unused * @file: unused
* @buffer: user buffer * @buffer: user buffer
* @count: data len * @count: data len
* @data: unused * @data: unused
*/ */
int slabinfo_write_proc (struct file *file, const char *buffer, ssize_t slabinfo_write(struct file *file, const char *buffer,
unsigned long count, void *data) size_t count, loff_t *ppos)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
char kbuf[MAX_SLABINFO_WRITE+1], *tmp; char kbuf[MAX_SLABINFO_WRITE+1], *tmp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment