xfs
[Top] [All Lists]

Re: [PATCH] xfs: prevent NMI timeouts in cmn_err

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH] xfs: prevent NMI timeouts in cmn_err
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Fri, 10 Dec 2010 08:29:35 -0500
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20101203043846.GB23339@dastard>
References: <1291341315-31338-1-git-send-email-david@xxxxxxxxxxxxx> <20101203043846.GB23339@dastard>
User-agent: Mutt/1.5.21 (2010-09-15)
On Fri, Dec 03, 2010 at 03:38:46PM +1100, Dave Chinner wrote:
> FWIW, while these macros are the best way to make a simple backport
> is possible, I just discovered that mainline has a %pV format
> operator that allows an implementation like:
> 
> void
> xfs_fs_cmn_err(
>       const char              *lvl,
>       struct xfs_mount        *mp,
>       const char              *fmt,
>       ...)
> {
>       struct va_format        vaf;
>       va_list                 args;
> 
>       va_start(args, fmt);
>       vaf.fmt = fmt;
>       vaf.va = &args;
> 
>       printk("%sFilesystem %s: %pV", lvl, mp->m_fsname, &vaf);
>       va_end(args);
> 
>       BUG_ON(strncmp(lvl, KERN_EMERG, strlen(KERN_EMERG)) == 0);
> }

With this we can also keep the existing integer-based CE_ values
and do trivial array lookup.  That also avoids having to do a strcmp for
every message printed.

<Prev in Thread] Current Thread [Next in Thread>