Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp361852pxb; Tue, 12 Apr 2022 03:47:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYlJo7qhKjhmzt7YULLHL8oY967pZe39zB8nx+a9pe7XsmtSDCIovj2+Ay075xTxefjKG/ X-Received: by 2002:a05:6a00:1caa:b0:505:ca7f:908c with SMTP id y42-20020a056a001caa00b00505ca7f908cmr8017025pfw.71.1649760426116; Tue, 12 Apr 2022 03:47:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649760426; cv=none; d=google.com; s=arc-20160816; b=zZW6ICvV184WC9Z760Ib9DrOi0JB5CY3OEwpDKbo5mn4aU8bBTnT7kjB9uggr6dcGN +nbMgAQi6qpljFMKyu51YmBnAkHTAnp4WXv9p6Kt2fn+5RVHh/PryQFqQRjKu7hZ7cQ5 u2O7ALL0DEgxWdYWCzmoXgjdyAB1pIiVRGzTGZmBAEfqAw8GxDiIEkPRVqBo6O1R3bMG +udxrRb8u81p2Gf/1D/d6rsdmsgvLnZnwuDHuSBUnjr9qGrfkgO2eg2M/riR3/wD8PlR 6DbYbV1DfwcjYxJoqkHSLZEqYh6gbUrjWoyAJXWRX9jyHX/PIm6tSDXTrN6zBW87+TIf B0cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=q2ranmlO4Nl6vweHnkN5W/lhAXFqjXPKY6W4cI6bGNw=; b=VC7XVDzMQYK4iiWk8lXJEDC5Tp4g8wUNmNiVTSckOEAo+DS0kE3ui7aru17qe43t4h Stl55nJ+UFUk3yF+Bjl8tlootGjGedhyl8rtELXzYPk0eyE0f4ODjYOrBycr6+5JzUIz 6vbRSkeFMiTwLjwuvxh/Ybou6gSBmJYjG930MbzbevdZBXrHu2kioCN7VO/g7ofzuAf6 0E6cpv9YPVLChzkMIp1MI4OVmr0U40u0hbgJPOM9xueXFHjkHC7mSO6WRB8UBY30UWHy gLJG1H1CQM7kz+G626fDoFVGky2UZyT37F16n/mhTflQMeYSTwvAj6cxVcaTGs8zIp5z H5oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=ZwXWqq27; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 8-20020a630e48000000b00397f965a779si2315484pgo.128.2022.04.12.03.46.38; Tue, 12 Apr 2022 03:47:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=ZwXWqq27; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241271AbiDIEzf (ORCPT + 99 others); Sat, 9 Apr 2022 00:55:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241123AbiDIEyi (ORCPT ); Sat, 9 Apr 2022 00:54:38 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24BAABAB84; Fri, 8 Apr 2022 21:51:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=q2ranmlO4Nl6vweHnkN5W/lhAXFqjXPKY6W4cI6bGNw=; b=ZwXWqq27tMeyVdjCd9/fIV+62b YxoMIWLS5QBW9+N570g/a7MqnPHccUJQp/73S/ehTJ9VEsGu0nZXpLT2GsIb95dlGJnKSkFIT7WNJ Q2sY9of4Z8TkC7fc/FklkIOgdhls0Ao3F7MloWBwUhbTcUSp/MjOHIau/ybVaMror8iobGwcOp0AA +a4GNDWpu5gRhJyLqGbdZW5DNs6lIAJYj08W7f1olcpdRSmv2+7GaRf1xJ5QApQRYFU40mFosdlZy 0ALRAEA3rIIwBWnBlj8QEgYL1eIM3It3IcCM+Tc/eC3LmnRLah4kAgVmx2WJTHuXLjilmSIpHNWrZ 1FnhvyJg==; Received: from 213-147-167-116.nat.highway.webapn.at ([213.147.167.116] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nd34b-0021Bd-D3; Sat, 09 Apr 2022 04:51:45 +0000 From: Christoph Hellwig To: Jens Axboe Cc: dm-devel@redhat.com, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-um@lists.infradead.org, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, nbd@other.debian.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, jfs-discussion@lists.sourceforge.net, linux-nilfs@vger.kernel.org, ntfs3@lists.linux.dev, ocfs2-devel@oss.oracle.com, linux-mm@kvack.org, "Martin K . Petersen" Subject: [PATCH 17/27] block: use bdev_alignment_offset in disk_alignment_offset_show Date: Sat, 9 Apr 2022 06:50:33 +0200 Message-Id: <20220409045043.23593-18-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org This does the same as the open coded variant except for an extra branch, and allows to remove queue_alignment_offset entirely. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- block/genhd.c | 2 +- include/linux/blkdev.h | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index b8b6759d670f0..712031ce19070 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -1010,7 +1010,7 @@ static ssize_t disk_alignment_offset_show(struct device *dev, { struct gendisk *disk = dev_to_disk(dev); - return sprintf(buf, "%d\n", queue_alignment_offset(disk->queue)); + return sprintf(buf, "%d\n", bdev_alignment_offset(disk->part0)); } static ssize_t disk_discard_alignment_show(struct device *dev, diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index f8c50b77543eb..d5346e72e3645 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1251,14 +1251,6 @@ bdev_zone_write_granularity(struct block_device *bdev) return queue_zone_write_granularity(bdev_get_queue(bdev)); } -static inline int queue_alignment_offset(const struct request_queue *q) -{ - if (q->limits.misaligned) - return -1; - - return q->limits.alignment_offset; -} - static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t sector) { unsigned int granularity = max(lim->physical_block_size, lim->io_min); -- 2.30.2