[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6149.1250784391@redhat.com>
Date: Thu, 20 Aug 2009 17:06:31 +0100
From: David Howells <dhowells@...hat.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: dhowells@...hat.com, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] Use the cut_here() function in AFS, CacheFiles, FS-Cache and RxRPC
Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> instead. And yes, in the long run, I really think we should just extend
> the current BUG() reporting to have that kind of semantics, but I think
> your "cut_here()" thing is a horrible hack.
What about situations where I want to print quite a lot of information, say
several lines' worth?
For instance, if you look at cachefiles_mark_object_active() in
fs/cachefiles/namei.c, you'll see something like (which extended by one of my
patches):
wait_for_old_object:
if (xobject->fscache.state < FSCACHE_OBJECT_DYING) {
unsigned keylen;
u8 *keybuf;
printk(KERN_ERR "\n");
printk(KERN_ERR "CacheFiles: Error:"
" Unexpected object collision\n");
printk(KERN_ERR "xobject: OBJ%x\n",
xobject->fscache.debug_id);
printk(KERN_ERR "xobjstate=%s\n",
fscache_object_states[xobject->fscache.state]);
printk(KERN_ERR "xobjflags=%lx\n", xobject->fscache.flags);
printk(KERN_ERR "xobjevent=%lx [%lx]\n",
xobject->fscache.events, xobject->fscache.event_mask);
printk(KERN_ERR "xops=%u inp=%u exc=%u\n",
xobject->fscache.n_ops, xobject->fscache.n_in_progress,
xobject->fscache.n_exclusive);
printk(KERN_ERR "xcookie=%p [pr=%p nd=%p fl=%lx]\n",
xobject->fscache.cookie,
xobject->fscache.cookie->parent,
xobject->fscache.cookie->netfs_data,
xobject->fscache.cookie->flags);
printk(KERN_ERR "xparent=%p\n",
xobject->fscache.parent);
printk(KERN_ERR "object: OBJ%x\n",
object->fscache.debug_id);
printk(KERN_ERR "cookie=%p [pr=%p nd=%p fl=%lx]\n",
object->fscache.cookie,
object->fscache.cookie->parent,
object->fscache.cookie->netfs_data,
object->fscache.cookie->flags);
printk(KERN_ERR "parent=%p\n",
object->fscache.parent);
keybuf = kmalloc(512, GFP_NOIO);
if (keybuf) {
struct fscache_cookie *cookie;
unsigned loop;
cookie = object->fscache.cookie;
keylen = cookie->def->get_key(cookie->netfs_data,
keybuf, 512);
printk(KERN_ERR "okey=[%u] '", keylen);
for (loop = 0; loop < keylen; loop++)
printk("%02x", keybuf[loop]);
printk("'\n");
cookie = xobject->fscache.cookie;
keylen = cookie->def->get_key(cookie->netfs_data,
keybuf, 512);
printk(KERN_ERR "xkey=[%u] '", keylen);
for (loop = 0; loop < keylen; loop++)
printk("%02x", keybuf[loop]);
printk("'\n");
kfree(keybuf);
}
BUG();
With the cut_here() approach, I could put a cut_here() just inside the if-body,
but doing it with your approach and putting the whole lot in one format string
would also be pretty horrible, and risks overrunning the printk buffer.
David
--
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