From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755766AbbCaRGV (ORCPT ); Tue, 31 Mar 2015 13:06:21 -0400 Received: from smtprelay0080.hostedemail.com ([216.40.44.80]:60021 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753099AbbCaRGU (ORCPT ); Tue, 31 Mar 2015 13:06:20 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:541:599:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3867:3868:3870:3871:3873:3874:4250:4321:4605:5007:6261:7903:8660:10004:10400:10848:11026:11232:11658:11914:12295:12296:12517:12519:12740:13069:13148:13230:13311:13357:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: hate32_5409b13c8722e X-Filterd-Recvd-Size: 2521 Message-ID: <1427821576.10376.29.camel@perches.com> Subject: Re: [PATCH 1/7] lib/vsprintf: add %*pg format specifier From: Joe Perches To: Dmitry Monakhov Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, axboe@kernel.dk, viro@zeniv.linux.org.uk, dm-devel@redhat.com Date: Tue, 31 Mar 2015 10:06:16 -0700 In-Reply-To: <1427817681-4494-2-git-send-email-dmonakhov@openvz.org> References: <1427817681-4494-1-git-send-email-dmonakhov@openvz.org> <1427817681-4494-2-git-send-email-dmonakhov@openvz.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2015-03-31 at 20:01 +0400, Dmitry Monakhov wrote: > This allow to directly print block_device name. > Currently one should use bdevname() with temporal char buf[BDEVNAME_SIZE]. > This is very ineffective because bloat stack usage for deep IO call-traces [] > diff --git a/lib/vsprintf.c b/lib/vsprintf.c [] > @@ -610,6 +613,23 @@ char *dentry_name(char *buf, char *end, const struct dentry *d, struct printf_sp > return buf; > } > > +#ifdef CONFIG_BLOCK > +static noinline_for_stack > +char *bdev_name(char *buf, char *end, struct block_device *bdev, > + struct printf_spec spec, const char *fmt) > +{ > + struct gendisk *hd = bdev->bd_disk; Can you please use the same form as dentry_name and dereference the pointer in vsprintf not here as below. > @@ -1404,6 +1424,8 @@ int kptr_restrict __read_mostly; > * (default assumed to be phys_addr_t, passed by reference) > * - 'd[234]' For a dentry name (optionally 2-4 last components) > * - 'D[234]' Same as 'd' but for a struct file > + * - 'g' For block_device name (gendisk + partition number) > + > * > * Note: The difference between 'S' and 'F' is that on ia64 and ppc64 > * function pointers are really function descriptors, which contain a > @@ -1552,6 +1574,11 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, > return dentry_name(buf, end, > ((const struct file *)ptr)->f_path.dentry, > spec, fmt); > +#ifdef CONFIG_BLOCK > + case 'g': > + return bdev_name(buf, end, ptr, spec, fmt); > +#endif > + > }