From patchwork Fri Apr 15 04:52:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12814505 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc250.phx1.oracleemaildelivery.com (aib29ajc250.phx1.oracleemaildelivery.com [192.29.103.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 828A0C35294 for ; Fri, 15 Apr 2022 04:54:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=l3eRycLdb8Qxjhf4nyEhZkv6G/ZZnFNKh8bLPDONSAw=; b=OFymqJv4RmZfKGMkqtqkf+gXzgqgtOajW3lhidxACx5jttzInFtOl6hLjgxrLsu+oCZElXMYwf9u yfgJrpnP7Z7CXWJ7sjgispWF59oLDSQWe5sK54H9NpVzBh7zx6zuVBHBQzipIVGUUKrPZh+VnjH5 HbrM2ku3cOMKF5UqxEohmkNEww6R48aLHrykzNkei3z4zOVFl8reJWhqAQ5fKnsIOSqPxuXTptlL l8ZO3ihcNZSBZ9XOAzuxpKFfbUBjdE9xp7G4YiTMajLV1Oojzhu72j+Fj7GVtRcKidSHKCEe9Bsr 8Bp7vrKtLlHMbfkIqdkbcRr2AaKUw+Cwt5MXfw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=l3eRycLdb8Qxjhf4nyEhZkv6G/ZZnFNKh8bLPDONSAw=; b=pACbS2HyCf3VIoUxxZncy5tH8K3BK0fwq8BS0W/5NPUNrVKDQuAAmCzp1SKdRsIgTc1iPALo7hiG tx/xSvS3lp66t/JglFZBetaksVHVDcftrM5nKB0tz1T9uFpV6mnBwuwI6HdHoPUkLj9HECyYlYCY gJsP72p2PD9VATnaRHXO+G5mC4gigPTNmq9A8+OM0UWGNHd4iy/AdAnWnc6BuUO9uLfsfPllPzF5 z51JHyo+OBgVTvtZC6/HpwDYh/b+qe0YSQR+nBMTuspXBsey64QFGZzed86dAj+QBqFgVBwP9rIp oIlFfWm5drHRLjc5CVbfdZnccYl2XsPE5zaNGQ== Received: by omta-ad2-fd3-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RAD002HS6YTH560@omta-ad2-fd3-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Fri, 15 Apr 2022 04:54:29 +0000 (GMT) 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=UUS6y6SVPRCfJmQVPGCeD5o714qtaTT6EGogPxQdIy8=; b=x5agUVGSt4qUPiArfFruXQZEkh ED5eIR3aSkNtXX7nLmypr4HghgJKhQCB8SBb7JsEb44bJsx67U0AujP5aBa1btb0b+S+xGwgwPD/7 RRQm+W0tVsP/DSqW5U9c8tVIT1qiiaD3HIowj1Lt7t2v4nBRlePLOFKu6cvzlYV9ePp50Bne//9CJ umsrwM4RvhODoSk65phqK4ewBHRrL/nBunRhsHvf5+9CdNnqhx6U7RpMnn5jES/jOpBFGw0/3/808 G3CmRXGpdyxJMHizR5B5MMLpxywFyHZzcVohmA18ECgaE440XvejvcNkIHffvwRVbT/cfUPwhLobO l5t6lMLg==; To: Jens Axboe Date: Fri, 15 Apr 2022 06:52:32 +0200 Message-id: <20220415045258.199825-2-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220415045258.199825-1-hch@lst.de> References: <20220415045258.199825-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10317 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 impostorscore=0 lowpriorityscore=0 phishscore=0 priorityscore=30 adultscore=0 mlxlogscore=999 bulkscore=0 clxscore=309 malwarescore=0 mlxscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204150029 Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 01/27] target: remove an incorrect unmap zeroes data deduction X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christoph Hellwig via Ocfs2-devel Reply-to: Christoph Hellwig Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-ServerName: bombadil.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-GUID: KRcMcrl6RDGm5knN30wUQWMl8JkuC8h5 X-Proofpoint-ORIG-GUID: KRcMcrl6RDGm5knN30wUQWMl8JkuC8h5 Reporting-Meta: AAEk9FVDjjSIsrc7zH2XlbISVzpVlvpMiUg4YAHGQwqh+autGSz3FSUx7EJm+Oft 2gi4WDLAE8NdAGu4YOLCiTAXlflb298XZCPLJgFum7nhM1+PxBU0zT/v8rliqyI6 P5ZVcSLZrR3vzfM/u74/ETNXMaol23nKI4l3yK2ykL+F/PlbwjDX1MRfvMRCcpP0 mMv/EkAvWZP3uBjld25uY9nMYCdYh3KmlZijr2giLMNqNYv06bjREkr9HbNYxQNY dNo13/XDWRUmvMy5K73ww80wuYza2nlU89fc5Ta4l4GLYcxl34i710n7b+LU8IQh 8oh7nErTsnu+driDq0KPgHanmO9AlqE8ne4UyiGNqXarQKXv/McpNvIVO4Od/0H1 0grIrwvT4eIZCI6QBgSN6XJQI4NB8WwFcqudk1tUARivEsqbSUEoTFCnmfpkQ4ZO vqMnORQFk7GHKLYPGbzIxapknABBn5OueCIfWgdIP3O1x3StPITyss4L6AyRPYEO UeFpE+5pvMTFF4PFHpFNQpMeucbtGTLCEno7cXpe0lxVgQ== For block devices, the SCSI target drivers implements UNMAP as calls to blkdev_issue_discard, which does not guarantee zeroing just because Write Zeroes is supported. Note that this does not affect the file backed path which uses fallocate to punch holes. Fixes: 2237498f0b5c ("target/iblock: Convert WRITE_SAME to blkdev_issue_zeroout") Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- drivers/target/target_core_device.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 44bb380e7390c..fa866acef5bb2 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -850,7 +850,6 @@ bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib, attrib->unmap_granularity = q->limits.discard_granularity / block_size; attrib->unmap_granularity_alignment = q->limits.discard_alignment / block_size; - attrib->unmap_zeroes_data = !!(q->limits.max_write_zeroes_sectors); return true; } EXPORT_SYMBOL(target_configure_unmap_from_queue); From patchwork Fri Apr 15 04:52:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12814509 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc254.phx1.oracleemaildelivery.com (aib29ajc254.phx1.oracleemaildelivery.com [192.29.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9F407C43217 for ; Fri, 15 Apr 2022 04:54:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=CYOKr4BuEDIgu6mtOpngSR+y44eWhkvjqAA79C4jwRo=; b=vPDNjs/GfF6dz2bR8Pnb562h05HPUyzN0bpexdP8gXjh/fABFmcDweadg0EFmckIeQ7hIAnCNlZ3 8JrSRKOuKvekjE/GmoyrNPJwsGqy+3URMgwcYDrrzt98uPKhbSpC6uQtwrU5qwV7NkbAl/yRnYbQ opBE1fiv0108ZxWlL05+WeH55ySotJhTyjPu390vl9t3gmycBRKz264aoggAZ0fGmujW2w7dEsbN H9pIOnEIcQn+ox3FYTLq3U7OBCxTfhxBTNrImcnZOB6wZn+Kdz2MYf7IeDhVb6teoA9643X4rnw4 DEhE4EB3f1H51Ix0DwyzsSiBuDAZrCpJ9M3LAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=CYOKr4BuEDIgu6mtOpngSR+y44eWhkvjqAA79C4jwRo=; b=mM/ZrM+Y0can5TFwV65vUp35GMrPcB5K+HOGk/EKABO6Y6se45FlzID+0xu/8J2Br95Znf7pGvlv Gf6sAqIqZrVVU52sglpsOleDJyKJ4VOnllUpg/+R5iHna0MuwOALlENUwr1I9QtiFhNAkNvK5NjK bQCG6lO0HLhVEQBTGI75Od07/zisphYNfFNv/zdCLwi/+ipPCAOm1uysALd+j70pGWi9HunmhBzG Te9uBaFPUPmHM7C9sjaU563ouSBfJAyXaIN6F+F0Ij6UFBHYvZz2MB88433CzeLDl8LBkQQEQrFO 9Dt8ANqhgSrW23gFCDvIT8GOVFqE/ppwDOwrAw== Received: by omta-ad3-fd3-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RAD00MA46Z2GK40@omta-ad3-fd3-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Fri, 15 Apr 2022 04:54:38 +0000 (GMT) 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=6JVZQz23Gg3oLV4oYc05UwmOH+nGeMd1Qpin5+I9KgM=; b=p4/UQY65J530pBrFxSnyzz+s1S 20vQFpTrN15G6NO5F9VDuyGriDpCNyWjbyKgPkMSrLLko0Q4FtJ1eCzi+YOgwapAyJib+3l/z0nqL +NYMVQXNHIEHx4U8dz9u48TnCqPcYXyNXVQmQKYJgAexB2zuX97VLPbrU2HmJIKE7g1fg+Kmpeu2X 7In2j9JZDuGthZuxusAdOOuAjghMTjSwC/AdUlo5SnfFd1vgrm4uEPQ78/HVr7y9+RCydI3REXKPH s1r/AwsdOouUPRQPQY3Kuv+Zv/88cYk9RfHpmYADsU3re53XPeDNlC3OFKsZfaMhZuxBpfzjqoDMO ifzKUlSQ==; To: Jens Axboe Date: Fri, 15 Apr 2022 06:52:33 +0200 Message-id: <20220415045258.199825-3-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220415045258.199825-1-hch@lst.de> References: <20220415045258.199825-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 127.0.0.1 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10317 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 clxscore=248 mlxlogscore=999 impostorscore=0 priorityscore=95 mlxscore=0 adultscore=0 bulkscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204150029 Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 02/27] target: pass a block_device to target_configure_unmap_from_queue X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christoph Hellwig via Ocfs2-devel Reply-to: Christoph Hellwig Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-ServerName: localhost X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: RudrZSvd7p2HmTg-Qot04R30lmq7EswK X-Proofpoint-GUID: RudrZSvd7p2HmTg-Qot04R30lmq7EswK Reporting-Meta: AAGszEMYCAXZJZGdNiJaZM7w2FwKscQaK4SVrGzgNYbfxolmO/AXDp8MAswptKh4 EUxxdw4H3K6p60XZV41kQqarTsJ40BgX0WQHRoVKDmZ0iYU5BA6aszReEsF9InHg XdiXqt8rIdPn0yAbZk45W7R5WrCBC47d9TzTRXs+U8xs51aV704R0sG6Mc5+GDZu 4B8JhZAzl7Yc8fGf1Ez9BTOsHZgUgAFNkqp4kyFTMe/BcO1m8jT1eOpv/j7azdYm tU8dWflOc6iYj2CIfnCjWKaHGou+2WWAze3VfBV24kxgfRVsIJ2jgrQwIo9NWS1n v2sMG+VRJL/zRwX7CzpoHirHDuEMaYvLpO7qmOD9uM5mbnuFa6VGG4tvtw0kecqL vAxwuqs06MmmNT10pkLL8mu6F98lsRN4hxJieNXjdaZoZ++qOj2JYT14heLg94o9 +zgJPr1y7DJQsCv9QTq3FyJY4G3llVke3Fm0xDiAsWAhAqhYvaTbDuq2/vS27ZoC oEvGC0yRf1bnuBuCNTbZeY04q6cBl6Uzi+4hlRUTYIvMhA== The SCSI target drivers is a consumer of the block layer and shoul d generally work on struct block_device. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- drivers/target/target_core_device.c | 5 +++-- drivers/target/target_core_file.c | 7 ++++--- drivers/target/target_core_iblock.c | 2 +- include/target/target_core_backend.h | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index fa866acef5bb2..3a1ec705cd80b 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -834,9 +834,10 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name) * in ATA and we need to set TPE=1 */ bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib, - struct request_queue *q) + struct block_device *bdev) { - int block_size = queue_logical_block_size(q); + struct request_queue *q = bdev_get_queue(bdev); + int block_size = bdev_logical_block_size(bdev); if (!blk_queue_discard(q)) return false; diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index 8190b840065f3..8d191fdc33217 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c @@ -134,10 +134,11 @@ static int fd_configure_device(struct se_device *dev) */ inode = file->f_mapping->host; if (S_ISBLK(inode->i_mode)) { - struct request_queue *q = bdev_get_queue(I_BDEV(inode)); + struct block_device *bdev = I_BDEV(inode); + struct request_queue *q = bdev_get_queue(bdev); unsigned long long dev_size; - fd_dev->fd_block_size = bdev_logical_block_size(I_BDEV(inode)); + fd_dev->fd_block_size = bdev_logical_block_size(bdev); /* * Determine the number of bytes from i_size_read() minus * one (1) logical sector from underlying struct block_device @@ -150,7 +151,7 @@ static int fd_configure_device(struct se_device *dev) dev_size, div_u64(dev_size, fd_dev->fd_block_size), fd_dev->fd_block_size); - if (target_configure_unmap_from_queue(&dev->dev_attrib, q)) + if (target_configure_unmap_from_queue(&dev->dev_attrib, bdev)) pr_debug("IFILE: BLOCK Discard support available," " disabled by default\n"); /* diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 87ede165ddba4..b886ce1770bfd 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -119,7 +119,7 @@ static int iblock_configure_device(struct se_device *dev) dev->dev_attrib.hw_max_sectors = queue_max_hw_sectors(q); dev->dev_attrib.hw_queue_depth = q->nr_requests; - if (target_configure_unmap_from_queue(&dev->dev_attrib, q)) + if (target_configure_unmap_from_queue(&dev->dev_attrib, bd)) pr_debug("IBLOCK: BLOCK Discard support available," " disabled by default\n"); diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h index 675f3a1fe6139..773963a1e0b53 100644 --- a/include/target/target_core_backend.h +++ b/include/target/target_core_backend.h @@ -14,7 +14,7 @@ #define TRANSPORT_FLAG_PASSTHROUGH_ALUA 0x2 #define TRANSPORT_FLAG_PASSTHROUGH_PGR 0x4 -struct request_queue; +struct block_device; struct scatterlist; struct target_backend_ops { @@ -117,7 +117,7 @@ sense_reason_t passthrough_parse_cdb(struct se_cmd *cmd, bool target_sense_desc_format(struct se_device *dev); sector_t target_to_linux_sector(struct se_device *dev, sector_t lb); bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib, - struct request_queue *q); + struct block_device *bdev); static inline bool target_dev_configured(struct se_device *se_dev) { From patchwork Fri Apr 15 04:52:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12814501 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc250.phx1.oracleemaildelivery.com (aib29ajc250.phx1.oracleemaildelivery.com [192.29.103.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 416E0C433F5 for ; Fri, 15 Apr 2022 04:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=b/Mu/tNkTvj83TzTpjVfeJwQdLdU1evL2qba9H6BTTg=; b=Fcb+EhhvfETkpP1pLXKXFW5gn8EuJzcfxhI7eU3av9G/ZhBGNv5rnOEsiTBb8JuA9ZitJWxApt/8 qvEAXlZmrIaPYJD4kHLuRxleOs0Hy9k6s0cyLVIBTkcRsRd91Q/5LkCnLa6Fm5Dnh+uPBQCu11a7 pM2m1blMNeYGOE6DgVgM3T+zOwF+5HtBr/y7ZFTDGT4EjJTUqO2UcrIIwbtWGhY3404bClTR9ld0 2TxmVL399U99UrbY9y0SnFigldR1fhTcAf6C5YBeFGOPqv+uW7wgY5yHyyYUo8/0ncHedBa6oWPb jPWBvV0UUPnEjVxGumNHRtEOUkUs0dnZnR8dxw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=b/Mu/tNkTvj83TzTpjVfeJwQdLdU1evL2qba9H6BTTg=; b=Szm7BV+SFvARzm5M2d7TAZ1xRrJuvjPAiEAn842DCnDFHq3UIYFt61ba4PCObqmeqBflXY6LBLev fyuztFbMFL6ev68x5bd8cJ7wRqtBexrPAPlpBStcHphG7oGVD8RSi/g7iMf9GIIWvXQB51EHrdGA oqi9Qk37Oo4jC+kEVNxXTi5/bBgyKo7B+l4nrfqGKY53vpXI6HsqK2epPSXSxsjufhHuv+cq7lni FOchWe0sl0NG9OzjuBgWycOrDCN1u2a02/hRQIbwmlWYzLPam7S+Xjie+1znUiFQPAHfQXVN8cux p/QoWnPoi6FfjNo3fFcG/L6SBUYZcrWYY3i6TQ== Received: by omta-ad2-fd3-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RAD002G06YQH560@omta-ad2-fd3-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Fri, 15 Apr 2022 04:54:26 +0000 (GMT) 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=OTIsP1OizukmDhxFkiULvJk6rKtH8rZ66Toc2zFZ06c=; b=ooMRjv2JAUzFUPyfh+XZqWb8QW Q9pjLNLNX62Z8C2MtoU6HU3VpVt4OAZRBuYSsD6pXMOi8ZjLOdl54eYy3Tp24LGUVsHa2hBE7Y0RM gDKNIKXjx2hbqJA1iCpB6nzk3wFq7ScIOiguPmNGaxWjNFoSpuysiesbbWxhRLyGcBXCzqkMTGuuD XDeeqdLlxhy91bRF+ZdOWJypNUbEcjrD8gjGqtH4BhZffx0JY9uZOYdBApIPmQ3bzD93iVI7xEHYb JNb40WmRbrFCmN1/+6dAisHF7eHMEiTWRFZXLfqhSoZ7Cj20tDlAxwUfcT/Ob7kj6Vu7zsHN8pcpE pX9GukFg==; To: Jens Axboe Date: Fri, 15 Apr 2022 06:52:34 +0200 Message-id: <20220415045258.199825-4-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220415045258.199825-1-hch@lst.de> References: <20220415045258.199825-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 127.0.0.1 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10317 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 priorityscore=0 mlxscore=0 malwarescore=0 mlxlogscore=988 bulkscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 clxscore=255 adultscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204150029 Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 03/27] target: fix discard alignment on partitions X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christoph Hellwig via Ocfs2-devel Reply-to: Christoph Hellwig Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-ServerName: localhost X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-GUID: 53IWFdBMB1fqaQ0yZMOH801yyA-i_9Q1 X-Proofpoint-ORIG-GUID: 53IWFdBMB1fqaQ0yZMOH801yyA-i_9Q1 Reporting-Meta: AAFVwXbrvTSIMrb9wQhpXkx7pmcZzkQMcdM566gAyIV+lXOjWPXzjKKBvDIHG+Ae 3v4CvJGGEgv7iOaBhZfmN33E+BdoAg04ESR09yBtFiHs0bUf6HhNdBLq6wHdl1PP IuKi/FvPICC5TjtWfKL55J5vsQnL8HVAJTXwNXKgOB54xKCZfnGR9CJ2lnfVGQeP GWonj9ad568tKOKGD0EK0TWKL9KthOERBId6GxDVdHDh9KEDSpouM8xQIO2ZPx4I Lapxxz3ghDo6ojNVSnnPttDpuea4viHvVMzSJy4rVByA7KJd//89nc5fUHdL9Ks0 f9wWKIGi+z0V8rAZyd5PT8OV2DjB5G+FB9mkkFRusBC6eEgr85N5/dACuMq/4cV3 memel1y0tP4kMp0G3zJ0oJvPsDxXY9HwJyfXeLCttumWlQAx6B/9ywChNnOvinG5 olp658tjpCPc1M/kFu+gLXk3Z6wEL9SY/M1FcplrEbuTIHC48AO/aY4/SFDHR5in 0Fguv/WFXaRB0xiNX2v5FVdhocNO7jmXFQRdJsBweKgpAg== Use the proper bdev_discard_alignment helper that accounts for partition offsets. Fixes: c66ac9db8d4a ("[SCSI] target: Add LIO target core v4.0.0-rc6") Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- drivers/target/target_core_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 3a1ec705cd80b..16e775bcf4a7c 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -849,8 +849,8 @@ bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib, */ attrib->max_unmap_block_desc_count = 1; attrib->unmap_granularity = q->limits.discard_granularity / block_size; - attrib->unmap_granularity_alignment = q->limits.discard_alignment / - block_size; + attrib->unmap_granularity_alignment = + bdev_discard_alignment(bdev) / block_size; return true; } EXPORT_SYMBOL(target_configure_unmap_from_queue); From patchwork Fri Apr 15 04:52:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12814503 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc248.phx1.oracleemaildelivery.com (aib29ajc248.phx1.oracleemaildelivery.com [192.29.103.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7F55AC43219 for ; Fri, 15 Apr 2022 04:54:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=9aFNLPpHQPJMK4gUBYGABn0jc4VVctpHVtKjtyXjbfQ=; b=vai+WrpEUuHoc9VQlSNoDrcdYFRKR11wMHF4JhF+carewrH07RmchmBQdJ2KpOwDkmoQwEH0mF5g LQ1LF82t6zRCFCGwDxorMdrptBJv1loLrY4frnZT07cYUDTHUw+3sS4vMyiaXarwiRkOPvxeoQO4 5sdYYhJ3LVbOqkafJDg20QXHOC669lkBYq16zX67rlbmmM1PUBjvWYfofe4c09EMGN/qXIPEKw5T +Uf+QEO+z4l55mPs3b3pMnSwEqT2F4TdpTwS1XG3NPkiJ82HaPvlWZ6jf9QR273GZ/TE/GGALL1g zott9YpH4xiSJxu4S2NP2cBAcUjKYSt9DDOsDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=9aFNLPpHQPJMK4gUBYGABn0jc4VVctpHVtKjtyXjbfQ=; b=VVlf8MBjwyalPYSOpoiClNUeXSNLVCJ1QOucz5SvfyJi/qaJmxX0LpZkEVfC/c+StjIalkpAjx4q AGj5sFGIVNRorr/T6EKJbnvhHu3JGPwamoeVItc3piXXLniE8y8YzgbF+QXHJpO7K3Z8+4H4YJLG bjrMEU9izQZd8Qv7en5wnsbosE+rw6EPrOX6l3VqDVkv2d7QoaO1ZzJjDMORADwEoDUNh2molT72 dvAHuKeoqV0nUKaJ9naKAyFZbcem+UXgJ+bhi7lqrwf2HFRzl+N0X2D+MpCS1SMYa7rBHKJRIqDZ VgtiE+BJH4aR7etfEQ/yM2ImYEk5Fh89oaah0w== Received: by omta-ad2-fd1-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RAD003EK6YR2JF0@omta-ad2-fd1-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Fri, 15 Apr 2022 04:54:27 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=be5XRqr6FpD/xPCRROQj1WW79ZNoTG4VrTyORPZGjVE=; b=zfdoWKjLNg8/93VMXMR/8dmem+ WdvS+5iIu6uir1zneoGsW/PVn5k5msDFRP3cNUjzgk48HwXHEWdbPPQegdyt6x56ivnd6KhVFEdRn raW2CONj2YH3bKud1GU1IPcR9v/j6pw0pUmG9drywqIdz4cTw9frqxiK8uJ0qudjT7ff4EmR2zNpd iXKlU7IflKK7BZ1vMlEvBpbCIpEVLMDJnliSIXYAubrng3TWL7OH99pGfDALzISzxUUJefgBXG3V5 WlBB+jh7r7m3TcfVeysrxVV3wHeAvYOUUoaQFeOXr6OBj0iU6tL7PMj+sYlQjUaSSJXCl4UqBVXnS NdWcSxoQ==; To: Jens Axboe Date: Fri, 15 Apr 2022 06:52:35 +0200 Message-id: <20220415045258.199825-5-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220415045258.199825-1-hch@lst.de> References: <20220415045258.199825-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10317 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 priorityscore=0 mlxscore=0 malwarescore=0 mlxlogscore=833 bulkscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 clxscore=248 adultscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204150029 Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, =?utf-8?q?Christoph_B=C3=B6hmwalder?= , ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 04/27] drbd: remove assign_p_sizes_qlim X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christoph Hellwig via Ocfs2-devel Reply-to: Christoph Hellwig Content-type: text/plain; charset="utf-8" Content-transfer-encoding: base64 Errors-to: ocfs2-devel-bounces@oss.oracle.com X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-ServerName: bombadil.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: i2ks-dtXBEYIMoCesOOg3_DnuoEiwR7i X-Proofpoint-GUID: i2ks-dtXBEYIMoCesOOg3_DnuoEiwR7i Reporting-Meta: AAGpG2Pbt6cSMX70OK/oCNRuGX548w49FuR1fDTZ8/km8ktUIqMB0LbJZhmhew7m F7qIUq6Gie3uYMx88wKMoiXVv2zoXqQErGd30thJP70ZxI2FqcTJHw841Jwkph3K 9YBaPZrtlMfkMhoWLe96paK0yDU00m+w1O7h8/Dy8WHS57tHdDDSd4KTLYngTrUB XwX9jINh3B6NVt+cpGkjKupZXPnWrBmrhkzuPoogC0ponDP4rH7v89YZN7O6f2jy w6fLBIfQG0OdQ2F9PEhIPhXMyWjKnlOFinWEplKlXt1kgqLw/XrkVUccjYNKcmgr Zn9O8ic5g0nhKm7ElmxY+diWncySVAuac5247FKZjSALBU11KOpRjnTaw5q1Fe6/ b5vj+j4475/ulP4UxZlpORmVd2K7hJ47GYlDqX2im4gMf3t/pabiJypoJJMtdqwX qd/oLv285aR7t5NFhhOLk6rO1v+LqgRjvJYEG3iCACS380mwzRpp2tJwaaV4ZYck PabI2t8IDoQQsCHvJwo7ST27MbnWpQQV7Mkpmllry4lm Fold each branch into its only caller. Signed-off-by: Christoph Hellwig Acked-by: Christoph Böhmwalder --- drivers/block/drbd/drbd_main.c | 47 +++++++++++++++------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 4b0b25cc916ee..367715205c860 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c @@ -903,31 +903,6 @@ void drbd_gen_and_send_sync_uuid(struct drbd_peer_device *peer_device) } } -/* communicated if (agreed_features & DRBD_FF_WSAME) */ -static void -assign_p_sizes_qlim(struct drbd_device *device, struct p_sizes *p, - struct request_queue *q) -{ - if (q) { - p->qlim->physical_block_size = cpu_to_be32(queue_physical_block_size(q)); - p->qlim->logical_block_size = cpu_to_be32(queue_logical_block_size(q)); - p->qlim->alignment_offset = cpu_to_be32(queue_alignment_offset(q)); - p->qlim->io_min = cpu_to_be32(queue_io_min(q)); - p->qlim->io_opt = cpu_to_be32(queue_io_opt(q)); - p->qlim->discard_enabled = blk_queue_discard(q); - p->qlim->write_same_capable = 0; - } else { - q = device->rq_queue; - p->qlim->physical_block_size = cpu_to_be32(queue_physical_block_size(q)); - p->qlim->logical_block_size = cpu_to_be32(queue_logical_block_size(q)); - p->qlim->alignment_offset = 0; - p->qlim->io_min = cpu_to_be32(queue_io_min(q)); - p->qlim->io_opt = cpu_to_be32(queue_io_opt(q)); - p->qlim->discard_enabled = 0; - p->qlim->write_same_capable = 0; - } -} - int drbd_send_sizes(struct drbd_peer_device *peer_device, int trigger_reply, enum dds_flags flags) { struct drbd_device *device = peer_device->device; @@ -957,14 +932,32 @@ int drbd_send_sizes(struct drbd_peer_device *peer_device, int trigger_reply, enu q_order_type = drbd_queue_order_type(device); max_bio_size = queue_max_hw_sectors(q) << 9; max_bio_size = min(max_bio_size, DRBD_MAX_BIO_SIZE); - assign_p_sizes_qlim(device, p, q); + p->qlim->physical_block_size = + cpu_to_be32(queue_physical_block_size(q)); + p->qlim->logical_block_size = + cpu_to_be32(queue_logical_block_size(q)); + p->qlim->alignment_offset = + cpu_to_be32(queue_alignment_offset(q)); + p->qlim->io_min = cpu_to_be32(queue_io_min(q)); + p->qlim->io_opt = cpu_to_be32(queue_io_opt(q)); + p->qlim->discard_enabled = blk_queue_discard(q); put_ldev(device); } else { + struct request_queue *q = device->rq_queue; + + p->qlim->physical_block_size = + cpu_to_be32(queue_physical_block_size(q)); + p->qlim->logical_block_size = + cpu_to_be32(queue_logical_block_size(q)); + p->qlim->alignment_offset = 0; + p->qlim->io_min = cpu_to_be32(queue_io_min(q)); + p->qlim->io_opt = cpu_to_be32(queue_io_opt(q)); + p->qlim->discard_enabled = 0; + d_size = 0; u_size = 0; q_order_type = QUEUE_ORDERED_NONE; max_bio_size = DRBD_MAX_BIO_SIZE; /* ... multiple BIOs per peer_request */ - assign_p_sizes_qlim(device, p, NULL); } if (peer_device->connection->agreed_pro_version <= 94) From patchwork Fri Apr 15 04:52:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12814500 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc255.phx1.oracleemaildelivery.com (aib29ajc255.phx1.oracleemaildelivery.com [192.29.103.255]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 73DC7C352B6 for ; Fri, 15 Apr 2022 04:54:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=cwEipjtz5TsMu7s+eVS2suOdN/j7ma/Jn0HsJ6PZBRQ=; b=YaHEWDSUut7AV66JZK6zoBBM1bQ9DJwgQXF8tCI384flVyiu/s+IX6oLeoqfp6UaGZWCMwYDk4xO qtA+hKEy71yQ/wbqhUMLfN0GyG7JwgKCMWt8LcJPpTQcULW1Q5KMuIs2HQ41xbN6fZMvzc1HWbEu mnypmBeXgsSR1S/Ss+iC+9AeCX1hMrL+oxYJkFjpDU6b9WAjL62Lz05lkHv16OxqsO0FKt6HxngB pF08J13b7WP8kM8CEDaCMDz6mVWWsGpPx+bGKFDsjfsxb2LWyNnUP0CSJToWs/2LL9pTL7rUQS5u gGI6m4Su+mA84vUiZvyNdbMUxZDH5UnGyrzVBQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=cwEipjtz5TsMu7s+eVS2suOdN/j7ma/Jn0HsJ6PZBRQ=; b=VP617P4I8KPPTU7F2o+tPRWrTVVbNlElSzBX/BthrX9wMCepHBFkjKG+KRkVd9gsk5ehf9xj6qY4 AjaalfdyAGkaKHsn4r1/iK2wQ4vGL88WsBKWtpWZHmAw+BtHBspehVNbBEUTKeS3jXBZJkDPKiau 21/ysYbRi9Mo26rx0L1Ct/8zII5d2oUxbs+eDjQrG9HtpUqr6EMe1wfpNNiVQDOl8D5up+7056C1 YnuV6MpZRZFsOHu+8MNWn8Gu5AzvxNjsGIArai/6kOMfp2ZB+YDtxPzgDdSSs8YnVERI0B365aAx DluyEjk8mhns+T1zu3Mey0WYq7ihA61Dpl/1ag== Received: by omta-ad3-fd3-302-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RAD00B206YGE2C0@omta-ad3-fd3-302-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Fri, 15 Apr 2022 04:54:16 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=XZGhvwW8WnEXnqFpyMAZS4hEeSHoeSYBiqC69zbelFo=; b=Gxz7Y5uJ+XKe3DFB5F+glNf4Qd +ilmHliKeg1fmYV7/5LLANJc72+LNxw8j97CHk5ziFCgc1uz7kS3J7fxsGIO6cnBRc/aEIND8YKio 0SkKbU86rwF6U+vXBBwyr3GFqwWasgE9TCw8n+hO0zPxSPP5I4ZPpiX7PrV0Nkluz9OYVJwj4Hmwy oKidnHT0/AqxHbe4vf+J+1VyQBy8myzVvzFwGzWB5MOWnMsTyORGtxjAzgY+jPvDzJzijUERBo3GF IuBPqJCO6mtg8vZGmw86bOvzf7HW3Tdf+1Wt8evubUZivpuvFh33FBjqoHj3OCwfnGHVCD1k5Crl7 crl4uuXw==; To: Jens Axboe Date: Fri, 15 Apr 2022 06:52:36 +0200 Message-id: <20220415045258.199825-6-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220415045258.199825-1-hch@lst.de> References: <20220415045258.199825-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10317 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 clxscore=310 mlxlogscore=789 impostorscore=0 priorityscore=30 mlxscore=0 adultscore=0 bulkscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204150029 Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, =?utf-8?q?Christoph_B=C3=B6hmwalder?= , ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 05/27] drbd: use bdev based limit helpers in drbd_send_sizes X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christoph Hellwig via Ocfs2-devel Reply-to: Christoph Hellwig Content-type: text/plain; charset="utf-8" Content-transfer-encoding: base64 Errors-to: ocfs2-devel-bounces@oss.oracle.com X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-ServerName: bombadil.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: YVdMduD6WosQNvlb6ehwkTzAd-6zKHMe X-Proofpoint-GUID: YVdMduD6WosQNvlb6ehwkTzAd-6zKHMe Reporting-Meta: AAEM/JB5c+5pYfAk4vHpNc7zQQhy0ZUB3yz14Kd6WHipWf903Jdsh1SmWeXrQRAO ksE1e6LvR1EZm8iyc0mKqcvZDtVJEy81wT/75HuUNF+Dzp9DXGIYGAz37H4kIJj3 WXxfGnHgC6zTfEt6Mmu7F8KsfKs7rPyyhf7dofRCIJfIGPnNMfjEg6psd+CnGCFE 9GCf8oUouRO2jMb0dlkyJeIQdLQg+VuLKaQ5lyPgvD8mSkgVQ5SazTowYtDHA13+ tZHJvtU7eYAztcUgac04z23ZLsWVeXw8thiY2OhJGwAdKUw8IDORwBU+9IPyRNYw BOHLRNkd4B41JbH15tMhk3H6ZkMQo57gp6eRM3L4TU4ogUzv8WQrBB4W9ExPsnsT Bd1PQp5fNYs5JgfmoUHQkcR1etbaiAPHmO+PoGMyzJCJlPdYgn2QTIbio6QfRHMR OF3kuui4FedFIbpR5DhfG1FEzl/HPvDJBNfouILqyhoqXrW0duwwbiLvhHk+Lix5 L8AAGte+KFfrYWYh9ZPawKaWmTxt+/Ug89/kDYo88zCu Use the bdev based limits helpers where they exist. Signed-off-by: Christoph Hellwig Acked-by: Christoph Böhmwalder --- drivers/block/drbd/drbd_main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 367715205c860..c39b04bda261f 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c @@ -924,7 +924,9 @@ int drbd_send_sizes(struct drbd_peer_device *peer_device, int trigger_reply, enu memset(p, 0, packet_size); if (get_ldev_if_state(device, D_NEGOTIATING)) { - struct request_queue *q = bdev_get_queue(device->ldev->backing_bdev); + struct block_device *bdev = device->ldev->backing_bdev; + struct request_queue *q = bdev_get_queue(bdev); + d_size = drbd_get_max_capacity(device->ldev); rcu_read_lock(); u_size = rcu_dereference(device->ldev->disk_conf)->disk_size; @@ -933,13 +935,13 @@ int drbd_send_sizes(struct drbd_peer_device *peer_device, int trigger_reply, enu max_bio_size = queue_max_hw_sectors(q) << 9; max_bio_size = min(max_bio_size, DRBD_MAX_BIO_SIZE); p->qlim->physical_block_size = - cpu_to_be32(queue_physical_block_size(q)); + cpu_to_be32(bdev_physical_block_size(bdev)); p->qlim->logical_block_size = - cpu_to_be32(queue_logical_block_size(q)); + cpu_to_be32(bdev_logical_block_size(bdev)); p->qlim->alignment_offset = cpu_to_be32(queue_alignment_offset(q)); - p->qlim->io_min = cpu_to_be32(queue_io_min(q)); - p->qlim->io_opt = cpu_to_be32(queue_io_opt(q)); + p->qlim->io_min = cpu_to_be32(bdev_io_min(bdev)); + p->qlim->io_opt = cpu_to_be32(bdev_io_opt(bdev)); p->qlim->discard_enabled = blk_queue_discard(q); put_ldev(device); } else { From patchwork Fri Apr 15 04:52:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12814502 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc255.phx1.oracleemaildelivery.com (aib29ajc255.phx1.oracleemaildelivery.com [192.29.103.255]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 463A1C352A8 for ; Fri, 15 Apr 2022 04:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=fSzeLRk5fjRArIud+CXERDm6IqyYRcNVZ5zIzjPLDhw=; b=H7VRlOnGuDO7sNBerkzCfJVUy6A2QlspW3uTPbO8I6jDwbz/UhvGDCnNW7jUAEB8a+xuAnZ3zoMZ fZ4gboJSri7VLdEUUvEO6nRlOS0yYduUrKFI+UzBa75uRReQj6PP5dx4k2G/KI7LwRnkzc1U6d/P YzKYcYLn5RALw8QrSW+RpXi+8e8yoYqQxaIzYW0zwUgQOyMutYhSdzzhPhjyaCCfgicJm8L3BnU3 LSgBUupels/QFePqSGg7dFsZsz4TgexU9l8jvDF5rlOsMQG17mcuZ0PdqUBVX9RM4aUFcxKjvX7/ MuKlPqCH44w/dOUtL6L6t3JfunUqYuaGEUc1OA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=fSzeLRk5fjRArIud+CXERDm6IqyYRcNVZ5zIzjPLDhw=; b=a5bKZf8FOBoc+MiNQvSTDZ/dvA3s2yFYGWh77jXaEMdjJFdmLEt/rYcyxHXTlh0TrG1H30j2wdzA bRGmgNCIp4FdGxGsIcsPWhf5MVYS8tslcFhucHvnodL+cYF1qy58xGBSFz105JogiPCxKBSgm4Os qEB2BrQodh99FnUMPhQOpOxIggYSo0pz0rrncSxm+SQWnXnP4dZQomhCGgl0xq/14G5v1yceCMJq AIxhqDAN7XrR9FdVXWe385lUjzrXaU1fYpBSP0BpQDNRtzrgUX9y/BZs20iZN0qSA85DQ5wBr1DC HDggb+wCdMxCCBP5Mu86BltUiUZMxXbE6RqpYQ== Received: by omta-ad3-fd3-302-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RAD00B2I6YQE2C0@omta-ad3-fd3-302-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Fri, 15 Apr 2022 04:54:26 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=pjOlLI0zIPscdljJBqydWvc1kCbsO4mNomowvsnW144=; b=qvkOjPFjyqYMQWW/2QWIK68ENP k2NNTMvf9yJkIIsMinaHWq3ShtV9GAA9eD1j84n/4A1YSynSJPbH7xunvM4gFW2tBAaf34uDjFYTF Cf27zURP5kxthNnuilxHYkuF0+dYk/s+KgITZDeRBuWDyLf29iyj7NC5GSjUBL7HTLudqqDHJV7jI umQOzmF/ghCqietP9jcYeXWa5VJNEKLQMKEWsHvHjmzPuAlTBx/BxH8sjV6Sj89/sE85wKvCAMm7z 4onw1pEIPzrLUGePDGOaGXDfMTfY5lSCh3pdlvTomsyZDMHzABEpf6210R46hSLONPkgfa2cukRRf iN4Lrpmg==; To: Jens Axboe Date: Fri, 15 Apr 2022 06:52:37 +0200 Message-id: <20220415045258.199825-7-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220415045258.199825-1-hch@lst.de> References: <20220415045258.199825-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10317 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 clxscore=310 mlxlogscore=528 impostorscore=0 priorityscore=0 mlxscore=0 adultscore=0 bulkscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204150029 Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, =?utf-8?q?Christoph_B=C3=B6hmwalder?= , ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 06/27] drbd: use bdev_alignment_offset instead of queue_alignment_offset X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christoph Hellwig via Ocfs2-devel Reply-to: Christoph Hellwig Content-type: text/plain; charset="utf-8" Content-transfer-encoding: base64 Errors-to: ocfs2-devel-bounces@oss.oracle.com X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-ServerName: bombadil.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: e239qaxYmzvh6zvYOFNccyKlK2OtrlOO X-Proofpoint-GUID: e239qaxYmzvh6zvYOFNccyKlK2OtrlOO Reporting-Meta: AAHubPBLBEdBMwcFxWjeXCkxAe4em2Ltg69laooP3SJu4VNHZydgzL8IZZLTc/Tp 4KG91DkOwT61+rjv635z9DD7ieTBlX2ltYIJNcukyhUZhdWzjGSUwXTwopZCGnZV Me0q+ipXZRDjNnpfX1Ba77J4DqPtu0/F5/KxLAm+2VZKPcPXH1FS6Ue8Ktcla6Up /cXX+om2u6IhLvao3DOjkvapBgYRNFLAN/wjCVEvUR9QAyhCBtECLBtccf542PL8 7/TTX8u10BfzHnyaCpMaY5bmOZ66Ldp2fJydJVHmNLD2HqZZcJgZYlVmXPJrjxl8 ghq1xSTmw36KUM8OEHTAxxmVTBSGWRYRcZOCHIRNaUpi0FoKsxlY3KjACac4B0PH dIMIbPUjj/8gp85rLp9tF1+10E65zg44yxlUDKlQfqoUgWdQ57G7pL/zeo04dZdy hUSFgOTMirVrYSTaIlfQlNEDVnadKG1nTedv9UEnn8qdKcXvWP6G1fvmBtgrBFX0 RNrQIn5Y8paFleZZZuTFZ9x1QADyXiXyifUG2m0XkuDnjA== The bdev version does the right thing for partitions, so use that. Fixes: 9104d31a759f ("drbd: introduce WRITE_SAME support") Signed-off-by: Christoph Hellwig Acked-by: Christoph Böhmwalder --- drivers/block/drbd/drbd_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index c39b04bda261f..7b501c8d59928 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c @@ -939,7 +939,7 @@ int drbd_send_sizes(struct drbd_peer_device *peer_device, int trigger_reply, enu p->qlim->logical_block_size = cpu_to_be32(bdev_logical_block_size(bdev)); p->qlim->alignment_offset = - cpu_to_be32(queue_alignment_offset(q)); + cpu_to_be32(bdev_alignment_offset(bdev)); p->qlim->io_min = cpu_to_be32(bdev_io_min(bdev)); p->qlim->io_opt = cpu_to_be32(bdev_io_opt(bdev)); p->qlim->discard_enabled = blk_queue_discard(q); From patchwork Fri Apr 15 04:52:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12814504 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc247.phx1.oracleemaildelivery.com (aib29ajc247.phx1.oracleemaildelivery.com [192.29.103.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 542EFC47080 for ; Fri, 15 Apr 2022 04:54:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=g3rSiNQ5HognllHl5GpPkZiZwU6IWTo9nuhx2adGhrc=; b=eiE2N3YR7rxNsfXf1R/3oDDmQwotSoWNSX3qS3myFMVeA8MHD39lYhdFl9cETz5+EgAJQMbXo72m XwYVkxRv324iZuWPAwqJZTThN9gehK8uZZsaZ4gI0CCD/gKWON7Z3mLo1e/hdGjXjSW65B0h7nrv TGI+MdoglFFkBwet03RfF7GRQ6a5jWdK1JL+Ye2XlEbL/O3QJR/HahuOD/XnihY8scMDEpj38Xqx 6Tn+p7LWVpDpcCiuL/TIHzhYoUAZmLLFEeX3DQcfLYitt6Utql7RvLTSLd7QA7Us+Deo2qZUqgFS 03TkxBLYPIAWOAlqrxTwPgjwB6twAwNpHgIUfg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=g3rSiNQ5HognllHl5GpPkZiZwU6IWTo9nuhx2adGhrc=; b=Cy7tD2tue91523HntPZ0SJYPb8UgmA8JHvvXulFu19+oJH0ycW+CUg2N4HpxBR5sSjP3FboAT5fZ OxKVshvM71m6H7Z1FXH3jDce0Mq4UEfLLwbvJa/zssU62Jv85Q/JUvVHt9Nmijfty0ZPCh+N37vX 6EWWsT8Mc0qyOUh6gzwsFgvOYM3hpcSuo/Wl03VXJZXjV6rdlbea9x94gsmdEXScBZ+JcehZJ0Bn hkThEl2vtolUG/kmqDzmEv6kDXssQG0c/hK0H8bB+xPGcL1ZVlAumXM8H0Uc+eEOnkXet4Gb6Jbf ohR1IiXBmHNeOPRQos6osubNNxLLD/Xlf1hs+g== Received: by omta-ad1-fd3-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RAD009HJ6YS3Q60@omta-ad1-fd3-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Fri, 15 Apr 2022 04:54:28 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=9tUaZULhEmteAuYmNe/S5K85i8mY+zpV/R7NWj8li0M=; b=AjCBuPx/UHSGTakXv8HXmgNw4N Iyofq9wNNzfgjbG93scprq/gUs5OOhFUGL0tKjcj2IWWkpHNBkXqusk5CV5Uj/P/70TymjB6Unzdu VnxSzUtQb3ldimIkXALq/IfCXSo1TL1NzeISVmz+Ea7q6xFf02zHvxp+FndxH2zbBXHBFRTOnXe4c nAXrXpjx27cFTMs0mjOzvEq3gOjLOY6hKIcglkznMntAYg+vXORRN23xzGalvjS8R6ccxTXJWj8QW sdXJMYerLCI2QfFcDPA/f8tI4pucu7JSpv7rjXlKJh5WSo2NBa1UXNlyVf9emnFeALezPoiPRp2d8 jaVM4Jaw==; To: Jens Axboe Date: Fri, 15 Apr 2022 06:52:38 +0200 Message-id: <20220415045258.199825-8-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220415045258.199825-1-hch@lst.de> References: <20220415045258.199825-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10317 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 priorityscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 clxscore=226 adultscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204150029 Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, =?utf-8?q?Christoph_B=C3=B6hmwalder?= , ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 07/27] drbd: cleanup decide_on_discard_support X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christoph Hellwig via Ocfs2-devel Reply-to: Christoph Hellwig Content-type: text/plain; charset="utf-8" Content-transfer-encoding: base64 Errors-to: ocfs2-devel-bounces@oss.oracle.com X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-ServerName: bombadil.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: GjMCo7tTzgmSCHmYLALwFbaE-KjGpTeA X-Proofpoint-GUID: GjMCo7tTzgmSCHmYLALwFbaE-KjGpTeA Reporting-Meta: AAFomgJZ4DbE0jTlh+UyhWKHwOqbji2A/911JkcNY9g52CWEyJbHf0jBaXSfZC2u Og5h+qe0RVQNHopTfTS0fDvp3NqxlOzkm2dFKVFoNnqzPbryO7kaVpnLhDzgKAPK NEIq3yQIvM1yd1JDoO7g53reuGxlHT3XSbc4/ZdrmPh/O9/qnDvM49a9KMDnH0RG 2+Qc1dn/aqJ4c7qPHDimOLhTWA/5qQU2jFSYI6tNQltViq05BIikny1CoBZyEm9e yKKP/S2HI7DOjkdW0EIWyHBe/ZqqyvJN+ARXVDZ7M+Z6kaF/2bcQLH/XvagWJigO ngIcin8JIs2Z51xmMjm1ALmW+3midgt+567Y4ib3o24etxC71AmXnSLliXdAd6Hr dBSAT36p4XSHYPJ0vA8dx6TkfvvmdEWD0rpPFztx8cmtR+f133tguxoJ++98fW7l trh8IvFOurn+n5oQ64xblTNX69c9bgFdKspdkoDvrxbgS4OrydBHiBEa4klQMF5L NRBnHJ6vf+nuLA7tu1j4/rU4IsyUI2Z6etseJV72tzoHBA== Sanitize the calling conventions and use a goto label to cleanup the code flow. Signed-off-by: Christoph Hellwig Acked-by: Christoph Böhmwalder --- drivers/block/drbd/drbd_nl.c | 68 +++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index b7216c186ba4d..4d00986d6f588 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c @@ -1204,38 +1204,42 @@ static unsigned int drbd_max_discard_sectors(struct drbd_connection *connection) } static void decide_on_discard_support(struct drbd_device *device, - struct request_queue *q, - struct request_queue *b, - bool discard_zeroes_if_aligned) + struct drbd_backing_dev *bdev) { - /* q = drbd device queue (device->rq_queue) - * b = backing device queue (device->ldev->backing_bdev->bd_disk->queue), - * or NULL if diskless - */ - struct drbd_connection *connection = first_peer_device(device)->connection; - bool can_do = b ? blk_queue_discard(b) : true; - - if (can_do && connection->cstate >= C_CONNECTED && !(connection->agreed_features & DRBD_FF_TRIM)) { - can_do = false; - drbd_info(connection, "peer DRBD too old, does not support TRIM: disabling discards\n"); - } - if (can_do) { - /* We don't care for the granularity, really. - * Stacking limits below should fix it for the local - * device. Whether or not it is a suitable granularity - * on the remote device is not our problem, really. If - * you care, you need to use devices with similar - * topology on all peers. */ - blk_queue_discard_granularity(q, 512); - q->limits.max_discard_sectors = drbd_max_discard_sectors(connection); - blk_queue_flag_set(QUEUE_FLAG_DISCARD, q); - q->limits.max_write_zeroes_sectors = drbd_max_discard_sectors(connection); - } else { - blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q); - blk_queue_discard_granularity(q, 0); - q->limits.max_discard_sectors = 0; - q->limits.max_write_zeroes_sectors = 0; + struct drbd_connection *connection = + first_peer_device(device)->connection; + struct request_queue *q = device->rq_queue; + + if (bdev && !blk_queue_discard(bdev->backing_bdev->bd_disk->queue)) + goto not_supported; + + if (connection->cstate >= C_CONNECTED && + !(connection->agreed_features & DRBD_FF_TRIM)) { + drbd_info(connection, + "peer DRBD too old, does not support TRIM: disabling discards\n"); + goto not_supported; } + + /* + * We don't care for the granularity, really. + * + * Stacking limits below should fix it for the local device. Whether or + * not it is a suitable granularity on the remote device is not our + * problem, really. If you care, you need to use devices with similar + * topology on all peers. + */ + blk_queue_discard_granularity(q, 512); + q->limits.max_discard_sectors = drbd_max_discard_sectors(connection); + blk_queue_flag_set(QUEUE_FLAG_DISCARD, q); + q->limits.max_write_zeroes_sectors = + drbd_max_discard_sectors(connection); + return; + +not_supported: + blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q); + blk_queue_discard_granularity(q, 0); + q->limits.max_discard_sectors = 0; + q->limits.max_write_zeroes_sectors = 0; } static void fixup_discard_if_not_supported(struct request_queue *q) @@ -1273,7 +1277,6 @@ static void drbd_setup_queue_param(struct drbd_device *device, struct drbd_backi unsigned int max_segments = 0; struct request_queue *b = NULL; struct disk_conf *dc; - bool discard_zeroes_if_aligned = true; if (bdev) { b = bdev->backing_bdev->bd_disk->queue; @@ -1282,7 +1285,6 @@ static void drbd_setup_queue_param(struct drbd_device *device, struct drbd_backi rcu_read_lock(); dc = rcu_dereference(device->ldev->disk_conf); max_segments = dc->max_bio_bvecs; - discard_zeroes_if_aligned = dc->discard_zeroes_if_aligned; rcu_read_unlock(); blk_set_stacking_limits(&q->limits); @@ -1292,7 +1294,7 @@ static void drbd_setup_queue_param(struct drbd_device *device, struct drbd_backi /* This is the workaround for "bio would need to, but cannot, be split" */ blk_queue_max_segments(q, max_segments ? max_segments : BLK_MAX_SEGMENTS); blk_queue_segment_boundary(q, PAGE_SIZE-1); - decide_on_discard_support(device, q, b, discard_zeroes_if_aligned); + decide_on_discard_support(device, bdev); if (b) { blk_stack_limits(&q->limits, &b->limits, 0); From patchwork Fri Apr 15 04:52:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12814508 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc248.phx1.oracleemaildelivery.com (aib29ajc248.phx1.oracleemaildelivery.com [192.29.103.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3F32FC4332F for ; Fri, 15 Apr 2022 04:54:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=Z97ym2RHCw4pEv0szQ/InI6CKvS+AXfZyhfKhO6xiOM=; b=mNvzD30drhRxtWWyIJZD4c5RB1MBWWfMDymYQ6lYaGh24Mji88eUvWEZFNQpu7mKpzVK0wGjnPCR 9zYbEUAYP0WZtejgJBLiOKiKcEhjdl4RPyA/Ifn7S+jtcS0czRRxaCuDHh9FZCv7RsLuZePwsgfU vPEFTQQHmflOK6LVMasB81p7sv5ok0jHlPSSeZkQmbD5NbHSeIYJEzo5U4AnEX74Bqti3e9xX3ap m0LwsjQ9UTEJCl4H8uwDYe2j5Y1eLdq2Qn6EUpa9nzD49ujr0rZtuHp23HPnoMX9uyJqJQ4fVxRD fKtfTO76RV2iAjjM/zBk5eC4QwjR3WcOT66EVA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=Z97ym2RHCw4pEv0szQ/InI6CKvS+AXfZyhfKhO6xiOM=; b=osPx7eCcz4BdMvpMTkE5g9LmUidvR+n3fjILSdTDLvSvl+YEuhm0wTijWqFuNSQrC5TMzspiG5AT 12wPzj51CcInJUb4pA8aW9wVlnMrI+LPySPsF/3BVqh4cf2lWTfX1ZSMaBgHOXUcqSjwd928pttf 9/Y3RusOfEQEgDWuqSGlTjE0Xl3WhwKOINHXci2yZjHHMKlFomyhnkcBWlr5+4ooRaqv9RzN6kfA dNB3DEuRJwO/NtHwQ3mfPG04RiEJAvuKkralRnGd7wjI7wt6XaghcjGMyB9jvcsRypAPe8L5I6rN 0E1VmbV88GsiiP8ycRaeZdVbqbsoSXc4v8xF9A== Received: by omta-ad2-fd1-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RAD004026Z0Q400@omta-ad2-fd1-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Fri, 15 Apr 2022 04:54:36 +0000 (GMT) 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=Bh+vV8H1PUD+w/3YWj6wMRz8JdOJ8okMcDjW6Mx/Fiw=; b=EDKTioiwyVTPK+3osA6SlCjZIh XT2MFqWZOTWCp0TzWu6P4fqhDWPMpkttHrN+m9dRro3N5CDnlXbRs0EPkfGOyM+igunHSMpD1drYP wVG9uOkzBpiVKojyqfYhi6+OMNU5l2i8PZR4B1REL+uCtnEoooz23D6FVFibL3Fu1/dIA+0rTSxtr oKyzI2WMLHHUV9rvM0v15/lCAj3aZ6PKIBUE2kOCt4TslhWmWNZKgszd/7d2ie8DKfEQnXgchcj36 NzfvLJkjkLxSqax1JuD1ELqlJ8gRaVf5Gn7y07gnCWPWGyuEN/9bXBtizUFBY7p5eDKr/MYNHjMCe ltnYH85Q==; To: Jens Axboe Date: Fri, 15 Apr 2022 06:52:40 +0200 Message-id: <20220415045258.199825-10-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220415045258.199825-1-hch@lst.de> References: <20220415045258.199825-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10317 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 impostorscore=0 lowpriorityscore=0 phishscore=0 priorityscore=151 adultscore=0 mlxlogscore=785 bulkscore=0 clxscore=264 malwarescore=0 mlxscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204150029 Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, Johannes Thumshirn , linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 09/27] ntfs3: use bdev_logical_block_size instead of open coding it X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christoph Hellwig via Ocfs2-devel Reply-to: Christoph Hellwig Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-ServerName: bombadil.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: 8uj6CN8kIRTSs_0gQe2bZXilj_S-ge82 X-Proofpoint-GUID: 8uj6CN8kIRTSs_0gQe2bZXilj_S-ge82 Reporting-Meta: AAEw7PIAkF13p9TjXZGmdo446Tx7LXxn8jn9kyO16l8Es9iPLldvwvDI3TvQqaPs gT9PIiezFHx5gl0e4CFhBO8rOLOFZcP2u9GxFO1RTe78bH4VCtIdQVCAeLhTVfqB A9TSWb1TrY1JLTv9LtlGMvwr57Y8YJMU8FOkv96kV37QcZD/L18SbYisZccWmg37 ZOwf7ytvtX/OGHd5nI0Hb0stmNchw19NjbkwMCpI7Uj2Q3MzeuoP/1iLndG91/FO 8/rE/tHst0YxdaU9hQZC04F5R5JfPM5pMRcuAiiWKPQEh01hpmhozHq6Ge/VNkAq jovOpUjcgtniGv1Oh0CGQxZUXHh7Lq8YG+uz7KuhWABSLk9plV3C4xccsTcE7YTE D1CA7mCTYn8pJ6UXXcb11crwPOmqqPGogrVE7uIlmbPcBcVfLCL4bzn+P/diOF0D 4iM15zfj8iS7ZchPY1RmoQCwbVk5Cw4tKl3krbjNlwJjjm01s/jfBy3UzTKV3YM/ +TDfxU8WTFUDx2irMThrB3vGjRcUhVkio4V4sInilRLX Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn --- fs/ntfs3/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 278dcf5024102..cd30e81abbce0 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -920,7 +920,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) } /* Parse boot. */ - err = ntfs_init_from_boot(sb, rq ? queue_logical_block_size(rq) : 512, + err = ntfs_init_from_boot(sb, bdev_logical_block_size(bdev), bdev_nr_bytes(bdev)); if (err) goto out; From patchwork Fri Apr 15 04:52:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12814512 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc248.phx1.oracleemaildelivery.com (aib29ajc248.phx1.oracleemaildelivery.com [192.29.103.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B6B17C433F5 for ; Fri, 15 Apr 2022 04:54:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=OOuGpF2IDOuGrtFfwSThFzxd3u1mhnY8DbD9OeHtOXc=; b=1lGXk9+MEEvCcsjFeuQsyBvlbcP0FJoZGM9fRRFLSXep6tyaYK3wDe4spy4RAsKqv7WlG5JS9lTI YwAmIqFW5duvPlW71sv8adbOku/19jYfAisGJeReLfY25GlExTGJ93IzX6YXCoJxicCW2PXk9qbA b7ox9zOPsWaxb+u3MTDLp+8LAUpw+rb735E2Xjao/BAfnBOyhynx7aPIJ/WpcSv7HJkd0BLzOjP+ DrlsvgnwjTpSPCXzj6r6H90h74QOZdPyn1cLDpLfvxuHVfYPgIUaP2LryBlxza6XfUJqBZGI0jYM beh2TVwYuIjuNCOHwf9Ec8obvuvt/J7N9X2yjg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=OOuGpF2IDOuGrtFfwSThFzxd3u1mhnY8DbD9OeHtOXc=; b=E38KxQH2W4S1Gl2ptwvrv3pCPFL42iNGK0Sprbr3A3960qWcoBRxdRLaHrBub6cjZAehGq+rMv1u PdIZkcBtQicJQoC8o9EJ/40zx38uOhsg1WFaMwwWvBOJ+E+CcNzyatyjA+c7eXL04z4uzIvlLFKX hFV/wxKjbbkq/v9BnfI1MMmdqOInVycD6y5U9hJ15ct6VhBm+bWy86cKQe73hcV0WF7MCdUJ4ft+ 3EJJgeMEd5/RHCO+1WHCnSi8bBtzF/KX/5yylGYKFoJwCVmx0PNW80xvQ0SEUnDICpcHbfwdRFHX O/HKkzjSxb8Y5M6BWFDGvxVErUjP+9N3DtBfJA== Received: by omta-ad2-fd1-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RAD0041F6Z2Q400@omta-ad2-fd1-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Fri, 15 Apr 2022 04:54:38 +0000 (GMT) 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=OGJvHxXgCvw9/l2/0Y6T0ivupEa5/VICLVgDi4pj6zk=; b=V1O5NFc1OlhQKBAtPUESXrscbH +gcfK8CWzUYJRweVfHt/gmcJRbnnyENCL0uxhp1nElH2rQXnBLZskSDze6nM9j3gF5JGx31h7pu9N vPub4AczDFXqMD/nyRBLgGmvIyYUqZBGTv5Cc6JJINS7BJNf0/btoIeeLCOjZ4a5fxHer4O2Wp+wl 3U3FDeLPVBAqUisUOlzqQt8zs+kHINf2usFr1NigldxLvR21wl2YG3uLr/6AwNNFGfA7YCs2iW8C/ bPJ75RbYfKAHSDs+/fiusGnx0gVrEkfUrP1ZPu0GLZCLsq5AzPGOB49mYYVnrdML7RbrD/GaYtdc7 GVJ2xQ0g==; To: Jens Axboe Date: Fri, 15 Apr 2022 06:52:41 +0200 Message-id: <20220415045258.199825-11-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220415045258.199825-1-hch@lst.de> References: <20220415045258.199825-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10317 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 phishscore=0 impostorscore=0 suspectscore=0 malwarescore=0 clxscore=267 lowpriorityscore=0 priorityscore=156 mlxscore=0 adultscore=0 mlxlogscore=504 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204150029 Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 10/27] mm: use bdev_is_zoned in claim_swapfile X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christoph Hellwig via Ocfs2-devel Reply-to: Christoph Hellwig Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-ServerName: bombadil.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: WJUmC8MI8EQi3px7TuOkVr75Hec4HIED X-Proofpoint-GUID: WJUmC8MI8EQi3px7TuOkVr75Hec4HIED Reporting-Meta: AAHWQaFJ7vLMjYNc/QzHDkPsRjypfqMewwqxiwlvmPCsiSmf9zl+oZGuCscerbey 2gx4I/iIaVcqlorxPjKEeh6sVb/SYsO2NOJctJ4J3H/dfq9v3d9jEwMnxlQqLcB5 Hjk5o2Lm90Z/btxN3ucoHiV71t0FGkZjsHnqRVeenqpW4sPZYpP6z0K+SGlgvLty BOxBMAiCtq2RSZdB4L1JDR5yV5AzUpPKJ4lnA9ZdMkXTxPpY6BsQbdttwdfIT/lT Fy9FZy455NxJ/LmwNoCkVCZNHMhwDQ9b64gWxX9wA0WjVRanla8MEoviI4qlFJs+ yWrTbfuToCrHETX02j+xrFY+xoY6DQtVvBUlrYzdaPyDX33OeUy8NRjGBJ3805u+ 1buuWai6WudOU3zKOpOAjsQEmSgu+zEsK8lWoxjLBAqFj1a7PFJrSJpFINuhgfBR qL8+Funke9vMNLQiO3kdmFVIPBzLh8WOL+4C/ZXiRbzQOHsbUhCqYm1w6soeiKDZ LE8AyOdaljyLOHzMTnywHaK+W5iBjzSHNLvFQWnkAKVm Use the bdev based helper instead of poking into the queue. Signed-off-by: Christoph Hellwig --- mm/swapfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 63c61f8b26118..4c7537162af5e 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2761,7 +2761,7 @@ static int claim_swapfile(struct swap_info_struct *p, struct inode *inode) * write only restriction. Hence zoned block devices are not * suitable for swapping. Disallow them here. */ - if (blk_queue_is_zoned(p->bdev->bd_disk->queue)) + if (bdev_is_zoned(p->bdev)) return -EINVAL; p->flags |= SWP_BLKDEV; } else if (S_ISREG(inode->i_mode)) { From patchwork Fri Apr 15 04:52:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12814507 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc251.phx1.oracleemaildelivery.com (aib29ajc251.phx1.oracleemaildelivery.com [192.29.103.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B18FBC3525B for ; Fri, 15 Apr 2022 04:54:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=qAz5LeSM1hp2VKl1SUFUJPVNgvBxEWE8wcN0h8ayS4c=; b=qmyFxvzVaocGwc3Ld96JSVR6FMIcKI5IPc1Nu8Y14yG8alwiYzqPm90XTs59ALP54iVxeSkWKLH0 8xOHzhQ+iVNsITBNBbL6S7vl79IUlq/SkOE8PkwjaYZqR/a1OUHYTvkDu08gRNr0mouBPsDbcN1e 87n8GorAOeCnC8jz9bv3algujZI/TNIVnGZ9ZE2BsWXt6xNKC+dQYSuF+SicHmnT4lTdZmxPbZlL IVbwA7hI64n/47edfBKENeRfxFNdSQuWDCAjuVz5t3NUYhjwXKiGNRQKuOFVsIjJDzvvj8RyjFls zRQt+2lLsWgZBRMLEe/WsClU6FyCgHk+W+y3bQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=qAz5LeSM1hp2VKl1SUFUJPVNgvBxEWE8wcN0h8ayS4c=; b=X814eYMdDhvxQwCHv2BBFsfRdSVOrEJgLy/JlJXcyRVEkSdFq+A7eJGevYGLuz/hxNE8xUwd2OWj wYPRGJsH3cbQn3PnyllBC54ZFxPkG0b5PqddAqr1WoJL2oKMHq64Yg4wEQdJfX2C2lwlXYYO8HIR t8SKFaOOwi7eItHHB+ikErIMyc/2cANdC5A50bCPjy31gGoAVDpoiHcA4YW7oAVwS5Tz3QhWviQR F47X8pRZg/QMK6PmrF5t/1m+lW+NM9rPPFqUneyQ6pgzcikJrt90fg02GQYgjWWdC8rQnehOh4Fm o/nKZSc5QDNydY6cSLWzy58Dqa0IjHk8ylbCVg== Received: by omta-ad2-fd3-202-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RAD00HXC6YUW790@omta-ad2-fd3-202-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Fri, 15 Apr 2022 04:54:30 +0000 (GMT) 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=ZlX6tQSx9Ltba6eWidCjog7i9CmwA2DoDl+4xkJfBJs=; b=mK5Q76NpPUvc78f6UJP6DQWA/7 NKBjQM3eKggVVlsB90RP9nWbWfQQRf5B/jpgaA1Q9EfhEKM6lJIkbGZcu7PpXQpjIFw5FBt2pbsp/ MOoSSA4Ia9EScAPP1GzU9Z/ZQQucRFdEcK1J7IinCMg7xBNHzYM+zhxh9/8+JGCxjva2x2nAoCRtc /jXC9gicBp3dw18FSq1x+PVYM/uSyKZyRhIEi86XF4FPTwvQg4pS+RVuHw79vZX329QreecldYuvL XgVsFKXu2B19byXqlKObQtsOc9NysNwyvK+OIp8FWlGn58YTS0dBRTNV0sUd2V4lcvAVAxYH2RH2k wQndRV7A==; To: Jens Axboe Date: Fri, 15 Apr 2022 06:52:44 +0200 Message-id: <20220415045258.199825-14-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220415045258.199825-1-hch@lst.de> References: <20220415045258.199825-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10317 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 phishscore=0 impostorscore=0 suspectscore=0 malwarescore=0 clxscore=267 lowpriorityscore=0 priorityscore=264 mlxscore=0 adultscore=0 mlxlogscore=761 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204150029 Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 13/27] block: add a bdev_fua helper X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christoph Hellwig via Ocfs2-devel Reply-to: Christoph Hellwig Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-ServerName: bombadil.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: MXVPZDLW8KeFATKao2gxkW2DyzkbVCIp X-Proofpoint-GUID: MXVPZDLW8KeFATKao2gxkW2DyzkbVCIp Reporting-Meta: AAFomgJZ4DbE0jTlh+UyhWKHwOqbji2A/911JkcNY9g52CWEyJbHf0jBaXSfZC2u Og5h+qe0RVQNHopTfTQEfTvp3NqxlOzkm2cPhtbwGzf3DN1bERwdaoVC3ZklbmEH hdjz2AE98C7vvo17nBeyjqKb9qhQfUgj/8KP4gKN5zJhAh65cWICpT/LN3F4Y3TE G2sahV0Roa4+gmeYIYrdhv7OOnIEhQJvG/uk/9H6Te5W4WXkGh/6rJQQaAF3jTOm r+ZvbFk11xpUUK5JXPZDjSIE/6m55CCYvvF41v4gG7fJppA5DqwuuEnQi+dY/6uV EXGcHrARWjHHbwZ1UN5wPJhYm5ui/dbk5JjuwHYYXDlrdVHzdXhOqZux89HHDVtX ij9YUHzeQ0nT1fbE0DIetIYAmwaZekThstB8lmNcaQ8zEOV9ry2DhaO/eQo2bLMX Hk87gAm12HGEep0rl4giGH5G1gubkW9hVdcwSH/YVx6lb8U3/pshA341XYMkd0g8 RAjVRaQRS9PNZBMFs8v8NZpEVJcKDaThHkKcLpVAFoKe9A== Add a helper to check the FUA flag based on the block_device instead of having to poke into the block layer internal request_queue. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- drivers/block/rnbd/rnbd-srv.c | 3 +-- drivers/target/target_core_iblock.c | 3 +-- fs/iomap/direct-io.c | 3 +-- include/linux/blkdev.h | 6 +++++- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c index f8cc3c5fecb4b..beaef43a67b9d 100644 --- a/drivers/block/rnbd/rnbd-srv.c +++ b/drivers/block/rnbd/rnbd-srv.c @@ -533,7 +533,6 @@ static void rnbd_srv_fill_msg_open_rsp(struct rnbd_msg_open_rsp *rsp, struct rnbd_srv_sess_dev *sess_dev) { struct rnbd_dev *rnbd_dev = sess_dev->rnbd_dev; - struct request_queue *q = bdev_get_queue(rnbd_dev->bdev); rsp->hdr.type = cpu_to_le16(RNBD_MSG_OPEN_RSP); rsp->device_id = @@ -560,7 +559,7 @@ static void rnbd_srv_fill_msg_open_rsp(struct rnbd_msg_open_rsp *rsp, rsp->cache_policy = 0; if (bdev_write_cache(rnbd_dev->bdev)) rsp->cache_policy |= RNBD_WRITEBACK; - if (blk_queue_fua(q)) + if (bdev_fua(rnbd_dev->bdev)) rsp->cache_policy |= RNBD_FUA; } diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 03013e85ffc03..c4a903b8a47fc 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -727,14 +727,13 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, if (data_direction == DMA_TO_DEVICE) { struct iblock_dev *ib_dev = IBLOCK_DEV(dev); - struct request_queue *q = bdev_get_queue(ib_dev->ibd_bd); /* * Force writethrough using REQ_FUA if a volatile write cache * is not enabled, or if initiator set the Force Unit Access bit. */ opf = REQ_OP_WRITE; miter_dir = SG_MITER_TO_SG; - if (test_bit(QUEUE_FLAG_FUA, &q->queue_flags)) { + if (bdev_fua(ib_dev->ibd_bd)) { if (cmd->se_cmd_flags & SCF_FUA) opf |= REQ_FUA; else if (!bdev_write_cache(ib_dev->ibd_bd)) diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index b08f5dc31780d..62da020d02a11 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -265,8 +265,7 @@ static loff_t iomap_dio_bio_iter(const struct iomap_iter *iter, * cache flushes on IO completion. */ if (!(iomap->flags & (IOMAP_F_SHARED|IOMAP_F_DIRTY)) && - (dio->flags & IOMAP_DIO_WRITE_FUA) && - blk_queue_fua(bdev_get_queue(iomap->bdev))) + (dio->flags & IOMAP_DIO_WRITE_FUA) && bdev_fua(iomap->bdev)) use_fua = true; } diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 807a49aa5a27a..075b16d4560e7 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -602,7 +602,6 @@ bool blk_queue_flag_test_and_set(unsigned int flag, struct request_queue *q); REQ_FAILFAST_DRIVER)) #define blk_queue_quiesced(q) test_bit(QUEUE_FLAG_QUIESCED, &(q)->queue_flags) #define blk_queue_pm_only(q) atomic_read(&(q)->pm_only) -#define blk_queue_fua(q) test_bit(QUEUE_FLAG_FUA, &(q)->queue_flags) #define blk_queue_registered(q) test_bit(QUEUE_FLAG_REGISTERED, &(q)->queue_flags) #define blk_queue_nowait(q) test_bit(QUEUE_FLAG_NOWAIT, &(q)->queue_flags) @@ -1336,6 +1335,11 @@ static inline bool bdev_write_cache(struct block_device *bdev) return test_bit(QUEUE_FLAG_WC, &bdev_get_queue(bdev)->queue_flags); } +static inline bool bdev_fua(struct block_device *bdev) +{ + return test_bit(QUEUE_FLAG_FUA, &bdev_get_queue(bdev)->queue_flags); +} + static inline enum blk_zoned_model bdev_zoned_model(struct block_device *bdev) { struct request_queue *q = bdev_get_queue(bdev); From patchwork Fri Apr 15 04:52:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12814516 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc245.phx1.oracleemaildelivery.com (aib29ajc245.phx1.oracleemaildelivery.com [192.29.103.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 73E0BC4707A for ; Fri, 15 Apr 2022 04:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=cFZFHy2P1yEByFwgaUITjjO2DIQYosKuMDJLZz0CSPc=; b=IokYRnu0x2bNtBzIoweT6RjPs5v8ikVo9vCE82sYS4EpuMEbIpKVU5KLysBSpp3NHR0Zph/cXOBn fT/gAkj8AWpMCU1TxEel+71Zy9umbXTDLV1xv2NXdTRVE79UibX+kheKBudupoiV9PeRKKe0VVCw UUDZ35LkKvU+l4T/EYg3BIkGRxv7gFBhtiYOBz/6tnEMpAOWpuMkWkh5neaVWNwXyNzkc/KpcJwz OwcR0Eo7sL1xJcVdoms5g9Cb/SQE6LnIbJrgiYW0j4TZyFRVJIIdaiO9rFvkKZ811G26sJm1UTPy wvVFAfv0c4POvQMtjkmx0f93T2Cr8fhM7sxVZg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=cFZFHy2P1yEByFwgaUITjjO2DIQYosKuMDJLZz0CSPc=; b=pN9ZKC0dfqrXi5RpZS6e871h/kL+p5gWpXUG5kasKMLzYV++ejbEC9gSsSsOc277CEryPagf/D4Q VnJ80hE+Bu+tIVIjku/qFp3r2R7CwRWKbiQvTUCsBMTOnBAlQHSisp6PKFH5U6Ami86KDzDKPkIC gUuhAU5UDRh81Xe7atHZZpOuKtWBvvlnYQ9Ibk1KchrFvuYe6SB0Ks38xR50fjI1e6XUJ6D+/dY+ 3wqN3e8H1bgUxT3LInd3VJKY+boepmEnqqMaL7LTIO/hozKyT1hCCR6ttvrJGcfd6bSIxeVK0Igm +BJigaZqaAkZvyFMSekYESU9iEtody9tLHT0cg== Received: by omta-ad1-fd1-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RAD0030X6Z20WG0@omta-ad1-fd1-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Fri, 15 Apr 2022 04:54:38 +0000 (GMT) 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=2RG8/4DncVNJBVxiwRZlDWFw3of1TwdfVdHLgkB+Spw=; b=TPuJfqXQYB+IC35ZbEz9CiQlaP djXIx0VTkzhzaYzpf2LZ0DDooPinTXguiju0AYCGSu3XAhEA+wzVismYaoX+3FR9eNAg3biu1OIj0 CNWcQrqG9KwJqTbS05bqC74Hcp5G8fJ5Dpqbc41a5wovtXyrz6AnrzdO6HJSlv+co9m5WLmUX5I/2 1vg6dJgX8fRkFI9MMSOkSfnCdkNwHb1kqsdqtSSukL34iYYeRnM6jabi2m1nx/iB0bJqJyAfSKPi1 QfdCggnyqMztz/KBp1d+dGH+Q0SMobP0ybTMhNnUN2Xr4FneN5Nr0VM4ULPM98M5hdJ71ysDrIM3k XuXkKxgg==; To: Jens Axboe Date: Fri, 15 Apr 2022 06:52:45 +0200 Message-id: <20220415045258.199825-15-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220415045258.199825-1-hch@lst.de> References: <20220415045258.199825-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10317 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 phishscore=0 impostorscore=0 suspectscore=0 malwarescore=0 clxscore=225 lowpriorityscore=0 priorityscore=143 mlxscore=0 adultscore=0 mlxlogscore=801 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204150029 Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 14/27] block: add a bdev_stable_writes helper X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christoph Hellwig via Ocfs2-devel Reply-to: Christoph Hellwig Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-ServerName: bombadil.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: NWfDYFj5zuGXbzMDtMpO409FxrWcPGRu X-Proofpoint-GUID: NWfDYFj5zuGXbzMDtMpO409FxrWcPGRu Reporting-Meta: AAGMgYTWCWlNdD649jUFdGZ9NlMto9M1/jU1tpHg9+qqgKkwmdb6x4o4RKbvH5Wg laJGV2b2h0KDzwYWWogNbbn3q/l4vLmgQ3IHV4v0dA0HS51So2CDBx6v4nGKm+nf wkDarqy+TaECxLkfnjg26LJGHoRpSX2qe3fxAiTiTuV16WDMe9comsQo2jysyzs5 kcB1yi8+W8HW4q2ha7wrhE1j4/YZMpjQhm4ZsFNWuEWGIkRcDik9oR49ADrthI3h B5figsn7rw4mKi4/Fzp9LNxaupbCIh1Fk0pWozkQ1kq/v9KWZZdJjznfI0ThnNpM 25KA55NKBzyRYg3RTlZxiXYFWICWmmX3JAjuBkrsZQ/OcbkCNXfq8GEfpQCo9gnS K54TClsrdAm08k0DDQlpxXYkaPI/JbMUgieLkRl7gAxjeqbgJXyFfQy4jjlDFp42 Rr6jwwUJ1M6yapoPnAeumUpJtCW4R5AEWrnU54f9UjuGMlreWLF2OHTvhOw+z5/k SVa7F202SHfRAjk6PDKouEA8hsMtYsKRE9K2+8hYZYunwQ== Add a helper to check the stable writes flag based on the block_device instead of having to poke into the block layer internal request_queue. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- drivers/md/dm-table.c | 4 +--- fs/super.c | 2 +- include/linux/blkdev.h | 6 ++++++ mm/swapfile.c | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 5e38d0dd009d5..d46839faa0ca5 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -1950,9 +1950,7 @@ static int device_requires_stable_pages(struct dm_target *ti, struct dm_dev *dev, sector_t start, sector_t len, void *data) { - struct request_queue *q = bdev_get_queue(dev->bdev); - - return blk_queue_stable_writes(q); + return bdev_stable_writes(dev->bdev); } int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, diff --git a/fs/super.c b/fs/super.c index f1d4a193602d6..60f57c7bc0a69 100644 --- a/fs/super.c +++ b/fs/super.c @@ -1204,7 +1204,7 @@ static int set_bdev_super(struct super_block *s, void *data) s->s_dev = s->s_bdev->bd_dev; s->s_bdi = bdi_get(s->s_bdev->bd_disk->bdi); - if (blk_queue_stable_writes(s->s_bdev->bd_disk->queue)) + if (bdev_stable_writes(s->s_bdev)) s->s_iflags |= SB_I_STABLE_WRITES; return 0; } diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 075b16d4560e7..a433798c3343e 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1330,6 +1330,12 @@ static inline bool bdev_nonrot(struct block_device *bdev) return blk_queue_nonrot(bdev_get_queue(bdev)); } +static inline bool bdev_stable_writes(struct block_device *bdev) +{ + return test_bit(QUEUE_FLAG_STABLE_WRITES, + &bdev_get_queue(bdev)->queue_flags); +} + static inline bool bdev_write_cache(struct block_device *bdev) { return test_bit(QUEUE_FLAG_WC, &bdev_get_queue(bdev)->queue_flags); diff --git a/mm/swapfile.c b/mm/swapfile.c index d5ab7ec4d92ca..4069f17a82c8e 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3065,7 +3065,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) goto bad_swap_unlock_inode; } - if (p->bdev && blk_queue_stable_writes(p->bdev->bd_disk->queue)) + if (p->bdev && bdev_stable_writes(p->bdev)) p->flags |= SWP_STABLE_WRITES; if (p->bdev && p->bdev->bd_disk->fops->rw_page) From patchwork Fri Apr 15 04:52:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12814506 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc249.phx1.oracleemaildelivery.com (aib29ajc249.phx1.oracleemaildelivery.com [192.29.103.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 85842C4167E for ; Fri, 15 Apr 2022 04:54:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=4HrxbBKGAGQguG7bJJuOJASvTKxjd1X/2cJ7fGdyC9Y=; b=TvIDy0Gpj9BhRdgXHgaqpiNQWZyHM6YVGP2feyVXDIDtUHsIKXt5pPDj4kEzXrv6GN96s5kuq8QA shuEtaGmnttX2s3sU3/3DxgniCDmKnskoPm6ifHE21PBy8qYWVWwEkWF1jvNj2HtEUT5BZnOksDo UlYGMJ8jc/9bhUNwmy/oeVayR5uIc0/2uNBwfA2ADfYfjyf3FjwHBGN/YXzTMyjjOnh8CYXQ81AM iuqr2z+JIaKrds6GA6VKayFP5ydKjnhk38mgp1kcuKcMH4ZPG3dGeVEu8Cp2nsyms0U+ZSmkwNff xhlvagAQyNuenr78p0xQ/5Jdty6JkwuoMeXM2A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=4HrxbBKGAGQguG7bJJuOJASvTKxjd1X/2cJ7fGdyC9Y=; b=uW1AjrP4l6tAEMIRakGe3PzEfIZGLtPN/f3taAQ6NaBNXeglk3sFav+ugdymir+EgJnIOxdKMOS4 TmZDMZU7VcHsjkQifgj7JYg72XsSaF8w/g9FWpJ/lcSruG+6SjNO6quhmNRHWV6CD0MoRxAPAiiC NsODQcLEyT0rvWQGinRaGAdkE1izu1/iAN0OL5L3Cxze4mjVNUaxrVSqbsFh8IraQxO3HXCn03uU /ztjtmCuM4fOCbqwKFvUyVx6lMZhUvdWFwpQUt+xQo5c6OXZS9fc37I0Q5cQniPDJZ57PYCuclEh TADAclsDlDjz67DBDHLHC7qRXy92fAGkvVQ3bQ== Received: by omta-ad2-fd1-202-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RAD00MQY6YTGWB0@omta-ad2-fd1-202-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Fri, 15 Apr 2022 04:54:29 +0000 (GMT) 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=V+N3WPhcjqbqmVRPAoIxuBjo6dgh1f5KuPVQDpaEGEs=; b=nvLDGsPTiAetPju9xhjyf64KX7 7ozMCWWCzv+ARhNAuWIGIewpeBs3t3aim/vmyIsXxJJQ8D6e6M3a/IJbXoQcPtzLYF8SFlKXBpOqM ETxPrnhTBR4f07V6gtDeEqdGfb51nKXQBTRpYPNUhpzcsR3DXwU2yZKBDkC9971ryVgupM8yHNByX XVPHLYl9bzyBrPwqQLBM+QwlQjI8z/UzTo262uc5gVNBSBEUT1iHLOtxrGXvyRuwX4DfSfPrfgzSz mZOGRfCY5mWiQtABTIuaX0+Vh6+ub+qekGvIjW8PCF25qEYReZ47iYhf1WPmN6PzqNTyFHnP9LWNJ HQK2650A==; To: Jens Axboe Date: Fri, 15 Apr 2022 06:52:47 +0200 Message-id: <20220415045258.199825-17-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220415045258.199825-1-hch@lst.de> References: <20220415045258.199825-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 127.0.0.1 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10317 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 impostorscore=0 lowpriorityscore=0 phishscore=0 priorityscore=126 adultscore=0 mlxlogscore=999 bulkscore=0 clxscore=225 malwarescore=0 mlxscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204150029 Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 16/27] block: use bdev_alignment_offset in part_alignment_offset_show X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christoph Hellwig via Ocfs2-devel Reply-to: Christoph Hellwig Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-ServerName: localhost X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: GlMI26_GLkjWkumDoA4FNRzjm5HZ38Aa X-Proofpoint-GUID: GlMI26_GLkjWkumDoA4FNRzjm5HZ38Aa Reporting-Meta: AAH+kgVZA0vYewW9kyiGXo4CGCW5cP4gge7qpYD6fzmuR/LclAi2i55MGlqe1tRD pb8XRffJeZ7lspVJEQ/YcN55TerMEgeiGI9F7JX8YE98WmP08Ik2Qwq6itjX9RME fzeSRAbsgPNqgXw6cK67y5tIu7RUuWJfOD73UAXUG1EvBC7autynRNaZ6fmSkHXR 9mwsT3/9RdUIqdAWLrJCF4KFT1x1uXiijx0qK5LmuMo4IAnbQ3LuCoSpq534PMhN OzuDCBwj8bbqsFHPyeSKNPFd/2trxaOFFbiL1a8x5IPC4zmjfP1tMpu3nNrriQvI 5N9bA3qpI721/W2sFgERkKbWzg16g+LN9z4piGhpjg1rc8rAWXXMrSm7tyRxwc7q d7A0afQ67WnD0vg81xz6LmBoKkkSANdE14qDQh83bO76ItMRCdBRyxIMBJSLBEhf aJlO/pTiOG66m5eA1tLHiQ+p/fO/mYM5BnYwg42vVi3BohX4BJJHFKiQh91qcDRl yaCiHg/aqOiqsFomsZHSrv8BTylUvIDmvAL36xUi/BwH Replace the open coded offset calculation with the proper helper. This is an ABI change in that the -1 for a misaligned partition is properly propagated, which can be considered a bug fix and matches what is done on the whole device. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- block/partitions/core.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/block/partitions/core.c b/block/partitions/core.c index 2ef8dfa1e5c85..240b3fff521e4 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -200,11 +200,7 @@ static ssize_t part_ro_show(struct device *dev, static ssize_t part_alignment_offset_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct block_device *bdev = dev_to_bdev(dev); - - return sprintf(buf, "%u\n", - queue_limit_alignment_offset(&bdev_get_queue(bdev)->limits, - bdev->bd_start_sect)); + return sprintf(buf, "%u\n", bdev_alignment_offset(dev_to_bdev(dev))); } static ssize_t part_discard_alignment_show(struct device *dev, From patchwork Fri Apr 15 04:52:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12814511 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc251.phx1.oracleemaildelivery.com (aib29ajc251.phx1.oracleemaildelivery.com [192.29.103.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B869C43219 for ; Fri, 15 Apr 2022 04:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=G1ccKrMxx35cTQFzgmiLaMjaByivctcqKqL7XVCZuZ8=; b=ns7qCoW4XfIbBn2ihLSDvtlzgGj1ZNRPf+GEV8vliRLDM53r3eUAj7+Pd2ZtzBEwWPNjj6YudYgr oZF2GpRkkbnOcrfdK4Ji5G53Kzk1jaJLnT10QrilRMxZCzzwAZcHjUtvC5RNSNW1XLr43Z+f4T85 bifwiN+BiJE0HApeKE4iDQtJ014PVQOYKo+QAOAFhvmMO83o3IyPJ2dQkb5eSjuYPYGRAxndo03P rfKRm+Ejt6d+uqr2hKriSQhB+sbI6o1WjxaNuC7dYDKvgFjZiLhLokOgpGCB3FXcfG6bXLIrkI69 PUvF6IGNOHsDf16E6yUX6JFWRHrelLs5jiYHkw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=G1ccKrMxx35cTQFzgmiLaMjaByivctcqKqL7XVCZuZ8=; b=FIArWuqOSYQmvVY8xzbF2gIhAo22CtNhSERCkKBfxfjjxRggHP09o/kZ3HydrxPwOfCQ8t3wuZ1l 9xdYduAsPWvA5kF9epVMKgbZfxcbyHyCb6VI36DhF6PFSxTgn5+9YN4deNEEhh46H5haPqfg5eot rIqJ38J4hZVrnLP77BHW7waGdQjE1+ihxvHcs6cmB6mzk9siNqLkG4LJ2d4WT9wbdRnsSbV9oElL l5xDN1hluNNhsFiNNF980ulDriwonedmmRVHZxQwqOGNAFVtofWdnuC/zwmwve2QgfInRYNUxhxn 85OFmxepitlP5io6hsj86q5b3ohlzEYaLclVzw== Received: by omta-ad2-fd3-202-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RAD00H0P6Z2KTA0@omta-ad2-fd3-202-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Fri, 15 Apr 2022 04:54:38 +0000 (GMT) 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=Imm4Yfj4lK8os56GTjHtESv8Ln /f/n//I9UVgO0gz0loVNZo7Kx8U2lN8GWuypT8815hL/Cbxkr3GIfFYT2oap2P7u27ZNlfV4ESUm3 nUKYekUTiCtdte0HtVU0mfHtnc1JSUCyagOIpbgNEzqbzUQNiwlEp8m5sb47dsYKebQL4R3A3Igsy dTbWNMbYDJIYjtYyj8uxb8rBDcOQ+bzOZSC1SBOJPEIu1iXFYJPGOni5DOCC7FW8wOycr+QifG/Wg MwWy7d+vMvWLfxa4iMbFhmkTIzHqao0ZRSaYQGzHa37lKAGUhFr/qfO/PDwSf9PSBl8O2KxhcHtX4 P2d5tlXw==; To: Jens Axboe Date: Fri, 15 Apr 2022 06:52:48 +0200 Message-id: <20220415045258.199825-18-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220415045258.199825-1-hch@lst.de> References: <20220415045258.199825-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10317 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 clxscore=220 bulkscore=0 phishscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=909 priorityscore=120 spamscore=0 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204150029 Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 17/27] block: use bdev_alignment_offset in disk_alignment_offset_show X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christoph Hellwig via Ocfs2-devel Reply-to: Christoph Hellwig Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-ServerName: bombadil.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: tS0wx3qk3-bMwBErTQa2xfEfptMv0E7_ X-Proofpoint-GUID: tS0wx3qk3-bMwBErTQa2xfEfptMv0E7_ Reporting-Meta: AAHubPBLBEdBMwcFxWjeXCkxAe4em2Ltg69laooP3SJu4VNHZydgzL8IZZLTc/Tp 4KG91DkOwT61+rjv636B9DD7ieTBlX2ltYKb7spwAwJohKDZH3l6VXchHTZA5V1q qF6qsv5mOjaSsrdvp+GkGPJEBmn3SAgbqz8XguiVq5u3bvBYOO89IdeXLIyARGQm CNPJxtPIe85NLVMre53bWlK0yupSViyULpIQrjrxAXRsBXeilIinFRWnqSmy5VNo P7vi1ckN8H9j2vUHIm1OcMLZmeX3mXGzbOsVS9F2a5ewP2wAsJ+76cYX4/23UayL gcj0AsM4I8FsfTpjrLzrzIxsnGLhfRLjM0NT05MCQIbKSW+i7yTUvg3+RY281bEB jedYBxf/UWUOPVjse5IYH46V/E8Bt17HPSjgiA9YRtMJDehXOe5An6qn+qlXSE6/ fR3UnINovAhvDmNrefW5ON1MtYncu1jcMUpdoZg8NrFOThbtCkANxwSqy0/WyUn0 iqjmzWdeAkB4dXFCyXxT3Kkr4itdzwOzAas2mE1DLGTV 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); From patchwork Fri Apr 15 04:52:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12814513 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc245.phx1.oracleemaildelivery.com (aib29ajc245.phx1.oracleemaildelivery.com [192.29.103.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BF304C41535 for ; Fri, 15 Apr 2022 04:54:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=sSjlXjg7KmkVW1i0AI0Q/zXrduiZUudWSBbrqF7bIHM=; b=npLRa6Lt+d9GFz1r2i2R/yHjzjU/BGmIBSWoPxLI3rBwfL9F9u6dVXFUK41ZzOIx6X2S6vG8juOe J+eMLZX+cGNaTyQ4xfvqHK5GR1ySNaP4xs3UcUNGGvhgh2BTKa+bryQ0q97VcDL6914f2GQqNaLr Kfx8kc0MaBLt8NZNr8IDNAWm8XWp5dYwRbaaoSOr5WmAmsV/FGhiWDSzEDnWbKRB0vPqv9X8fYMr AvdvIubN7rVrtDzD4mf/0ivXkKklY75vSfv8JO12t3vdR94WFOn69GX88EYlkEUEZ+MK8ndF2mS8 ao0EHz0W0e8duIn60HZrb+5XM3H6Msa1K6UhdA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=sSjlXjg7KmkVW1i0AI0Q/zXrduiZUudWSBbrqF7bIHM=; b=b7q5mUc/VljCWxzRgKJcf5ji9pT9Hjc0tOt3o5ZHQVuJTbGP7rFH4iDjM7AoL1TXntnX55lI5XBr BDLc+9PvHGaC7vLELPMXn6bJJctGdKhYteAwbQ/oTbbVSWGyA0ALGnUwF6clgcgT6W4r8peELgKJ 8GAGEQnKKzkv2eWdSzwgc1r7QAB1biZ2LlHvgIYhHEC7ZZnRNX0U8CLcaCZrAIcMN72IvwACh4xQ TJlNTuVq8OxcZsPQ3bQCboEfVgbeSMP64L/Ni/tx0m+VBpNsOQHwZqPnLt3bumsFzqxPR4UUdhbt BynXZswr2GAVj0RXGBR4O6MgxOt1x6VvvhwvTA== Received: by omta-ad1-fd1-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RAD003R56Z4OHF0@omta-ad1-fd1-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Fri, 15 Apr 2022 04:54:40 +0000 (GMT) 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=LA03+v2RMrt5LLwAfTBpcNFXpYhSXKyM/LEXrkZN1Tc=; b=LADyBsuLQpSvZVOI9iNu3zFf2Z SEH5za8/XrvPRuwh4TwHe7OlvnSu6j9qkRRGGecLPPLsoWIvS7KxzQE5AizDIz9MvjgfVsuNp13Eq ZByoLLOiZSAgO2FmaZjLKmy35f7AqZ0bRkQXyFt0KFpuATixmIymK5iv+aV8uMY/BiO9z1ISlyebq wDQWs1lYdYUlF31lbm99N6Kdbl82pDjKi5m2oYGDMZ/ESoukEtgyT6rpjPpocnNkNMxqHhSPxrha3 uTQvCNZSoso625zW5i+ex0gK0vrdhQ8qDshZOw3gMwuVl8MKqYXFvH6egXHkAdYDBWWCkoyT5Gevx A5jRU7mg==; To: Jens Axboe Date: Fri, 15 Apr 2022 06:52:49 +0200 Message-id: <20220415045258.199825-19-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220415045258.199825-1-hch@lst.de> References: <20220415045258.199825-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 127.0.0.1 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10317 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 clxscore=229 mlxlogscore=999 impostorscore=0 priorityscore=156 mlxscore=0 adultscore=0 bulkscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204150029 Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 18/27] block: move bdev_alignment_offset and queue_limit_alignment_offset out of line X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christoph Hellwig via Ocfs2-devel Reply-to: Christoph Hellwig Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-ServerName: localhost X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: sglBcUNvAZ78WArYw49R8pWkcXikg2Dz X-Proofpoint-GUID: sglBcUNvAZ78WArYw49R8pWkcXikg2Dz Reporting-Meta: AAHKeIfm/+AiVKvx5RFUVy7DTxiNUAeOvGhGjKn6X5de4dESgmMy/PsmArzAvPMj k9S/s/nWN4AL9YrcfLfWvSgT/95QBdn5Zh3JNV7J7ifeI0RTHATkbuneghgSx6Qv ENBnY4qQ9fjDnEVuqeY9laGwS4/Pne+du0KGsciVhQ+BG7YEINzKCEV/mczUfpfI p4TisTVYsNhcmIHhg/lWbi7bNhcsDUX8+ECRNZqAmB3vp0Mte2+pV3SG06l2zIAL JpPULL8FjIj8NCMhYsaNk9CWPsbgZhqF8i2cbPLlfNwjF/mlzSH8JpNr3i2CpP9J AaJDQvne1TnMZ+FQiqzuZJIXx7VwgHFIAI3W+/EkNCfTBKcFbkO7ptWOThAbBP4v Zds15pe+voq832rVvzPKaKCVLONDOdD2wLY1wKURw6XG0RkEpH1J0611gqZrzb2U Dzr6uZ/riyVDfXYW/rTLwwjgzMTad47WTHaZdN8K3Uvt49zsF40rX95u2jw+e41q zCNQkg0NbU9UddYa3kl/04amHxf9yxFHz0kcery0UrdLFQ== No need to inline these fairly larger helpers. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- block/blk-settings.c | 23 +++++++++++++++++++++++ include/linux/blkdev.h | 21 +-------------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/block/blk-settings.c b/block/blk-settings.c index b83df3d2eebca..94410a13c0dee 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -468,6 +468,16 @@ void blk_queue_io_opt(struct request_queue *q, unsigned int opt) } EXPORT_SYMBOL(blk_queue_io_opt); +static int queue_limit_alignment_offset(struct queue_limits *lim, + sector_t sector) +{ + unsigned int granularity = max(lim->physical_block_size, lim->io_min); + unsigned int alignment = sector_div(sector, granularity >> SECTOR_SHIFT) + << SECTOR_SHIFT; + + return (granularity + lim->alignment_offset - alignment) % granularity; +} + static unsigned int blk_round_down_sectors(unsigned int sectors, unsigned int lbs) { sectors = round_down(sectors, lbs >> SECTOR_SHIFT); @@ -901,3 +911,16 @@ void blk_queue_set_zoned(struct gendisk *disk, enum blk_zoned_model model) } } EXPORT_SYMBOL_GPL(blk_queue_set_zoned); + +int bdev_alignment_offset(struct block_device *bdev) +{ + struct request_queue *q = bdev_get_queue(bdev); + + if (q->limits.misaligned) + return -1; + if (bdev_is_partition(bdev)) + return queue_limit_alignment_offset(&q->limits, + bdev->bd_start_sect); + return q->limits.alignment_offset; +} +EXPORT_SYMBOL_GPL(bdev_alignment_offset); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index d5346e72e3645..0a1795ac26275 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1251,26 +1251,7 @@ bdev_zone_write_granularity(struct block_device *bdev) return queue_zone_write_granularity(bdev_get_queue(bdev)); } -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); - unsigned int alignment = sector_div(sector, granularity >> SECTOR_SHIFT) - << SECTOR_SHIFT; - - return (granularity + lim->alignment_offset - alignment) % granularity; -} - -static inline int bdev_alignment_offset(struct block_device *bdev) -{ - struct request_queue *q = bdev_get_queue(bdev); - - if (q->limits.misaligned) - return -1; - if (bdev_is_partition(bdev)) - return queue_limit_alignment_offset(&q->limits, - bdev->bd_start_sect); - return q->limits.alignment_offset; -} +int bdev_alignment_offset(struct block_device *bdev); static inline int queue_discard_alignment(const struct request_queue *q) { From patchwork Fri Apr 15 04:52:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12814510 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc250.phx1.oracleemaildelivery.com (aib29ajc250.phx1.oracleemaildelivery.com [192.29.103.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B6BC6C38161 for ; Fri, 15 Apr 2022 04:54:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=ZvFeJ4GbHJiAwyOuGgryPoGIKtnFMKRVGiS8xiTT7TM=; b=rbu6ZQGfW0XsnO2TCerw/Turvw2NP9Pa/5Pj5O1zspaQsh6LPmKYSlkV5SgabXw82G6ATGYKQVKi VY+qHwwTpWe4fRDXPY+ynQB2WZ+4ysuha1wARPyUGJGhgZeSMtX1IdN3STnR9fi9O9Sqx0rKFjw7 r3MAbSw0kvnsNaFQjIOKkzl1TYJc8sZGs8xhddXDi249Ngy4L1N8n/5JgD3pwjjisy1joidUL7cy h9PKAIg+ioKacgjoW+Apj5qoM37cNtHHn649IWnx25BL6wA46h6aAj1XhJRzC8jeaUHT37ygXJXh X62kLWAmDHsDI2fECum2ePu/EfU7H10dKs/aEw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=ZvFeJ4GbHJiAwyOuGgryPoGIKtnFMKRVGiS8xiTT7TM=; b=QASV9QRtTo9EV7Bt/69mWgBadvNOrOxTUwpK2EIyNejb58GIQuHlhm9NYd6BhXftD59Qonqnfq/p V65xCid/PA+ruUIbW0cUeCtarPq/tP8+mlGqEf0hlPe4FyKLV31HJb0SIslY+El7ktv7jMIbbDTK d3tU8G8bCoTk5rIDwIL9X9F/JVdWnVaX/CCevzHsKMH7UXruxADh2ir4LoRiCL9sT0dSxgYJYUkP aMHaZU7acSA2SmkP9Q+MTn7fVBfyv7LJGQcKNjI5pKzYiIa7rr5NEQkMz5paQ6TLjRxrmY8H4Spp hkwlTgCuoIYcD+bb4q9tmL0uOaRbfP86pP9gFw== Received: by omta-ad2-fd3-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RAD002KX6Z2H560@omta-ad2-fd3-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Fri, 15 Apr 2022 04:54:38 +0000 (GMT) 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=J+DlKJplDF1Q+uvJsRC9/x84m39e7OAPqS6lbIf59go=; b=SEeH/79eKPqdW8SzrNl3V2nOHl ZWhXxUOKMmxbomD4h47qxDHhmZR1AcrilsdsHynv3whZecHSbjPQD1q9d/FU6+E8K/5xf+VTFPZEC yjptUXDEOozEKnhNef4pA/iH+U6X5UT2a4kDQV1dcB4OMBiR7EqjwvZGUpUqzaw/ctS1BK7jfj0ET 6bEbZ634DG1jUBSD4gMSefXlbHX9s1oVYHaM3eb8uWhP4KXYOa4yPkTPaEVS3k17D/+asg++w51Tw tL9Bw3UnRO/ROF9NNLI3S4GrxiqTSBVA9Nyw52Y9tkIfGW9lfoR4Uoz9tWbp7jnXJX8faoVQRTg4x Z/Iw+o9w==; To: Jens Axboe Date: Fri, 15 Apr 2022 06:52:50 +0200 Message-id: <20220415045258.199825-20-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220415045258.199825-1-hch@lst.de> References: <20220415045258.199825-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 127.0.0.1 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10317 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 impostorscore=0 lowpriorityscore=0 phishscore=0 priorityscore=256 adultscore=0 mlxlogscore=999 bulkscore=0 clxscore=247 malwarescore=0 mlxscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204150029 Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 19/27] block: remove queue_discard_alignment X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christoph Hellwig via Ocfs2-devel Reply-to: Christoph Hellwig Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-ServerName: localhost X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: XQKQaSG3gKLTXOKw-Vko0u0HEgjFlCzv X-Proofpoint-GUID: XQKQaSG3gKLTXOKw-Vko0u0HEgjFlCzv Reporting-Meta: AAG+S/XNNmQGZHkcv4NFa7HZil/q/KEs/JbbmTjs4A/Phf96O8XZXq60q55M3YDu uC5rTMunGyPO3vSnSS4sBNQMjY7rbC2lF5TNwY8CYVI1i0EXTL/LdZ1JV/GicC3Y 7Aggn8x16gpmF6cRASwCWNxT7WUPyqjGXq95MwEJdxUItsBAZ4PCGEsMaoNwlSYB 6i5GPpOd9obviWkHQ0U7x5Hy0gkcsiqXKfAHWSWMniHcUtp82IW0+QGqt8RtKZXq NmJ8UGJCC7OIX/CCmev0NafyVKZWGaZ/M5K8ZmmXm55SvWqR9Z0W+f0RtRXdRNKg wWc+hqKghOZ3Pnrz6012F2sjKBWCx9HZv3wHCZU6MKLOr4FlnpeJHf/ZBjul0cRe jpCm0371Qxk+0zeYy9qvbbjDefAISvgcfuwPHOB4VyobGy/pBbyLxBTJYl/brGZC JsUS6F4Xc0rKEU7eg6Aq9Q/1iCvRSRLftbQKJE5j2UPc79GtZY+kMq5x4SKyrY7U E8+LAd0JRu6EbAxu8PtdFr0S6jT9clGRBLjCIFvmZp6T+g== Just use bdev_alignment_offset in disk_discard_alignment_show instead. That helpers is the same except for an always false branch that doesn't matter in this slow path. 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 712031ce19070..36532b9318419 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -1019,7 +1019,7 @@ static ssize_t disk_discard_alignment_show(struct device *dev, { struct gendisk *disk = dev_to_disk(dev); - return sprintf(buf, "%d\n", queue_discard_alignment(disk->queue)); + return sprintf(buf, "%d\n", bdev_alignment_offset(disk->part0)); } static ssize_t diskseq_show(struct device *dev, diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 0a1795ac26275..5a9b7aeda010b 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1253,14 +1253,6 @@ bdev_zone_write_granularity(struct block_device *bdev) int bdev_alignment_offset(struct block_device *bdev); -static inline int queue_discard_alignment(const struct request_queue *q) -{ - if (q->limits.discard_misaligned) - return -1; - - return q->limits.discard_alignment; -} - static inline int queue_limit_discard_alignment(struct queue_limits *lim, sector_t sector) { unsigned int alignment, granularity, offset; From patchwork Fri Apr 15 04:52:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12814515 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc248.phx1.oracleemaildelivery.com (aib29ajc248.phx1.oracleemaildelivery.com [192.29.103.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A25D2C38A02 for ; Fri, 15 Apr 2022 04:54:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=EhzRMAliWQfAp1Rh6krPu4+eAG1WRlU9Bdv6/WRPHMQ=; b=aTINCrbJ2KN+Noc72jvLspPHV23NHseyA4rlZlhiGiXG3sV9AMlfV9EEakazsDBBsW8VJ8s80pj0 MAvSmQTazuuNJcvTDfup12TcKH0hiS86h/kBrTsPsvJHVr3WUxBecUXdX36Cj1tXsp15D/uEbBnY Uy/o1cOkCJj+lV+eOixW5IAcwTZw1mIksCIx9TMG9dtnwTy2uBEtzFmcYFNaWxYhrMC3sM+rMJL7 xAgtejq3Xc0VtSLEZxAj2WwC1u25C6a17/Zd5nRI+y2U8P3jMhSvW7S4h9rKdXsjfX4g/26/TFJW ptj2WPpLw3Iut7V81stD/IguKudnrorcvQA/Pg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=EhzRMAliWQfAp1Rh6krPu4+eAG1WRlU9Bdv6/WRPHMQ=; b=HkcRaGPraKHzely7xfP6ncCq3+/GZC6Bwn6p8UVWiWAeO2LLeCK9wTsOf+niEEGYTLL3lQdyhCs5 rOttsGoXkhklRD0mlRgIQNiYddPU3dgCMRUGoxUvRksIdmulWvVBe1gVLqKk0h4vNQxlQatGzuUH mslocOoFJdkcrPjeaG0SCSY5dJJblEBPiI2S9sb4YA5B3YXQhi5msiDSHqHA/BYck2lUaiU8+REl CodH05c98VmmuXt1ka6VcZ92DoE5EGmxAnwTt/xxjfcKsVGl0mBCdkCdhLeSjBZZjKatdNRaQsz3 yFLga9V2WazXSgoFtrsnB1i+IdeEdc2X5YvF+Q== Received: by omta-ad2-fd1-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RAD0042Y6Z3Q400@omta-ad2-fd1-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Fri, 15 Apr 2022 04:54:39 +0000 (GMT) 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=A3F4pzgWH2QQ0wtpIeTWEbWkE7zvp2Hf2SzUvBBV6uI=; b=2blFxPm6xz5pgZn6E5jvsGqhvn 2WDz/E43ISZl4v/rhlHMaqtSb4lVbmKeEW11/ljs0aiEkq0TnWEDxeJnrojcMAcOqNB8N3gDxJnoZ 0NRetUsPJHvzddTt7lmgpHndIYp7bFipN2chfdRidmHIR3lH3yyIVmQny7lS+2WzaIVhTRY61ZPLW cNdIp932vWgZbDLAr3bVHO1tMLGx1FOnjxoa9UVQZYEIwSKlwU7ByTf62px4tvbNkH8lyOAfKg6eV fvQs7AcyDRrAWF5ZnpqPRd0RsttREedP1tYS6zdjKYykJ8LivF4bs1Leq71tf07T70LHtI3i4RcFf TuAsL+Kw==; To: Jens Axboe Date: Fri, 15 Apr 2022 06:52:51 +0200 Message-id: <20220415045258.199825-21-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220415045258.199825-1-hch@lst.de> References: <20220415045258.199825-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10317 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 priorityscore=181 mlxscore=0 malwarescore=0 mlxlogscore=873 bulkscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 clxscore=224 adultscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204150029 Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 20/27] block: use bdev_discard_alignment in part_discard_alignment_show X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christoph Hellwig via Ocfs2-devel Reply-to: Christoph Hellwig Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-ServerName: bombadil.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: HnmTObvivFFQfni0icFcD9W38ZQzBFGb X-Proofpoint-GUID: HnmTObvivFFQfni0icFcD9W38ZQzBFGb Reporting-Meta: AAE0IoEmOF0ubqBkHjr2JUX5XcnRIUrhFYEtK6E7dqOzAJKjwXAWlIYqeA07I7s1 NVYR8gD4khEmNXifJWsZBeCEb2pTweEA+x7E9ww2DAcLm2B9z4PJ44HxYLvEym0e K9ljple8KKr6T5wfbhaRNZB6jhEz8i+wnI6R1XO5kH2KYmF90QBnR1yixJdHl623 q9vMXoSiABaiS1nX4IEg87UvKe2i7YbDxxjKAIwmuW+34S9bLlg6PWv0yhrD48b3 eLEii0v/pQVdAkaTzTLq1oYYi9yRs7VR5Yykh5HllrhIC5U6NdAQBN3Rl7tFcUJd Gfny5B3BKsPnQ3sthZru6F9HwS/S8PIguLM6UnkuKXqq4oOL6DISWXT8QZndZTii S3dBkFgylLEnmjkMxoKwy6z4UGprD6RKv0kbfVsNlu2kUh3SA/Z99zI4X3GG2A8i 5jjg4sPaiXJkksqlDPGvycpEccRnOqXuaLWpHRhI4RE+znJlzM9L1v5dCFkg1DJK iYLWMAzHmeVaHxX6g3wkMZqfwXdGnh746B8JI4UefveN Use the bdev based alignment helper instead of open coding it. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- block/partitions/core.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/block/partitions/core.c b/block/partitions/core.c index 240b3fff521e4..70dec1c78521d 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -206,11 +206,7 @@ static ssize_t part_alignment_offset_show(struct device *dev, static ssize_t part_discard_alignment_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct block_device *bdev = dev_to_bdev(dev); - - return sprintf(buf, "%u\n", - queue_limit_discard_alignment(&bdev_get_queue(bdev)->limits, - bdev->bd_start_sect)); + return sprintf(buf, "%u\n", bdev_discard_alignment(dev_to_bdev(dev))); } static DEVICE_ATTR(partition, 0444, part_partition_show, NULL); From patchwork Fri Apr 15 04:52:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12814514 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc252.phx1.oracleemaildelivery.com (aib29ajc252.phx1.oracleemaildelivery.com [192.29.103.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9242DC352A8 for ; Fri, 15 Apr 2022 04:54:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=DCK4VaRpGvRUDCF8GhBjD1BEFFVqBcsrtlrCNGu9fuM=; b=UM/YWKOKyPymPvilQPv8rPFFQWlWhjqZf4XIxqFfWeuLTQICZHH9SmZfuPAFYnLPVaOi9LGAJcWE OSBx/xJhD4ZSWcQDOx17RcoRUNmqUiYtJaGSfDT2Vs52PexRCWPRvTlLKyWH20kCQ1Dc5dJvxMSj grTbgwJOdW1dyh1X+APJLD2Bp1iG0tNrRFnxQBjsu37B/IisSxnI34eY9PsAmcuI2HIvxi4C0PcP YqVDCBm1bBg1+vPxmwFzF/mQa8SD0ZIbGAhlarwGHS/66TBkMj56daWB4XW+7kcyx65dv4h/ctCY x90QpxnXb7SOSqTzESmUgx92DN8LHApZOevmzw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=DCK4VaRpGvRUDCF8GhBjD1BEFFVqBcsrtlrCNGu9fuM=; b=u3YDReP4/k4Ngf96IjJ0iG2AavCZ0GyhyVXmgIdYusRSiPKQyE8s/1EaIy0ZDWwXcog4yBA1cdTL k5EJs1/cGrscPdjOfA4c0BchR1MnzUZq6KtAgOrwsBeF4DvOfY6Rl9fTny2K3uJFD9LKAyRDkSJm l6AUiZU4keCc+hnyu5KOk/wyxbNwL63IM0G12RAJsnWArtEgP2W4yyr5EfYOgWjxW3+tXczU31T8 4RJUm4D2NibS8Vu2XIhp/NsDVNtSKAwRJ9bF08ni5qkQr2mygd4EljQtfa5Dl0SV+yqJ/+IDiZih 2cTF8yFJGsFH7BjxMhEv+ujN+BlmIDeyocQRYQ== Received: by omta-ad3-fd1-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RAD005XG6Z40I10@omta-ad3-fd1-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Fri, 15 Apr 2022 04:54:40 +0000 (GMT) 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=6r328luNCDNaFOT33dRflffYOj2Ig+snh5CgwFTaxcw=; b=mNuFiFjSDLbldIX31eYOuSlRR9 8563S/h8LrxYIHowjJfVJZ76RAtIHUbU8W+hFh4MWU8WMYfdB6LyJh2COdvD/iZqFmSUWNE+zj3n8 TjDK1RADFF2jHuhjgFvsFPr2iNfo2ZxzGPd6/D7n8+r4+csvAbreOAgnv7mb2shTRUMZRApT5F90K NcXEn1pmSIjxsyXRt1Q5Fpafq+pdIcKs6RGb6uD0qSORONp8YiTBWhXw1jJiMd9DQ1XNtZR7AS8Rn LRWZ13064QQZdYqJpwxZzURW2pQw6Vjn+9nq/BjlV+QBzJ7qa6lBovEI7n8jqfejDLm+YrLORSOW6 48XX9zTw==; To: Jens Axboe Date: Fri, 15 Apr 2022 06:52:52 +0200 Message-id: <20220415045258.199825-22-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220415045258.199825-1-hch@lst.de> References: <20220415045258.199825-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 127.0.0.1 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10317 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 impostorscore=0 lowpriorityscore=0 phishscore=0 priorityscore=203 adultscore=0 mlxlogscore=999 bulkscore=0 clxscore=239 malwarescore=0 mlxscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204150029 Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 21/27] block: move {bdev, queue_limit}_discard_alignment out of line X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christoph Hellwig via Ocfs2-devel Reply-to: Christoph Hellwig Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-ServerName: localhost X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: CmzQEqltmX-XRAFufn50SsBi88_lToGb X-Proofpoint-GUID: CmzQEqltmX-XRAFufn50SsBi88_lToGb Reporting-Meta: AAH+kgVZA0vYewW9kyiGXo4CGCW5cP4gge7qpYD6fzmuR/LclAi2i55MGlqe1tRD pb8XRffJeZ7lspVJEQ8ucd55TerMEgeiGI/63ADCSwCeyYkApiLBF6f/jYNbW1wR 2HZUpgz7xYDQQnwtDXRW4FWEGYu+z1o0QMgGD5m75ygKPTNQxfS3ULOCYo8DuoGL cjVpDbMCePf7lfomjfeUXu3ieKh0jUCphEbvg9Mfcz14eyPIiWVCg+t3WgMK8o7t jBx4bLwYjN9UvaqCS1Gf5H6z4ZDFZiXDfRTsHbtjRmUwv0Z3GCvMllvTacxcIn3S hb2dsyiOjWuIau2vLhiBfSgG1mdLjj7Pqlr8COKXyBmbVUHQzgOmJp51B9u6vgCY jPN4ARJQhwDtXOl4mOncQriyC+U7lom20N4txZYljzKMsg3fpx1vvDgxsCF8ahOV 4nKrM/2YETixt4uHbija7y/D8/Uq2iQYA5QQ9X5aTkvrspmvjkfCILFEydza8K47 T0f9o0FpJV297UX8agOZQP+73KGUQNjo6+ieuI+aQ/zYOQ== No need to inline these fairly larger helpers. Also fix the return value to be unsigned, just like the field in struct queue_limits. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen --- block/blk-settings.c | 35 +++++++++++++++++++++++++++++++++++ include/linux/blkdev.h | 34 +--------------------------------- 2 files changed, 36 insertions(+), 33 deletions(-) diff --git a/block/blk-settings.c b/block/blk-settings.c index 94410a13c0dee..fd83d674afd0a 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -478,6 +478,30 @@ static int queue_limit_alignment_offset(struct queue_limits *lim, return (granularity + lim->alignment_offset - alignment) % granularity; } +static unsigned int queue_limit_discard_alignment(struct queue_limits *lim, + sector_t sector) +{ + unsigned int alignment, granularity, offset; + + if (!lim->max_discard_sectors) + return 0; + + /* Why are these in bytes, not sectors? */ + alignment = lim->discard_alignment >> SECTOR_SHIFT; + granularity = lim->discard_granularity >> SECTOR_SHIFT; + if (!granularity) + return 0; + + /* Offset of the partition start in 'granularity' sectors */ + offset = sector_div(sector, granularity); + + /* And why do we do this modulus *again* in blkdev_issue_discard()? */ + offset = (granularity + alignment - offset) % granularity; + + /* Turn it back into bytes, gaah */ + return offset << SECTOR_SHIFT; +} + static unsigned int blk_round_down_sectors(unsigned int sectors, unsigned int lbs) { sectors = round_down(sectors, lbs >> SECTOR_SHIFT); @@ -924,3 +948,14 @@ int bdev_alignment_offset(struct block_device *bdev) return q->limits.alignment_offset; } EXPORT_SYMBOL_GPL(bdev_alignment_offset); + +unsigned int bdev_discard_alignment(struct block_device *bdev) +{ + struct request_queue *q = bdev_get_queue(bdev); + + if (bdev_is_partition(bdev)) + return queue_limit_discard_alignment(&q->limits, + bdev->bd_start_sect); + return q->limits.discard_alignment; +} +EXPORT_SYMBOL_GPL(bdev_discard_alignment); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 5a9b7aeda010b..34b1cfd067421 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1252,39 +1252,7 @@ bdev_zone_write_granularity(struct block_device *bdev) } int bdev_alignment_offset(struct block_device *bdev); - -static inline int queue_limit_discard_alignment(struct queue_limits *lim, sector_t sector) -{ - unsigned int alignment, granularity, offset; - - if (!lim->max_discard_sectors) - return 0; - - /* Why are these in bytes, not sectors? */ - alignment = lim->discard_alignment >> SECTOR_SHIFT; - granularity = lim->discard_granularity >> SECTOR_SHIFT; - if (!granularity) - return 0; - - /* Offset of the partition start in 'granularity' sectors */ - offset = sector_div(sector, granularity); - - /* And why do we do this modulus *again* in blkdev_issue_discard()? */ - offset = (granularity + alignment - offset) % granularity; - - /* Turn it back into bytes, gaah */ - return offset << SECTOR_SHIFT; -} - -static inline int bdev_discard_alignment(struct block_device *bdev) -{ - struct request_queue *q = bdev_get_queue(bdev); - - if (bdev_is_partition(bdev)) - return queue_limit_discard_alignment(&q->limits, - bdev->bd_start_sect); - return q->limits.discard_alignment; -} +unsigned int bdev_discard_alignment(struct block_device *bdev); static inline unsigned int bdev_write_zeroes_sectors(struct block_device *bdev) { From patchwork Fri Apr 15 04:52:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12814517 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aib29ajc255.phx1.oracleemaildelivery.com (aib29ajc255.phx1.oracleemaildelivery.com [192.29.103.255]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D5CB8C3527D for ; Fri, 15 Apr 2022 04:54:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=PhDHsGMKQQqInfcK4NFKdoStLqrIw5x3XhmJbdsGIrk=; b=b7Q5RNjKYC0F0Bv9eP4x7uPXrbUiBoZteMrGCSJtZb2+36JfjRqVuaJKlQBWdCy31IVQCGDhpNPO JcQ/rQG7UXIBsRHoxz+LR8O6GyJmbUIvyNjYHyXnGdfyLXcSbthgNh1I4Aw+0P+TdWDHC3rR+r5p BEcFNrq2GVs9Wh4KG2qs8a1ZDaR64DxsTpxLy9yTSStake52A36r1HKi2fvgImpGFvfHmzUXaKLZ b6AX/RTxHgniqyR19C31kBDuUmNsOyXvqz+53I+trmVNEJqMSy0EvJqsWrLcbSKIVv9eLs3fhyP1 tzEmoIAY/CFFX+Yr3th0BwzPGJnp2NG9Bx+mgw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=PhDHsGMKQQqInfcK4NFKdoStLqrIw5x3XhmJbdsGIrk=; b=kv3G0Kpx29dSAJh2gxK4if7xx1SjRY4ioDbSVgnzjH3CBaVuFvkhkCBw27S/Qnl/IB5DBWupCOB7 QaVmJYVK5Uxx6pKz9kDwMeTmjJsNv9PC6Bf4fLauO4t1q8wSxdGmXreB/a7YlRwgjonfutHC+B2Z 3cKCwAwaqG/2Z/L/vnKFDzQmnI1M0eVEd5mTumANr+cEsPqk2X2RHJyCyfBgSdYcIT36DMzgxWLt uC8w9LsOSGnVkVBRPh312jDA9NWqDMoAD5s0LuO2PEGfqTtyjS5StoXoLTk1g9AjoqKaEe5YDe22 mihRdIopxtIuM+Oz/z9Oicor11gQm9J/baQEhw== Received: by omta-ad3-fd3-302-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RAD00B5D6ZBE2C0@omta-ad3-fd3-302-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Fri, 15 Apr 2022 04:54:47 +0000 (GMT) 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=eypoqjBCbHteIGJMjEE77faduCfiNIsAQ0ydQeu7OQ0=; b=yel/I7wJHKQGgU++DGlNr4s6By PhYVQZj76IsIJmZMeImq5Q6B2/aQRkMD3ug5dWOU3Jeh5aspjbtIuEjPut08JeM1WmCeQvYQ+tJ0f U696Xi8dd1qtuDaSpjLkD+EO876944juvaQn7mqYu4AmZhVRFKFIBWZURNzhkvK80mkS4SdYE8ghg 5kwkeIFA+dIpz0sffz1xoP4BK6LoTUtTMKLOpm6yB1H7oV7nfL4grqbNBsJP5+jCEy6k9Hq/bQASA 9dlkqzozrnkdCC5ckIaWKU5KZigzG6TnQjnKvn/KI4zIY9eR4oRyKCNwIxfdzpwno3WYuY2QxxbuI z9ygJJXA==; To: Jens Axboe Date: Fri, 15 Apr 2022 06:52:58 +0200 Message-id: <20220415045258.199825-28-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220415045258.199825-1-hch@lst.de> References: <20220415045258.199825-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10317 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 clxscore=250 bulkscore=0 phishscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=336 priorityscore=229 spamscore=0 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204150029 Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 27/27] direct-io: remove random prefetches X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christoph Hellwig via Ocfs2-devel Reply-to: Christoph Hellwig Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-ServerName: bombadil.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: Bkt2NuFynF2AOy0ZlriW6-jHVko_WJEU X-Proofpoint-GUID: Bkt2NuFynF2AOy0ZlriW6-jHVko_WJEU Reporting-Meta: AAENtVkpLmB6B7oaOjtZITnqizDGjLPjg163VXmTGnNHKiZrrmV6yaudRlZCw7QE oFJondEe35bUEiXyW3Nmlbw7s5QWOcRCaiZApFQ5kP7oEVaBPwzwGDXq8WBxGSYG TNsqn5aZOLhDSjyTt0+GkU9ijhisQ421wFIFuiT8GLQ2OQyGufnKgLpxTBQPb2an uYiiyhywuNtIl19wdj9VhPeDk/WEtWosIczNZ4+/Fu9c00jvJ4HzvhnrDCWBXjLi 9w6kZBRH8Xd9RA955F4MWX3JROme6smOfOMVjYPSNpZWmpHW145OzVHP9+B2GNYN tk9MhdMtRZOdvwC0mfhoFLMgasJ6ey0cQvp+41w5LQiP7LYCy5lWtWnzPVASVq+U 1dQg1Akw35JoLdHdGDEgmr6KnIEvuPVe3V6QzZ0YZ97Tjb3P14dchwEfc4JFfzN+ yIutRaAxzNDYcosfUzOcKkMAa/zi5SPf3dFydGBYoUoE6Tt+iGpsEgDg0pWMAgFd xw8ZlLBeLa9iQ+XWkkXo2727uDh8reBJTmmDbeW2tVR3Ow== Randomly poking into block device internals for manual prefetches isn't exactly a very maintainable thing to do. And none of the performance criticil direct I/O implementations still use this library function anyway, so just drop it. Signed-off-by: Christoph Hellwig --- fs/direct-io.c | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/fs/direct-io.c b/fs/direct-io.c index aef06e607b405..840752006f601 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -1115,11 +1115,10 @@ static inline int drop_refcount(struct dio *dio) * individual fields and will generate much worse code. This is important * for the whole file. */ -static inline ssize_t -do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, - struct block_device *bdev, struct iov_iter *iter, - get_block_t get_block, dio_iodone_t end_io, - dio_submit_t submit_io, int flags) +ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, + struct block_device *bdev, struct iov_iter *iter, + get_block_t get_block, dio_iodone_t end_io, + dio_submit_t submit_io, int flags) { unsigned i_blkbits = READ_ONCE(inode->i_blkbits); unsigned blkbits = i_blkbits; @@ -1334,29 +1333,6 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, kmem_cache_free(dio_cache, dio); return retval; } - -ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, - struct block_device *bdev, struct iov_iter *iter, - get_block_t get_block, - dio_iodone_t end_io, dio_submit_t submit_io, - int flags) -{ - /* - * The block device state is needed in the end to finally - * submit everything. Since it's likely to be cache cold - * prefetch it here as first thing to hide some of the - * latency. - * - * Attempt to prefetch the pieces we likely need later. - */ - prefetch(&bdev->bd_disk->part_tbl); - prefetch(bdev->bd_disk->queue); - prefetch((char *)bdev->bd_disk->queue + SMP_CACHE_BYTES); - - return do_blockdev_direct_IO(iocb, inode, bdev, iter, get_block, - end_io, submit_io, flags); -} - EXPORT_SYMBOL(__blockdev_direct_IO); static __init int dio_init(void)