From patchwork Tue Jul 27 06:25:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12401841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 291CFC4338F for ; Tue, 27 Jul 2021 06:28:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0F4B961103 for ; Tue, 27 Jul 2021 06:28:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234226AbhG0G2I (ORCPT ); Tue, 27 Jul 2021 02:28:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233553AbhG0G2I (ORCPT ); Tue, 27 Jul 2021 02:28:08 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CA1CC061757 for ; Mon, 26 Jul 2021 23:28:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=wBwc3BUmXI8vS7nsHzvDmg1l6ZTgMjHTsIaJNTmQH8s=; b=sShZuBru8udc4DDB33gbprMjXE k18kT6bwJOGUfb8ek8e5uoROyAQ7Gv+p9yDKicsv6kwbbC934wqJ8lYBjmZaYEwqMOP9yXDBejT6t 0tkCdhz0ZPx9hgxyDBThtR9xGs6Jbt21FKJ5GWC12oqDwS5EzYEYPdCOnLlyhDJk0yqqODwj2ph/X vZJzNdIFZG2fi8GuZqKg3z+dvoLb64awLSvc+wNJaxOyDFV6zW0nEqouSgI2/tQxtHhpIeCzKNzmc bLujYVE4tsJj5f7uG7ZFuwcbXsugf5slK/nUc97QVxbaaH3dfbA2LSAisAghlucpz8S2viJ2meFOs KSdtDXLQ==; Received: from [2001:4bb8:184:87c5:b7fb:1299:a9e5:ff56] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8GYD-00EkKE-MV; Tue, 27 Jul 2021 06:27:10 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Abd-Alrhman Masalkhi , linux-block@vger.kernel.org Subject: [PATCH 1/6] block: reduce stack usage in diskstats_show Date: Tue, 27 Jul 2021 08:25:13 +0200 Message-Id: <20210727062518.122108-2-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210727062518.122108-1-hch@lst.de> References: <20210727062518.122108-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Abd-Alrhman Masalkhi I have compiled the kernel with a cross compiler "hppa-linux-gnu-" v9.3.0 on x86-64 host machine. I got the following warning: block/genhd.c: In function ‘diskstats_show’: block/genhd.c:1227:1: warning: the frame size of 1688 bytes is larger than 1280 bytes [-Wframe-larger-than=] 1227 | } By Reduced the stack footprint by using the %pg printk specifier instead of disk_name to remove the need for the on-stack buffer. Signed-off-by: Abd-Alrhman Masalkhi Signed-off-by: Christoph Hellwig Reviewed-by: Hannes Reinecke --- block/genhd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index af4d2ab4a633..80ad85822419 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -1117,7 +1117,6 @@ static int diskstats_show(struct seq_file *seqf, void *v) { struct gendisk *gp = v; struct block_device *hd; - char buf[BDEVNAME_SIZE]; unsigned int inflight; struct disk_stats stat; unsigned long idx; @@ -1140,15 +1139,14 @@ static int diskstats_show(struct seq_file *seqf, void *v) else inflight = part_in_flight(hd); - seq_printf(seqf, "%4d %7d %s " + seq_printf(seqf, "%4d %7d %pg " "%lu %lu %lu %u " "%lu %lu %lu %u " "%u %u %u " "%lu %lu %lu %u " "%lu %u" "\n", - MAJOR(hd->bd_dev), MINOR(hd->bd_dev), - disk_name(gp, hd->bd_partno, buf), + MAJOR(hd->bd_dev), MINOR(hd->bd_dev), hd, stat.ios[STAT_READ], stat.merges[STAT_READ], stat.sectors[STAT_READ], From patchwork Tue Jul 27 06:25:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12401843 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FB9CC4338F for ; Tue, 27 Jul 2021 06:29:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 879E061103 for ; Tue, 27 Jul 2021 06:29:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234349AbhG0G3J (ORCPT ); Tue, 27 Jul 2021 02:29:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234803AbhG0G3J (ORCPT ); Tue, 27 Jul 2021 02:29:09 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E93C3C061757 for ; Mon, 26 Jul 2021 23:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=PsMZTrHbgtLbWDWD8gKvRloSFoILBL7uSFyFeqlMMSs=; b=DjIp27oY9FO8+U+mIASRDiEDGG m+33IP5Je+fVuYQANpAoO2Wn6AFYrQnUBahfGMZI+pp1dRvVqc9wRUhr7kdnrgnGRQ/z1MWS6Mdte xQqBTWgNHv+ints66VUUVKSwBDUwVt2fb2g0GAdm1Te1bv7PvoVtMxKe487270+zFZ1/Vr6ZnoN4Y syLk1pDxk6k6omIX6VQR6++Nml6Ou4wYkzUhn2+9Xl2E30dadz/gUi9Q+tWT3aFj2VGFMTn4v/hau gEMmgs43juikc0EVGaNuLe0IB6KbctQttPlV8tEMeFtEArU33rkEuNbO/S78MjYmNteC8ji0hu8o4 jhBis44Q==; Received: from [2001:4bb8:184:87c5:b7fb:1299:a9e5:ff56] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8GZM-00EkS3-6c; Tue, 27 Jul 2021 06:28:07 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Abd-Alrhman Masalkhi , linux-block@vger.kernel.org Subject: [PATCH 2/6] block: use the %pg format specifier in printk_all_partitions Date: Tue, 27 Jul 2021 08:25:14 +0200 Message-Id: <20210727062518.122108-3-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210727062518.122108-1-hch@lst.de> References: <20210727062518.122108-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Simplify printing the partition name by using the %pg format specifier that is equivalent to a bdevname call. Signed-off-by: Christoph Hellwig --- block/genhd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index 80ad85822419..e07b1b028875 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -683,7 +683,6 @@ void __init printk_all_partitions(void) while ((dev = class_dev_iter_next(&iter))) { struct gendisk *disk = dev_to_disk(dev); struct block_device *part; - char name_buf[BDEVNAME_SIZE]; char devt_buf[BDEVT_SIZE]; unsigned long idx; @@ -703,11 +702,10 @@ void __init printk_all_partitions(void) xa_for_each(&disk->part_tbl, idx, part) { if (!bdev_nr_sectors(part)) continue; - printk("%s%s %10llu %s %s", + printk("%s%s %10llu %pg %s", bdev_is_partition(part) ? " " : "", bdevt_str(part->bd_dev, devt_buf), - bdev_nr_sectors(part) >> 1, - disk_name(disk, part->bd_partno, name_buf), + bdev_nr_sectors(part) >> 1, part, part->bd_meta_info ? part->bd_meta_info->uuid : ""); if (bdev_is_partition(part)) From patchwork Tue Jul 27 06:25:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12401849 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A70AC4338F for ; Tue, 27 Jul 2021 06:30:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 46A8461103 for ; Tue, 27 Jul 2021 06:30:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234803AbhG0Gag (ORCPT ); Tue, 27 Jul 2021 02:30:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234226AbhG0Gag (ORCPT ); Tue, 27 Jul 2021 02:30:36 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB5B6C061757 for ; Mon, 26 Jul 2021 23:30:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=nDP4xRRzFiKbBiQ6tFnm8G1SA/DaVhM02ciHDiUFtQg=; b=IUSoHgWRgdO7A2XGmedeuQ3N7O Ub4Bkmd/AVIdcp+pZHrMYafSCp50Ubu5deMunQ0VPXJVjpuUEeqW4MICsFqKfObWMuk34aVYHMliM 4tIowaxzArdIn+K+shrPmSTgWaVbzdUtFERl2YM77AcA/R3xF6x9xGAC0itmnYpFHWiasKzooPM5i BYdwHymhwH86Xtopm6liI7/2qRBc1H93cFQ1ZwNVP9F3rJA3wqkyIrNQWVrN+IachJlUn6ytWhiUT frlDHBgJ5jC8A1di2QB5MkTFR/ujjz8cHnnu2sQuqvKg/Aaw0X0lzsvd+w2SP8v7tD6kxZF38bUmP WZqLt0Cw==; Received: from [2001:4bb8:184:87c5:b7fb:1299:a9e5:ff56] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8Ga6-00EkUP-LE; Tue, 27 Jul 2021 06:29:08 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Abd-Alrhman Masalkhi , linux-block@vger.kernel.org Subject: [PATCH 3/6] block: use the %pg format specifier in show_partition Date: Tue, 27 Jul 2021 08:25:15 +0200 Message-Id: <20210727062518.122108-4-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210727062518.122108-1-hch@lst.de> References: <20210727062518.122108-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Simplify printing the partition name by using the %pg format specifier that is equivalent to a bdevname call. Signed-off-by: Christoph Hellwig --- block/genhd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index e07b1b028875..ffdbdefdea7b 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -783,7 +783,6 @@ static int show_partition(struct seq_file *seqf, void *v) struct gendisk *sgp = v; struct block_device *part; unsigned long idx; - char buf[BDEVNAME_SIZE]; /* Don't show non-partitionable removeable devices or empty devices */ if (!get_capacity(sgp) || (!disk_max_parts(sgp) && @@ -796,10 +795,9 @@ static int show_partition(struct seq_file *seqf, void *v) xa_for_each(&sgp->part_tbl, idx, part) { if (!bdev_nr_sectors(part)) continue; - seq_printf(seqf, "%4d %7d %10llu %s\n", + seq_printf(seqf, "%4d %7d %10llu %pg\n", MAJOR(part->bd_dev), MINOR(part->bd_dev), - bdev_nr_sectors(part) >> 1, - disk_name(sgp, part->bd_partno, buf)); + bdev_nr_sectors(part) >> 1, part); } rcu_read_unlock(); return 0; From patchwork Tue Jul 27 06:25:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12401851 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B430C4320A for ; Tue, 27 Jul 2021 06:31:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2F4FA61131 for ; Tue, 27 Jul 2021 06:31:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235629AbhG0Gbe (ORCPT ); Tue, 27 Jul 2021 02:31:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234803AbhG0Gbe (ORCPT ); Tue, 27 Jul 2021 02:31:34 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83609C061757 for ; Mon, 26 Jul 2021 23:31:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=zgLN6u1pQT5+6UVRmgiDaj/l2aWdVOEfD6Q37eZi1Ac=; b=cxS7BszZooweuLeiHdtEHQRL5/ yVgvdu//Nj3c1LndMdS2mMFgECL9th7se+rieTsKdFdfJPgJ4wFg9ta2Wm/E5ZvDxJ/pdO1CUDVoz YAvoO48HlN7L1mYRxpe2UxpyA6IznfelOCNMzfX4ScZUojQ+1dloy9RZ6yCcasvF4ZOhWkeYkcctb r2LLxi5R1M8Bm/Lz1EkZC/JjNgkqUFdtN39oWpnFBJPe8iPVx95qXUSxa7gHaNuEPiDVRzW/UWDrK ltm0CrzXgET/UexxNa33srbSvk9gdW3uiiAg9Ofy43JHAErAenNvYgLDOh59YF3j9mmLYE7yPBQ/u /EtBdBDA==; Received: from [2001:4bb8:184:87c5:b7fb:1299:a9e5:ff56] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8Gbc-00EkXR-BZ; Tue, 27 Jul 2021 06:30:35 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Abd-Alrhman Masalkhi , linux-block@vger.kernel.org Subject: [PATCH 4/6] block: simplify printing the device names disk_stack_limits Date: Tue, 27 Jul 2021 08:25:16 +0200 Message-Id: <20210727062518.122108-5-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210727062518.122108-1-hch@lst.de> References: <20210727062518.122108-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Printk ->disk_name directly for the disk and use the %pg format specifier for the block device, which is equivalent to a bdevname call. Signed-off-by: Christoph Hellwig --- block/blk-settings.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/block/blk-settings.c b/block/blk-settings.c index 902c40d67120..109012719aa0 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -661,15 +661,9 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, struct request_queue *t = disk->queue; if (blk_stack_limits(&t->limits, &bdev_get_queue(bdev)->limits, - get_start_sect(bdev) + (offset >> 9)) < 0) { - char top[BDEVNAME_SIZE], bottom[BDEVNAME_SIZE]; - - disk_name(disk, 0, top); - bdevname(bdev, bottom); - - printk(KERN_NOTICE "%s: Warning: Device %s is misaligned\n", - top, bottom); - } + get_start_sect(bdev) + (offset >> 9)) < 0) + pr_notice("%s: Warning: Device %pg is misaligned\n", + disk->disk_name, bdev); blk_queue_update_readahead(disk->queue); } From patchwork Tue Jul 27 06:25:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12401853 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18583C4338F for ; Tue, 27 Jul 2021 06:33:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EFE3A61108 for ; Tue, 27 Jul 2021 06:33:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235230AbhG0GdB (ORCPT ); Tue, 27 Jul 2021 02:33:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234803AbhG0GdA (ORCPT ); Tue, 27 Jul 2021 02:33:00 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45015C061757 for ; Mon, 26 Jul 2021 23:33:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=FXdF4EZSXmVp/dLgSh7XkFHoxuX06wGclM8vJvZxtes=; b=UF4ZgyT3Ishk05ITHot+AlXACZ SRWaqflj0RI7zkWLtVxYPpGi88Ol7VEEhdU17nqy4sgYTlu0tA29pw9c3oddqVzqjyzzVX+iZc6/X io1oOkOQAulE6dLvesZ9SVXnB0LhAZXTbDDz8uXps7SM+cH9bh/sv46SV7mjtrErYx63gvfXAaTCV 1TqUMdQadTgsM6wOT/j6EGu7NuLJs1hAOWDWcjeyDglD35VtqHHgPOtPNnr7G4fg2dvffXUNwSYJC vb8F8IfEr72O9We5t/6ZepOYrYUYtzlaaiYvx6Vk8ZGGEhuxTZHcFBqWyhYw8XnfLV5wBmY6+NNv1 EYC07jKg==; Received: from [2001:4bb8:184:87c5:b7fb:1299:a9e5:ff56] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8GcU-00EkZP-MU; Tue, 27 Jul 2021 06:31:33 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Abd-Alrhman Masalkhi , linux-block@vger.kernel.org Subject: [PATCH 5/6] block: simplify disk name formatting in check_partition Date: Tue, 27 Jul 2021 08:25:17 +0200 Message-Id: <20210727062518.122108-6-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210727062518.122108-1-hch@lst.de> References: <20210727062518.122108-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org disk_name for partition 0 just copies out the disk_name field. Replace the call to disk_name with a %s format specifier. Signed-off-by: Christoph Hellwig --- block/partitions/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/partitions/core.c b/block/partitions/core.c index 4230d4f71879..48e001aa1930 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -136,7 +136,7 @@ static struct parsed_partitions *check_partition(struct gendisk *hd) state->pp_buf[0] = '\0'; state->bdev = hd->part0; - disk_name(hd, 0, state->name); + snprintf(state->name, BDEVNAME_SIZE, "%s", hd->disk_name); snprintf(state->pp_buf, PAGE_SIZE, " %s:", state->name); if (isdigit(state->name[strlen(state->name)-1])) sprintf(state->name, "p"); From patchwork Tue Jul 27 06:25:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12401855 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA003C4338F for ; Tue, 27 Jul 2021 06:34:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F12C60F44 for ; Tue, 27 Jul 2021 06:34:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234803AbhG0GeT (ORCPT ); Tue, 27 Jul 2021 02:34:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234226AbhG0GeS (ORCPT ); Tue, 27 Jul 2021 02:34:18 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82120C061757 for ; Mon, 26 Jul 2021 23:34:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=HB7rNV45IS9PO1uEkgO0reCsc2KGPQDSQYd5O6nEhuM=; b=Z+ZXmvSzAWaiAOl0x6sf6njw0s XmR7mACAZzCgspFdtzg6qNUZChKiw3M2ct423pzsSRrDaBcGS94GUo/FtIa5TXQiwGOMUevNr0MNe Q3Kj+ONTICF/y8QBNhJobzk2AFUHNXa8TKv8BM0n4j1SW/M4djYFemI+OzedhnfMCwOvt/+vL3QlY YpxlmdntcMrm62yHJhKa0w0Pw9AH+SANRuEpm1/OrZuIzUfzXaP+WuBvPnpOmlxhc+G9C4SZmF07z 6oCKuwi4Y1qahLn2AV/OmCQwk0O/wNSC7hXeaf9IDbJeITKPveP/KwFmI/7NfJWVGF2TZE93QHl32 /qTOYtgw==; Received: from [2001:4bb8:184:87c5:b7fb:1299:a9e5:ff56] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8Gdn-00EkdE-3O; Tue, 27 Jul 2021 06:32:59 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Abd-Alrhman Masalkhi , linux-block@vger.kernel.org Subject: [PATCH 6/6] block: remove disk_name() Date: Tue, 27 Jul 2021 08:25:18 +0200 Message-Id: <20210727062518.122108-7-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210727062518.122108-1-hch@lst.de> References: <20210727062518.122108-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Remove the disk_name function now that all users are gone. Signed-off-by: Christoph Hellwig --- block/blk.h | 1 - block/genhd.c | 17 +++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/block/blk.h b/block/blk.h index 4b885c0f6708..56f33fbcde59 100644 --- a/block/blk.h +++ b/block/blk.h @@ -344,7 +344,6 @@ static inline void blk_queue_clear_zone_settings(struct request_queue *q) {} int blk_alloc_ext_minor(void); void blk_free_ext_minor(unsigned int minor); -char *disk_name(struct gendisk *hd, int partno, char *buf); #define ADDPART_FLAG_NONE 0 #define ADDPART_FLAG_RAID 1 #define ADDPART_FLAG_WHOLEDISK 2 diff --git a/block/genhd.c b/block/genhd.c index ffdbdefdea7b..966e32fecfa4 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -78,11 +78,17 @@ bool set_capacity_and_notify(struct gendisk *disk, sector_t size) EXPORT_SYMBOL_GPL(set_capacity_and_notify); /* - * Format the device name of the indicated disk into the supplied buffer and - * return a pointer to that same buffer for convenience. + * Format the device name of the indicated block device into the supplied buffer + * and return a pointer to that same buffer for convenience. + * + * Note: do not use this in new code, use the %pg specifier to sprintf and + * printk insted. */ -char *disk_name(struct gendisk *hd, int partno, char *buf) +const char *bdevname(struct block_device *bdev, char *buf) { + struct gendisk *hd = bdev->bd_disk; + int partno = bdev->bd_partno; + if (!partno) snprintf(buf, BDEVNAME_SIZE, "%s", hd->disk_name); else if (isdigit(hd->disk_name[strlen(hd->disk_name)-1])) @@ -92,11 +98,6 @@ char *disk_name(struct gendisk *hd, int partno, char *buf) return buf; } - -const char *bdevname(struct block_device *bdev, char *buf) -{ - return disk_name(bdev->bd_disk, bdev->bd_partno, buf); -} EXPORT_SYMBOL(bdevname); static void part_stat_read_all(struct block_device *part,