From: Adam Borowski <kilobyte@angband.pl>
To: David Sterba <dsterba@suse.cz>, Josef Bacik <jbacik@fb.com>,
linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: make block group flags in balance printks human-readable
Date: Mon, 7 Nov 2016 22:38:10 +0100 [thread overview]
Message-ID: <20161107213810.GA25649@angband.pl> (raw)
In-Reply-To: <20161107165841.GQ12522@twin.jikos.cz>
On Mon, Nov 07, 2016 at 05:58:41PM +0100, David Sterba wrote:
> On Fri, Nov 04, 2016 at 08:26:54AM +0100, Adam Borowski wrote:
> > They're not even documented anywhere, letting users with no recourse but
> > to RTFS. It's no big burden to output the bitfield as words.
>
> Ok. Below are some comments (and style nitpicks).
[...]
> > + char flags_str[128];
>
> This could be a problem. The relocation can trigger deep call chains
> when doing IO, that need stack. I'd rather avoid the static buffer,
> please switch it to kmalloc.
Are the chains callers or callees of relocation? I believe exclusively the
latter, as balance is a long process that wouldn't make sense inside a deep
chain -- am I right? In that case, moving the printk to the display
function would localize the buffer, avoiding all complications of an alloc.
(v2 does alloc)
> As this is not a critical allocation, the fallback would be to print just
> the raw value as now.
If the kernel is that low on memory, is it reasonable to print an
unimportant message? As I see, lots of btrfs code would just fall over and
die horribly, with BUG_ON or aborting; perhaps skipping the message would
be safer?
(v2 has a fallback message)
> Also, please use snprintf. This would need extra variable to track
> number of already printed chars, but should be easy
M'kay. Even with all flags on (most are mutually exclusive) we won't get
anywhere close to 128 characters, but paranoia can't hurt.
Meow!
--
A MAP07 (Dead Simple) raspberry tincture recipe: 0.5l 95% alcohol, 1kg
raspberries, 0.4kg sugar; put into a big jar for 1 month. Filter out and
throw away the fruits (can dump them into a cake, etc), let the drink age
at least 3-6 months.
next prev parent reply other threads:[~2016-11-07 21:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-04 7:26 [PATCH] btrfs: make block group flags in balance printks human-readable Adam Borowski
2016-11-07 14:11 ` Holger Hoffstätte
2016-11-07 16:58 ` David Sterba
2016-11-07 21:38 ` Adam Borowski [this message]
2016-11-07 21:40 ` [PATCH v2] " Adam Borowski
2016-11-08 13:42 ` Holger Hoffstätte
2016-11-11 23:59 ` [PATCH v3-onstack] " Adam Borowski
2016-11-14 16:37 ` David Sterba
2016-11-14 17:44 ` [PATCH v4] " Adam Borowski
2016-11-14 18:24 ` David Sterba
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=20161107213810.GA25649@angband.pl \
--to=kilobyte@angband.pl \
--cc=dsterba@suse.cz \
--cc=jbacik@fb.com \
--cc=linux-btrfs@vger.kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).