From patchwork Sat Apr 9 04:50:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12807584 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 D4CD9C433EF for ; Sat, 9 Apr 2022 04:51:42 +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=QhTx3eVdci4myyVoN1PJsmGtkTCueuxogbjsI60oE4T8LdVsOKygW/ySbPyGEfIUGYTg6D74GyvI uA7Pswp3FHwKO+/OhV2D6FOXk57MckV7k1FDVKafPx0hck1zisvO3ZNMWbFWnfMF3dF3GP9Sj6ii 3aXbLyknGN1+kXZ2SIC8OXgLOXno/yNRjfArq3sbkDcUPJxc4htppVp/cihk8dxGVHLG3HawpXUJ ToQqJVBln849nm0aZTkCFGNKG2aeY5zyK39wmq0y5V1OEEZDTmyaYvoVJ5s4Tn21M/JGOswcXJoO rEguoYvvWtvTubX8m9/EQzM1AM3NsUclQdxjZQ== 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=KuYRL6GoyXJoMdR/StN0ew5odlUiRLRJODHbu5NUA+CfghtkcrF3nFM7Kl8VTM4DGiQDHHWXsi0C 2lEjjlAQVyl8Mx39hPqQkvM0CW/8IutDyLTwR1Wn8jJTpRjzOVBO88ZvHCKIm9+cKCpxgN/OENFi fgoY4e+WEsp52C6WelnnmAIWU18bD52206tbaNJsV0yJDxGN7IrE/GiZjNjJfXCjhiv0e6qj3hSS tTonMRl2hif4ygAKRW4j5h4bSTSkEofPI3zRPapJsNd72C8xkxuCuqJkRzKQWfPXR2DTAax57SZ3 Zynf1pHkFSb1p78l8oNkkVD6bC+0SYmzWTyZyw== 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 <0RA2006AN2U6Y7B0@omta-ad3-fd3-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:51:42 +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=f8MqUsBATs67rjabQ/6Q/DbIDx fgXqbEI8CyICa2zvZugiHMNhsGNdoL78CjqUFo+L85yRWnSp4bLnWw9UOZORPlbxKENuHDE3BMnvC nZh6ejqs8UuaxSAp6FEJQyIJYqxldvUdfoiHG+YGtE8JBRDE1ky/o2Z2BT/GFfYVa2U3YknfleDGZ YUmnMj5SSobEjQAm6BIb9bH1beFjSOm9lCoP9YbR6kwi/6uzgUKhayh1GCsU3aZjAHXXaEb3quZh4 j3z6YIhUDIw06+z4r77/ODr1b2fFsOalGXJmTq9WKgX7hgCKnXAOCLs7dqVGI90UT6R50HzlB6hd5 fgQRzOXw==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:17 +0200 Message-id: <20220409045043.23593-2-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 127.0.0.1 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 lowpriorityscore=0 spamscore=0 clxscore=253 priorityscore=111 mlxlogscore=999 bulkscore=0 malwarescore=0 mlxscore=0 adultscore=0 phishscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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: localhost X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: SqGiV6eG9X8h7mnvVcNv5PBLru2hAGYn X-Proofpoint-GUID: SqGiV6eG9X8h7mnvVcNv5PBLru2hAGYn Reporting-Meta: AAFCSbEZltLyGhoxkQ44OMFI7KZgeOs0ch+Gu/PEshxVulK27QqHBPNsuOrXTIpW 764Z/5FAecjC2b7DNjlM65CTW/Y3wO+j5UVWMIDEu/HgCfIXcs4/tzA0QGmw201n k1WhSaqnjkLkL66v07YnjSNFNfzBtXZ8jN4wx3vHJYfxwA7xC/0s0lhXKjf7l9f0 WLHvLMZ8dXJQTi8ODRMX/Ws66nRMwYsX3VM7IE8UOgSDrk9TRhJzFmQ+aCAsYptL TE5hWP6RqF2vIfZTCcuifWkQaeLjqrm5+MquAdQuzO/oyufxN+/1mdstOSJkNvSe /aXuqLDsY9XDuj3GDtP8/V8oatxdk2HZm/tFyMyT0HnWJI1apikohaS1mEygCtVg 4H3exAqJpuemNGRuC3CfiT0PiAqjT4qe8nF+c5B0rDs6XVNbovzWGpZJrD2Ujt7d ZIdlb8HG/1i4pgKL5MkUCCMhDxoW+7bDlGjM1X3mL9CZnjPcG+GZ42bdGA6tIAD/ tlFq+wcR+zECeO7HPsfUSVaxKuTVJhTEPDTcvfk09o60 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 Sat Apr 9 04:50:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12807587 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 aib29ajc244.phx1.oracleemaildelivery.com (aib29ajc244.phx1.oracleemaildelivery.com [192.29.103.244]) (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 09FE6C43217 for ; Sat, 9 Apr 2022 04:51:45 +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=saj4J5vJQn3GJnJek+k5WtOgYkJ4EMCrDOhnW99flAFf4O8KgVQf6VaLRMeJukIAoZyWvE2kfGHx wlmUiRVh4EDfffwNmKaVFvUhFUP3iqpSSaB38Si3zWx7zIff/zPFPt1G8SWdC1x0Zaeci8srTJzx P5b5WiFUc3Rd8yu6S+cPNwHGPiYXtPtYIsEq6wuz9g/GFGpYu6AZwoUbktvXR3qf4BvOKN53Yktm 7Wj0BRSuhqgy1gHakFSVeuadg+KvepWnwvlId+tum4tMs3gBQuiA2WFoC8E0zs6NdIhSY4QW4z1x lZkO1sZkOTlRejg/AA4gDiB7x3rW3O3eQ6cjgA== 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=bJdgYNehJaWSql1UIsYOO+o8MuCVA9aRjTUk+anUXoI8epuhcNX+LMEH/fuUr7FIC4QDXQH3KSP4 uTUUO7lyc76YZmAx0QEwHkPyIlGBANtVzU0U9XQcqr4LJ/uQ1h6br3XzIlRuY/T7tulydyUqPr0F PFhTzsjGkFVw5vIdBeTUhrC9ugbHftZSJb5BKxfo4Vc7DhBtSl2o/VIVuR/kWKb3QExiGwTUrG8q AoVoYGeAzpz2km8o12HXrg3myRDpe458bDPpttbL52lLlKWAFZZoMeHg3pe7bz4u0u/XyzIXZpJM tSDNwfVoiPa26EBkCGh8hd26esPtRE2ZnseqxQ== Received: by omta-ad1-fd1-101-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RA200ERC2U9K360@omta-ad1-fd1-101-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:51:45 +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=T+9t+qRVixcYOKTh1AUVT25z0M +SeVr5+q6XffdW1kFW64UkJe5HiR1JzBYZYydkfDGnhvPDwIWt1BqK0kdRpQlzNS/wUGgV0dz2FlC P9lWy4ngvRvWzpwNKC0K2fF5KsKRF9WdU7qIRMHjoHzTM+p/DmxnFS/6hYJwPtf1Atl9jbNqvHRbW tlOYlU8ufbWGBydt1bUmPAZA5D8zkMlkbBnkY22C2NT6vnnROSTB46+rpRyEX5lzOjlaPcp8DwJyC bbKS1PGTuIP4F/DHMFVbTCV/5B0d0tMWG8vDpg/SA6IBHxSKH9SXtm1xmXyImu30Ag6d2DwUVgBc6 Y9GfxcxA==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:18 +0200 Message-id: <20220409045043.23593-3-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 127.0.0.1 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 spamscore=0 bulkscore=0 malwarescore=0 priorityscore=175 adultscore=0 clxscore=240 impostorscore=0 phishscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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: UGj1fwgQjVu7Pxenwxb44pkkjT0UNpix X-Proofpoint-GUID: UGj1fwgQjVu7Pxenwxb44pkkjT0UNpix Reporting-Meta: AAEbaJwZyG7UVotcEmXCMu7Q49e2rTl+1K7MjNzxvfdj2Z8qeibhBa+5VuSsHX0h CAbfHP7oljkPrpgS+puteKsN1DCGDCeic0yfoDgIfJx15ss3RcfRBIRegyyZ6x0B sIfTsNhbHIpkI61sU8Aq1tZpR19YI08yz4GoVpCQkdcCwTJ2Wy1vgH3mN6mEBkiI HnBHN0ZHjUD0COKHQOK31mrMufCh6p02GFuMv6Y0kEqocn99sq2IqUXhDe8w1yaY +ZC8lKbp7IldcYXyzZ+rur4dnBWMjLsMRngT544M/YWzxSVydOZs9znZKgSmFJas LzVPtdCaYk24jniwz9savB97v5/OeTQnbsQDtxEeAC8I3B1FG3rFvASX6W3ZzAr0 SA28LDyudix38EuFU/CGiB96dx/MVaJXixTl3bzVTcA6rdfAFaCZ4LmaFPAvaARb hiIXhcro8sPKLRlPCb/rMX+4n8wgWjF9KKViUvm2W6bvhjPccoQfDnpFRgU7W3yT QTJaqiQl8+RmBN5Xt+aZVMcLIRu28VMctGIHb/Wca4i1 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 Sat Apr 9 04:50:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12807583 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 ABF07C4332F for ; Sat, 9 Apr 2022 04:51:42 +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=ff6b1t+w8LtyT5SDwMxrarCSNbnwWnH0aXKJhAX/2SjH+koVX++M30XhCHl/xP4eQ/jRldORtNWa QfV5F3SiuJbQEw/dO7NLa3MUMDs4H7E8hCkpuqxyzymjHhGt/E8L8J0zKA4XNSACmToLNx1fjbkd MOkVMy2ydPUanu3BVzE+QQhIijgnLVVv3z2Dzrwn/MB9rKd84UMxxLxcrtVWBzD1DSQJxy4EKuib 6LG24GZLAGWEgaeMnesSfeeo0aVZ67g15d1NlB90OuYUbMu++QGfRR/siiR+9gyzImzDvAdQ0fY3 WyMouDS6Uzl/gd8wabwgaAO+avS17QtqVOAQfg== 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=qGFqI+JdzBVdCtUnqfb/FV9E7VTJYp11j+5E/IMwu18Td5ibR7YF4ezOjqnwIpb61h2Nqrr1194W G2iAbXwmgO7RNnG2ygjXKNUEYFZYep6q478KudLAYGdsRaIatbijqq4HAl1sjWA1XSMREUXMisJR IRnRhpShG/o/j/mwluPgcjeDGtsm6b6GyUOKdw9gbfAodP1gI6Kl8hNjRlEV4f4hqcfX4Us+poD1 wiiDtccOzamTGX5/liX7Bq0ZWpAtEYlOKRtvIaoIFl2aV5U9gel4jTxK/www9UYoxxZwcUni615J ZoLZAFybHzGcflFMY5Nth78iuieiFMCxD2z6Ag== 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 <0RA2007ZW2U62L70@omta-ad1-fd1-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:51:42 +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=UPj32NEZSs0CZXU66K8zWiAfa1 xZi9mNnXgP+xDQL0eZfIz641yrgwphIK2vKHJq+DoAtDvElmNRgDbJUWiJ8LyL9xqUM2UWFY7Qyui tvbHWEmImnVRF7P5yMfrv6iT3Cq0iPs429cZILRmpjqQ1A5wLRB6v5agc1vr3+sykUaLRIBEx/Esx +L2whSVV5Udt9aHJm3N6VtcagVQ4jfmDqHnMwZyb9ChnAcwzA/ZypVRwhIc2odkVgg/54WmJlHYVp s6rib0l0pjoJtsNxoS/ADbx9+kWTDEWWDVpseZqy/qnwy7fqLCYKD3ouvwlL9wYpZg4OadMvweV7k BfVKIhsg==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:19 +0200 Message-id: <20220409045043.23593-4-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 127.0.0.1 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 lowpriorityscore=0 spamscore=0 clxscore=253 priorityscore=90 mlxlogscore=903 bulkscore=0 malwarescore=0 mlxscore=0 adultscore=0 phishscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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-ORIG-GUID: SuQy5SWNTzA1jR648UAGHqoVprmgOpNN X-Proofpoint-GUID: SuQy5SWNTzA1jR648UAGHqoVprmgOpNN Reporting-Meta: AAEDfTdSz7uUc3yhbhpi8Ql6/SZ+3/L4srFd+Xm4mxfrsQB/DB/A+TBF5SyJIID3 +21gqJZx8XS/zlOZvf2nDzu7Y3oqJPdHm+IltPIictysienD/wjfa5zwdBgkfMJj R+FTEjByl6uAa4HNny/PkHd88EAm68NX4/5kHN3AqHcgKL6u777sRl9vT3MXlHOC GVryBeUwmrWN5s8P2/YyhlxavHE9pGoab6f5S74O1IGcPLR+3uQHwpmTuy0axTL3 kCa/kUjwrJHS8Oyc/fjjp3420GP0CDBciNfnr8c6YSVF9pKcFd0fy58h1EJCKlvt buH7L2I20c2KwtSBAvPT+C2aGrQfsmBV0yC0nluFRWqJK3td87JwvLPv372GyZME PwPlNfnLoTYj2FNMwClffQ4/+T1opWeudWg2dqVrWkpaat9/LyEx4a0CJl0Qf1iU MSShGqJeS5XRvcZUTJx9EHqlTWeFMqy2NykM9AHu9mk5Z1TMLgx6RIyRiXsFh6cI Ug5FOBl79zDkYfjsrrj50PlirCVWm7FvkQXmwt5D3x5Z 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 Sat Apr 9 04:50:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12807586 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 aib29ajc246.phx1.oracleemaildelivery.com (aib29ajc246.phx1.oracleemaildelivery.com [192.29.103.246]) (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 F2C0DC433F5 for ; Sat, 9 Apr 2022 04:51:44 +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=yjIkxPT1e3ig7cFY+fQTq19J/mg4596tZUMMbSDhENI=; b=oBdwBcdjTwzIiPLRVGMt7jMMXadxB4B5dMGDBAJ30e4jfGxwi3hboJNeNgBXj8Z6E7EbV55GjLUj 82+FUnl2QAlCejZxsnzKfmAWFXZEkXPS2xUKeY96B4wPNakd8ElCKiVj1Bjvup/AXBZy38gjmouP LdTd/biXd+dQedNAXaUd0qou2d7lF5tYKQ7lZlt/4f6PmYf6VJTRQks0NIdifLJrCcfY24dVqMqi abYKVEXW14HOZr1UvAZXSdxSvKQpjs/kYEMJv0zmNCiXH5/M+wYCmD0RHhAxmG86VAqIiDE9ltSq OSSddz8mvc2bJVXjD4c1YwJxHPC0Tl8IbRb2Rg== 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=yjIkxPT1e3ig7cFY+fQTq19J/mg4596tZUMMbSDhENI=; b=FeFzcNvERZVtc8Z06EnR0jkEsPx86Krd1IjNq900kbecHiQl6brrrhTx1S4pRjlWIflusoLTza72 aZfJRZqA4vp/07z8sogjh+LLRK3YES8cgMUAh9n7CUASjhErz3lw2RZO8MDmx7/HSgWiS3DsKTYq KhpuxNKgxsvbv8JjQ/cT8b/O7ULun7iXR8YyG1/dJ/1nkxPINd8uoI7h15+mt2STfQx6AC/F0t9E DPaece+PAZ3qJkqBwU+dKq6NKCjEERjvW4giBsZQD9rUNK8ejixJGG9+e/Egu4HSKZbi9rtjqblx bJvrX0g6uxQgmHb2i3up2XjQhOsX/UBuJkgoOQ== Received: by omta-ad1-fd3-101-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RA200OD92U8KN20@omta-ad1-fd3-101-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:51:44 +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=p7OacHYZtXHcRJcUjaO4g7N75FFwuFvyGKpz8CHLs7c=; b=Pzju2TytWziYGXeAIXOJqaZe7f 7ZGvsguzecelJ4kpYHFs039peENwElmJJQkOSiGYs68Q+CTFipoeD0GlcVPwvTxb8xwBmaIekN2yU Rk4beWtSim6D708e6fSlV3YP5i7sNLfobnz5N1LWmB0773OmCuKgM8hPrOj00tHgKXSL2WCPSypp8 ErKpc93xT55Q9MUWv2vmwsuaSUJfwgL8pm1UrjQ6JfcKYWVBii/A8RoyrVNpZCMb2NMWyLhn7ceWa xkvvl8VwB4N0A1xPbH8PCB21WFupHylrzncwQJ8sn/dqS6wML090d9Ks8PME8EXpA5KlHBwNJY9Qk zEahGH1Q==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:20 +0200 Message-id: <20220409045043.23593-5-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 priorityscore=48 lowpriorityscore=0 bulkscore=0 suspectscore=0 mlxlogscore=807 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 impostorscore=0 phishscore=0 clxscore=254 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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 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="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: qNr0_Vh5S-rsFBBgK3YOuXlAAWhA3NcK X-Proofpoint-GUID: qNr0_Vh5S-rsFBBgK3YOuXlAAWhA3NcK Reporting-Meta: AAEbaJwZyG7UVotcEmXCMu7Q49e2rTl+1K7MjNzxvfdj2Z8qeibhBa+5VuSsHX0h CAbfHP7oljkPrpgS+puieKsN1DCGDCeic0z8KHP7a/D8XrR//LZVYMvEYg8ZI8b2 z+3rPXxzbqRjpxufg1WGKuVdynMNdVjukFHEaO9bT4d4C1Z02kk22q1JRWtB5u8B zQIP7i71Vu58XDBPBd+EZqh9xxdn/Y5IN7+tlOrR0zS4DXOaOFpDsYCSZ6a36shz gKTOOITDHVHeJu4yy4away55YFf1//tDOU8fxn1UXivPcTE5ul6dXVrNOfQ6Umgz sms7ZxxfstU9murHT3swjvt3csvHVn/3En0ZAEFkGJ8iREXPtak1FeWUc8+c01eb MIuLIiWsa6aSulEAnnTGVlsHD7SlvfyTRBHdSKV5de0rww2SKL+3hzKnQLZeZcow eMqZI7CWUbeMPawJzVq/n0lnhG8rBJM7fz7agjs77I6xrEl1DEyv8t9WoPL1iVye 21Bvzbzo0hC+AX8NMniVwBpbIjIVnNxIcU8neZLwBw3n Fold each branch into its only caller. Signed-off-by: Christoph Hellwig --- 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 9676a1d214bc5..1262fe1c33618 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 Sat Apr 9 04:50:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12807588 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 2698CC4167B for ; Sat, 9 Apr 2022 04:51:46 +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=EkSJDYyYx8a/NRzo/14pMQysZsuLHG2hkmLaNuLG1j8=; b=PNLVsgWfgHlItUn+Na889p6n8WKupsthXvHssguA39rHjFP5Z5MXRWziXTbMfTR2NnO6XNcds/2R YS9qLOjeOG+Ihio/DNeqzoYungffKQSgTeQIfEKRYvbuo69wzREcGV6MSWmx0FMDOsntDIoNCK0t GGRBrlWT/qr6A95WwQOO0Or1Op9SE9cxnYB6i/gxdxYMV4KvPe0fyAITI79taNi1n8Hg/yYmphI4 k2x0g1njRDZ63k2BDQidj3MaQpnuPC5fAhthTJlzdRVBz0bpsBqau8dyxwAgwqAXpD4ZgERFitjt o+xNAkLVD3QSutjDeUrxH5LpLduqKHBCUDvbIg== 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=EkSJDYyYx8a/NRzo/14pMQysZsuLHG2hkmLaNuLG1j8=; b=Nzd/RM+fmj2noFcGa30VeOJLEmfYPzSqch8ELgXfrR5S4E+OQEd1hSRNT4uwEeDo3kcj/0llIHUw uDT/f4GC+0KJzI3kjQfr7GwQIPUkCRUZi5FFtBEMid6CZ/Rxetscu9MBS9MzJ8tXSzdFrFsORysE VuUMY4ddXIubPFGnqg5SHEU0Ugj5z5O0XdZgWhH1hqZqsUc1CksEdGHrpVV6NCzjD15TdFvTb3yE NatbM6RNK+EwSttYl4k4+GxjO1mXKt310ua3HP0cq8T2kOz3COhTG9CioUGUstIO+H/v4HKde37M hTITb/qHM5x4SpcHs1dNJmgEHzyHcLmW+f+kOg== 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 <0RA200GXX2U9ZW80@omta-ad2-fd1-202-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:51:45 +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=o0hivJC1zBmf2OLswEv2WeM9LwYiU39b8DIC3mFzVkc=; b=3F4Gy8p9Tvq+5pylL46uvOJn7h o2XZpRogXFQL3VJFZPE+ZZDtjrf9Pc2OTl5fZtGSYd57hTdFlYXIdIHOqaBXa/gwwIgNeTwpzh8E1 QxRCn+KG2Muq11G9sBZPqcFJsQdF+RO1A1/vOYvAkvrZpiLwvpNlQupw5qXMvPBGR692SLA9Gc4O9 +WQuMA5xQqJyH9AX6svLk38kVSqqX8kZssANUh1VF1n2HxXeQbt2B929yqhRSjrF5mSUtQQl9u3kF pbbIDtUGIe8ib42MP8DoNYMKEID8G4oja6vJ3M+Cjui+ZmorwUZF4pyM0UDyDdlGBMS8H8gcMK1Fa XnV5hFlQ==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:21 +0200 Message-id: <20220409045043.23593-6-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 impostorscore=0 suspectscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=692 spamscore=0 clxscore=242 mlxscore=0 phishscore=0 priorityscore=30 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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: qp4U3aeOksBvCZ_m7jMjICNBIPfcS6mJ X-Proofpoint-GUID: qp4U3aeOksBvCZ_m7jMjICNBIPfcS6mJ Reporting-Meta: AAEAPRp9bfLwGO8Km1YOhVianYhtyr2O5X+kom1udep1rTb/nxeO6UXNICCfXHk/ iIJ4P4GYPeEcY9Cn+VCLxc8YOpR9d/m0Q0toQS0kV2BsXolQaVZ0aLmVbPGUHTDP 3hgKACGEkwmngACU3pBNJRyTFq72/wm0yROZrpK31fdO5k1H0W0LXDNjVIbUovJ2 FxpfECI2yhKRBRDlcJAgOabKU8sohWoUUiFlXzMDInnz755hqOtwDkXE+DGAC1Bk Oo5vKSsB/0h7FQhmPWRO+fG2Pap4/dqDNvB4YuBRibW44osW8MCSw/24o1Pr+5mu Vr4c9ZnXckNzcVI5Mc4Em/hNJxzpfpJ/eYyeUj+foF2jHJHagc7CdCh42AfuYKgs PRdkF4BLBY2zorBBGg2I9QDNSeCeRBRYoQ8GE+fUMxPDVTqJlcaiO+Vlus680sV3 1pxR53utXVr9m7zZ+DQA7P3g47d5lu8bGR83IstHQKTWfxiGEW/kxAys4zUU58Eo EjZPqQcxt8PrEVW584Nmgc8cPvGsuWR2TuG6N+U0TRGS 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 1262fe1c33618..aa2c21aeb747c 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 Sat Apr 9 04:50:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12807589 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 3E4B9C4321E for ; Sat, 9 Apr 2022 04:51:46 +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=Bnq9Vf3h0mEM9ld19nug5DVOk9ghIfXz7QRUAQ0ZHlI=; b=gh73CkgGMu2uez1+mnZ7RnLPwijVSIQZq/OIM4rk7rwCpTiG9sUEWWPeglNokLyI1KHXLjv2Ntfy bJJrrmkROqFq2BmShygKZIMUHzgTO2RAs8RoF8SE2JORbM9HyIGGn+twwE5gY1hZOEX7Q95cEtGp S8/jW5H3EyOsTz5w+r5lNxpqqMfCFZwLUmPoyv4G5slWZVAGm24PBoRv4399+zIHPHkJcEOwQ36A Dfaa/omxyxsgDpWCBoMabJ/QuCCFjZVo8uqmkrkw5UZRCIcg6Qv6SaHJJI9NyWQAFq5kr4Iv8a/Q eu6kLuLuzBpkhREwmZA4gtiY2VdFUXYyHuBZ9A== 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=Bnq9Vf3h0mEM9ld19nug5DVOk9ghIfXz7QRUAQ0ZHlI=; b=cpGb1d5ZLQlk3Qo1EGAEEPt73a8MJXmbYAsK7ou48yEeY65Pl70YozKaUBf6KM+hRMzYWnYRagyW 3XP83BCX1PuykDbUyJHv8GnoR499ySt6d2MnvGjc/7r2oWAlArTUuW2ou2HSpGNN1p5yloRCA1bW klJE5tF2wG9yobqw8wO78dTitiw1cefI+qxjO9t0Ap26dkEQDDWcrwU6a44F3xIkMxUYr2WDHRCE 7MlKTzv9tjMn57Q2FRvrZxleZDS/ArQ6yiuRg5hkQQl/NKfNn+MdstW3DKrqJjsUaN6WZAY7EHtB SsDKj8U0nRWzHRYISf8DZbH290hIqMaBCZBIUg== 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 <0RA200GY62U9ZW80@omta-ad2-fd1-202-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:51:45 +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=mSb0+dwzgM6VKYFxP/SxijH+ZlgC/mCnwmCWElH9Px8=; b=GeHiEC33kqU3XVD5nL4JSSzw9j UuYbGyM2BXXR+stmsdf5DjhZy4DmQUWQMFN0vSfrL8aUhBe+6Ofrgbj+Dbx5uxEAqYOBhWREkppXD kdRzxDavbe8DbbMc6qyOhN2cA6i5obcc9Wc+hP+sVKryA1uBRUfBVDOlYnio24jRKSkCpFo+tSiXl 6u0gF+2q2d7oaysxI+ClBO5UEjKSEG5mJBDObnDrEZKJSMP7hUVOwIlO/C7MDHMssw01IKDI4CTXp PRCDWE+Bw8zXMLtTw0QbfZSkAUMsYs8Kzz9wpJlJkYu9q6ou7iULbQ0RWrchfFLVlYlgnHKpBsjXJ gpZHWQ4w==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:22 +0200 Message-id: <20220409045043.23593-7-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 impostorscore=0 suspectscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=487 spamscore=0 clxscore=230 mlxscore=0 phishscore=0 priorityscore=60 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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: HSerfNsyzJbar8yOmwCQ-IvMmqH16Khh X-Proofpoint-GUID: HSerfNsyzJbar8yOmwCQ-IvMmqH16Khh Reporting-Meta: AAGSEfAjIrZKovNAR1e3NFXvW95t7m6XYJ8rfRN1UqJU4gp5SQSONOzH5ujhbMcG VjQ1j1Y7rR63ZUyw6nvfFWSQazaviqu67oZDGbnFv2n+wvuKl21pDbTAwSlR6JRP I8TPmFdDYFO2rg+E17nzXRJTo7MznX3ZI9oUz/WIQ3rX2bR26z/n3IFOp6zvwbfU NveFLxhNAOCCWaWcz5n7FUq57vps4eyZm91OJCbFjyjKRCZ+fO49qZx/1dq0Lbu0 0cNwFrdfjkXe6FidQHA6k0jIyTTw+91DLsqmkb5c6OauYUk9cGk8hkINSWs1UQHo 4PzHCgFTIcGt0CYvbe4sBrh0Q9D9vWsefVnN9u90/U3qKsEWh99JRucIARIPkSLD xY6IfKM4MRHGaBAMsNFJcYT9hvgEcSCgVNxjwU/6gGkPg5mDGTNl6hfIWKFX9t9Q TkKq948Wqq2rKMci+EUHvqhu5d69oGwoyVg1B8zPRSCo7eeQYPJoiTdOQAcgcFVj LQjx2bgmuNpNuaJ7kQ3go1aQ1dEL3taKHL424tilFKGT 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 aa2c21aeb747c..eae629c4f6eaf 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 Sat Apr 9 04:50:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12807590 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 26956C43219 for ; Sat, 9 Apr 2022 04:51:46 +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=0LwYbY55nL8A1vByu5NBfmOvm+kN+xuWrSZqD8F5zHg=; b=X3buyWKxlwujL0ePF1nsT5xaMkKqAAaKO/GtrUJs/28ir2mcw+mV3cbCejpR9DzpEHbGM3sQ/0TO GtzsDRfRPllPJ2IQCqaLMXIDRdEWTLxipuaMPUQHNz4iRJwpCjYFB2flFuYicNVx04enWloQcpgw 4k7yCRo5+gRJoCkb5SJm78P+/XaosQ+ItyWKY20U+n2JaI1/1UKJQybGHWXnxAMd5m5zARuX6kE6 WBPydLdTi2PyXQUTC25xGuh5IQoB8rNlJf6kmCeuQ++hoNskKELtEWpjjH+25FAzTPJOL6xsY+er Vsorg5+4U1MWSpcisLwHUvKNlP9kqKFB3F0JHw== 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=0LwYbY55nL8A1vByu5NBfmOvm+kN+xuWrSZqD8F5zHg=; b=c0Nb3lMK0+mT3Ezjeu0RGX9QjM/ZVuXvYiAflHnw716TNIMuhGzQY8MC1TfS4aLc9Mr4EVwnmcoz 8gxejV/GhqNTVER5ZFnuD8G7b/cGGyWcqQPe35/gr3otE7Z8sGQ9riW+DHjsLxfs5OQTFrb1O9YK 6RsaokoV0xriIArrHOIeaxZDRigtjRx7+pozq20opwCxaMvysvrRryqaDaThTHsK0+7dzPWQHxrm 896wgNEGasYYv8Q3wIAdhZaBS0TyGlPEZV/I0vJ5CTh0uD8hbP88hEbAVCbMWViMVMCT2sUMENIU b67s4CMKR0ktbUB+nrlAFgggdrheNyh4wjLvNw== 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 <0RA200AID2U9PB70@omta-ad2-fd3-202-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:51:45 +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=fe1mhxHvUNcHX31X2/v6QhlWCpL7rHNmKlyfX6pAQx8=; b=Ln3yxSObowNxJM1FMrhr+K57R6 b4hm67oQXj8QHYSsDtTeswkmQMzhTUbmcFXZ8wSKANWZ3f2uawh1SArLLQwyfG/9xFBJpY85CXdw2 ds/PrbeW2qhvBxLbQUlZJnupwwXSwTpD5oVVdXoHNH+XQIFpfq6JutVFrQurNrlSwXfXPm8nAVF8g 3O6uBqOGhFXMyQobgkP5h+IgaBO6+coY7mEesusFLc5Uf97qVgiCBrdqIzpOVhA93gJW7XwjtIRj9 o9pUqGiB3fZ23DPiIOWZiMJonzuJNE4ezkBUWAzOu6pd1udnLd7cjlnkVEEt0MQfIsCBUce9aPyz9 Bxbzzdhw==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:23 +0200 Message-id: <20220409045043.23593-8-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 clxscore=230 priorityscore=138 bulkscore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 spamscore=0 mlxscore=0 adultscore=0 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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: R-1VmsdA3tdK0S1_d2JOdhnkJDmI9xOp X-Proofpoint-GUID: R-1VmsdA3tdK0S1_d2JOdhnkJDmI9xOp Reporting-Meta: AAGYUbwR03wnJcf9syls7qDkPkrGJquYqpqGSkvddjM4z9O9rws9yNH1OGdrJXlo sJEH7cRSG+Yo7QSuIMgL+XXXIBylt63VZKYO7WYzTKziG0jFcdArYYlICJWLXpnz 2pIQL1kMnvctBOz3FeKxf3Psxl44JDiejj9WdAvBfMQpHo5nYgBo9fArnoB8GoKK iFTs+IBvnwVUxzpveQFTfgfC1QIQs3g8FUxHeaLZq/s7Hg3jkZj+VRA9xiQMEoTe EUOb6rJoVLj4qgyj38PGz4BW4rvPA3BY8IkDgQu5tXVNPYi8ckKdc3OkU9ExoRNh AduyhgVPjRmiGkNspbJKoCitbItZzkqZQSi8oMBwRxdICfCMl3emaCzve7q6j+ae 3Gw6NFuEUFL+/VlWRHsvGcQkZJ0MsLajO5VSbHL3o7/ysNVfDsBr1O8gfrG1ixRi UD1vjnNMp4Hjz+nk6s5mf+2lKQT1p1nx0sXSjfrKQ1kYfd9v6QPWA4+zCLT6Ahep GOjfSOBSDokzl7z+oSZEZgS+3ZKip0DRKQQPtbK4aD+/ 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 02030c9c4d3b1..40bb0b356a6d6 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 Sat Apr 9 04:50:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12807585 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 aib29ajc253.phx1.oracleemaildelivery.com (aib29ajc253.phx1.oracleemaildelivery.com [192.29.103.253]) (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 22C38C43217 for ; Sat, 9 Apr 2022 04:51:43 +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=HSz1naRk2kl39FlTSBip8BGG7fE0oXLO4LbV5an+Kvg=; b=jRo/vFk1wAd/3+qAengic/C3A/2Yh+fu8xgxkG1QDVILOrEswMtLeoKMHkjGeV2ZTeByRTsNBzRN JgKTeqAwG+aLywRK7NIHh5eYfd/dlYw46pwxO5Obn+MqZDvda1Si1vj0t6M0Mox0eCBDHVxDB3qP nTogvZFWtb/qLbMYoKM28/ySzr0sub+Pjka0ncRDqCxVOtqj8HiRTAZRL/fh7+MmRxmX36mej4VK BledZubn9xgovZC/rYslej19NbqVWHUZs8ERK2K6tQ+I7G/GvpNpc7qfTm/KXl1KpaGohx0yFlcA +XgHywl/sA5FCTBRJPBsEzWkc9fdorHQK0icIA== 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=HSz1naRk2kl39FlTSBip8BGG7fE0oXLO4LbV5an+Kvg=; b=h5nNCZjkAbuZSCScAC3pXmRQUkVFYXYRpVBkRbJL7RekId8xwszgyA6xfa3U78C6qOmmVlwN2xIy hZMJPRy5eE1IG01Ynq7fkbv+BVqsKgMViauK8xfLiZZT/ZA+/R+cgJLNdAUFWS2oUB/MDTk/0/Hn gEeqQ1grIPqbQczLICAE+MWM4xATyZfT39j3EaIQr2bW99HFHiMijT/byYI/Zewdbwuw4MbkY25o qMdjSjYiZXkTn5vNiuZxOZw684tmqN5m/kv3akr0r8jD/dAKE/wmtt1UzzYN3fWDmpf6ecxbuDXg Qk3KKTbzTlmsu8Q1zKYCJbOgrxUTqXk+DrLfew== Received: by omta-ad3-fd1-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 <0RA200FH22U6X960@omta-ad3-fd1-302-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:51:42 +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=fGcL4rT6o55inYg+xD7k4NQPOksglZvB+PFSEP+xhA8=; b=x49SryV2SEOzb+YKli0UJZwys7 Znb1rsPTkSfYcHPVo9D6b2U83E7uqw2G98XO8zYfl/hKwrvVhicKgqjDvuZYTEB489P843L//CwDT gqCbBf9JUwJ6J0Nu3a/lcC/IfwnnEVdVHN84pWvuhxzJiYH6crHhPnTIzf9dIWY5MLhKlVfzyM0Vq bwRuU6hgXkjUYp1qcxu8V6Fo824rSDUIbNTnNROyu48YrBGf3oVsysJ9CQPrqpevcWLNQdLnu2N4C 4XspCM6we8vYPn8dRLL0TG98f118C88z+RALpryzLlARTzoVN3y6dQTJp4lOBr41BAbVo0sl+miwh a6JWWqsQ==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:24 +0200 Message-id: <20220409045043.23593-9-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 priorityscore=60 lowpriorityscore=0 bulkscore=0 suspectscore=0 mlxlogscore=775 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 impostorscore=0 phishscore=0 clxscore=238 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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 08/27] btrfs: use bdev_max_active_zones 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: zzXZ320nUrzl2Qffxdysba8NVXNeBkGH X-Proofpoint-GUID: zzXZ320nUrzl2Qffxdysba8NVXNeBkGH Reporting-Meta: AAHdc3hUrSXKHm+eKxeq86a5UhRuFmxwX4y4jhnVeChEx4HABo6YOjg+3FB7yETs s8+zPhjlUfVbrdzYlM0NS7eG0UMxOK9CLbi8I6AMbij00VkaI4Wa7t9XGTXL6wSJ sODIqaDqR4LACW/WEV+/qmu9nC2HeZtrhPVapnWpgOve+t/LMPGxKYJWdLCnloeI s6C+NOLK03XAphRNZ8xXk42xmUEAhRthps8chPxfWRLkjJ2HO72ZyhJ2UQRhlZFT bGx3tJAd6nmUHZ+ySCQy6KysVnDqoSB8QKigzd8CrgifRL/q6cNYnbWqXXYSeBf+ TFXvom2C8g0f1fB8xniecBk6E4fgkjlX1DM+fIVD+pdK1jdsqjtNs0A6mAn+4ky4 eSzsQMsZjKykohX5XgIifP1fSLcnjedHF7B7iyXi+axrOrSSkGPcA6j7eZEynX6d FC3U8BPI7myMi+TiXY94BjJgxV96xUlqE5QYdBdQtooRftrJazGa7WGKYUpJzaDg 1nUwlzx0+DdckOg5ZAOSIOLC228Revv399OHcXkN9c/h Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn --- fs/btrfs/zoned.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 1b1b310c3c510..f72cad7391a11 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -350,7 +350,6 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache) struct btrfs_fs_info *fs_info = device->fs_info; struct btrfs_zoned_device_info *zone_info = NULL; struct block_device *bdev = device->bdev; - struct request_queue *queue = bdev_get_queue(bdev); unsigned int max_active_zones; unsigned int nactive; sector_t nr_sectors; @@ -410,7 +409,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache) if (!IS_ALIGNED(nr_sectors, zone_sectors)) zone_info->nr_zones++; - max_active_zones = queue_max_active_zones(queue); + max_active_zones = bdev_max_active_zones(bdev); if (max_active_zones && max_active_zones < BTRFS_MIN_ACTIVE_ZONES) { btrfs_err_in_rcu(fs_info, "zoned: %s: max active zones %u is too small, need at least %u active zones", From patchwork Sat Apr 9 04:50:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12807591 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 055D7C4167E for ; Sat, 9 Apr 2022 04:51:46 +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=yUr0hUaJyLF9uC3bgtk2AmhGcWjt0qVOyL9TSwJpZaGwBLzoLF8Fs42O1dN9fKlcyXWhuF0aHyam jHXLL+/zrdVgD2Vki6IUkOAHCBEWqe1SiF8SMfn6jlRLjmAUN+dw3g7fHf8VqW5d4+st7lWpxUmV iP2qneeXnQy/bSbjvYXCA5uqn5sPIZWOAPSaBJ1vcB+nw/kx/7bReRvgNj/u0Z8MB3vOD9DNgztO +jUWesNHTVCHYzOM6tOSpwqFqnuaKJmRdX9qtO0kq2xRLTp/T4srp++N+EmRnqb48GoeyAj9HzmR +9AyqbZzS/PVkXiZfUrdxVuZDAxvcCDjMSaOEA== 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=glrRcH/VPEB+3eBKa4dLuxZhFo5p7mtLDyj2TTiS0YvbZNtJEUws+zA6563CSof2kOzRMwvM7NQP Snzj0go629eT4fcxbNrPVA73iMNUu6CQiSX0OfPVXNk8W3cYv/2CwRnddnwawFT77xFZnmmn0wKL pQnRBaRdVmzaG4HTCoyNBvP2ua8sIIQGUuAq2eP8hPl8pCseaV4uMW7db2mOBMoJffIMPWP1qIU+ N80vnOEMG7yJrRakEA3wfZ5HEaLInub8ChN/Taihf2xrsv9NhlsO6Z6SPeuDOrtQy4eJc2NlXwuP pbIawNbpojb+oivDfC8pR8V2lOrAYrMP89b8Uw== 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 <0RA200AJM2UAPB70@omta-ad2-fd3-202-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:51:46 +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=DWf7imoDvMSXJTtirA5ltk+rtE YeH7NxKahOANJaW3JeWmpEL0KWvrQ+sUioHsm0dQaUs7Tks6Ss/UVOXMhmulR7QEBLriQYI1KEMzQ aO9ISV0dwvPZErcNPFhlMeFi6wIDVT8NvUOYYMlUOKdrnhvM68xwDYg36srZ722XpvX8aIcmuYcaD sB1HtVb3yxckb8p+8Hs6srY4Fa9xc+Rr/tmxJaQIFCFAy3LRp9g0YB5fD3IXoh+PksnNKd9R9552Q DFKI2Il5Y+lOkByKWQ2YD6LETuE64wDq4THU/F5OZAcQu9U4H1sQRvyeZgS12iohkvkHfPdltFjhr Z+SPB7CA==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:25 +0200 Message-id: <20220409045043.23593-10-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 spamscore=0 bulkscore=0 malwarescore=0 priorityscore=30 adultscore=0 clxscore=228 impostorscore=0 phishscore=0 mlxscore=0 suspectscore=0 mlxlogscore=742 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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: J8Pfo_LMTLKDlMWPqkyuV9GpnaIiNhFU X-Proofpoint-GUID: J8Pfo_LMTLKDlMWPqkyuV9GpnaIiNhFU Reporting-Meta: AAEDfTdSz7uUc3yhbhpi8Ql6/SZ+3/L4srFd+Xm4mxfrsQB/DB/A+TBF5SyJIID3 +21gqJZx8XS/zlOZvf3GDzu7Y3oqJPdHm+LK64BdoIu7+H51xMdY7p506PhSfrju Aw9dHbdbTN3bPVYLzYU4x6CxzMhAgHSI8T7STuIKLtdKv5UINsKJmLF0HzSD5Z0H jHk1sBKBQwdbB7qq9R76UBjEB7KZQXQe281CtW6e0KFoaVemp5+Q1TMoqGolGs7E 5Poselu+NZLMDRyOa40lQ0q2EN23AUZKjmgG0kSGJNi2yMzC8bCTF3vW4xiMPk6v dgwy8RKdq4IQj2aYfKvvtF/hx+Y4h3DfneGl9tLn3qy7qF2nctB8ZDfyKhd8EeU8 1NB9uWrbz8Mb5QeP5JMdxL1FSTy5jcP3IKpJpOwWYYCyy8YQYHOpNGNasTcYGMyz bsU3OlWESYX+lSeAZXytkG5kLJMV12FNbqtQfZASzA1HlXohO2sIoMvYCa+BXRHQ NZntPYDvTRuDokIigpMGxM2f7/Q54fsDlZ8e9pSVGHvJ 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 Sat Apr 9 04:50:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12807592 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 6BEE3C433FE for ; Sat, 9 Apr 2022 04:51:53 +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=GKP3Q2x2GmhKl7ZeUopgUg1+nirr7AhSQT3hiVINEvnBwP5/IugkW35wlcEK9yrbg6gD4F0S/OoI 4MaGuqbn70zCHwuLiVN2tQ5gKm+HswEaoZ0JtbV2hYG2wL++PykwYU6wf2vZWk+ggH1X+gOSBvpl TQLtWxihLm6WjcAeMczjtgJ/zLasB9FHSaVy8YtqTbBYZLTz3XQt2e3QdT4i8XuLpECW31fXD0Xs NzOZZ9reTfsRokXGHB3kGdc+W6VuESJ+dcOX8PdtzfGvTRjsi4m//zUjz/6FN398kS9i94n6ryrX HhdEQduqyIF0SEq0B3sao3Bigp4zib6kepRzZg== 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=SX6ezwBn6lDLVnd3L1C0FkslSfW/SgG0wGdqDB2cfv2e6Hdend6GyUuFglJY/vYwiRJc2+65GC3W cip0HtCpSs8Qs0+TKpJqiUTEa8CQjN4s77kBRxb290DsdFYtCBgfZav3pPlPPifEpTF8v+hmMygh Ri5OMJHDvdvxxtKMYhHUKU1XZDh/XVto1TiYChTV8SeQ1iWgBKsZpx6dbfSs8ts8SurwtDlwaUzV VLlsBq2sjuxyhVhkAqQIFoqo61MD3JSG2WGXkKhFFjIaRDN9QyDI/HwLHXjp6DPCmhRe4eGJBCAo Bw4nstzSHhlvJxOgAwru2Wj6PI2dxHZXSdLKdA== 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 <0RA2004J42UGHE80@omta-ad2-fd3-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:51:52 +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=bvdxNtIBSK2e/CHWOJvjhJQ/pD ziWAaN1+H5rv0PFjwCtxUb32HQisXqhv0CfdNRRakGSvxS2SlGM7sa31KM+kznDnIR/AZLVb6CdU4 vS8DuWDB+gUHx5md6g+mCQSqz3crMjKTJ6PsdykxY9osHuidQtFbDkq6qQ9nvfWGIgIk4Rkp02Mzl WCYI+BDG1gl4hW/mPoncA+V1yctBgiee9+ltyBfbzQvs00T9mPYBlaJ4i/TRsB0Z4Fkgt4oIU5qzV IXkEEPpdqsWu7ooiuyvMhxa14Ribw7Jyx9BT4vHhU8n59256QhhUPR6N/0aIFpZCRpJfpeccBNtOP uiV7Ifjw==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:26 +0200 Message-id: <20220409045043.23593-11-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 impostorscore=0 suspectscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=458 spamscore=0 clxscore=228 mlxscore=0 phishscore=0 priorityscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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: T2joWuFSU8ypvsKaY1xIFfUB7Ga44Hww X-Proofpoint-GUID: T2joWuFSU8ypvsKaY1xIFfUB7Ga44Hww Reporting-Meta: AAHi1IzLqLhixU7IgGt7Y3I6WVGyaNthInS9fbYO+wd0MGbmu23nwraBI0NHU2V3 NMwtl1nAnd3Ntbrs+4UEyfcpn0V52pjK5o+6rlbDX/K8J6IqzLxpl44V+3noxqrW WxJ/0Ryk/zhILTfUIU0R+X2SIwx33w7uxU6Ndr8ptLcufuJcoSY0aggJUHUgvMXV TqDWCt7tO8yabBs4SB900xQlSB9sqQWMDKiMubDjf8lsz4vDuf7pBV1oT5m2Nv6s Cr+93yGreErvG1a6KEhlkFzVgVbNPSyfob5cYBqUbBzxoe2FTSuepfW5LUiZ46hT 50XU58MBizY65mzbVcrBvqalmK13RHSbpRzY8x2BaC8cCNJ/lcFJZsJmLOTH9I1v dfZsF/4XrPUW79VPy5zJQo9izz1lMBKzdtKB8MIc1oM6JpAa4eChOuJq3lTTnuun uMQivFl4OplXrgsT5O/vS/qvjgRRspXbsbY7ITFDVK1tNbiXsNtwSV6uAGa7b+qE hVXj8YyGa/L4o4h0B5ygt2eP6UMpQ77xZwAk22pnU2/S 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 Sat Apr 9 04:50:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12807593 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 51623C4332F for ; Sat, 9 Apr 2022 04:52:02 +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=DzWuqIaaucK1k/1kxE35Qk0qMB4s75XZnCvhvLh5n88zWE37skXTqwWMOtIBsET6bNOdnGACPdjb 0jLElUDELneEg1nV7XDte8mbHMSnl97YIaWSKjYllXxLfUmbPpmd+oAtS+WGXPPunIg9+S71/rox He93eYuttMuDrA9/kEoR9MW+CfRukdLwf22Di7bu81uCD7CKQavZFB3MaKcGqc/LCmCCpY582z0y ymIPUgopqudyy7aRzTnuSO7PiLivcyF15i7+MNLUm4cgsig1phaaYz6guuFKE8qhlv/3IuR+JCQ1 2cTx/8ryngj8ArK4C3q37JoZDXb1eJDydCnriw== 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=A1mGtCqA6c+c+O+y3zi45HQ6a4y/lX1NO3iuCs9mKWH/qaJgf3q4Oe/itZm7y0HpO1T/OSnSHC55 2naDBBJ5a7r9KrgTvJnbfdwYGtiNs/92rU0xEvYVWxX9sraaLgdzyTFZEzVchTLvmmcKp8ingVq5 sW+61fKH3Tvxcpcla5TFJFLbga+SOcaiXLv5Z4QUzWpDN+DUpgWhnTq8CqNJOKnn7i3nv+3+lpoY EuZm+NSoNsWQKHyyLs9eChgAZjzs++oDRtAlXHg67ZENKtCBtpZxVnGdYR5wktQEMlyvq8ijM+IF DRDbCZry3HZTAkauIOVn3eQUzmv+9azjaq54iQ== 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 <0RA20058G2UPX5C0@omta-ad3-fd3-302-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:52:01 +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=t0/VFWQlthrg9ygdtBQvibmrtw LuAylodlmYryYYUrMFw+2E7ZI5/Nq3RPLajmI/sJOOANuV/p8y8jXZN9h723Ey9aR6CP5rTxfbRrr HuAz3hVO1/AFxLmiM5Wzc1FzjN390iT78tp1sPhD61fljInCDQYIAXixGJQUZcGA9CdOLnoKsm4+1 +bPP76gPoCLkZnj6nQKNpV2BXZ/SNnWDXNRm9L27BxTM3H51l1sJ/IJZihGZ7lk1wjRXmX+JN2rsw fyasqFUEgGEDqBdftLTs06VMMbXb+A4p+dlovB84cg6XaBod0TxhfjVz6byOWHzm9QbWUe2lXWUhy 7thBMaGA==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:29 +0200 Message-id: <20220409045043.23593-14-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 127.0.0.1 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 priorityscore=30 lowpriorityscore=0 bulkscore=0 suspectscore=0 mlxlogscore=782 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 impostorscore=0 phishscore=0 clxscore=231 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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: localhost X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-GUID: 2DAj69rTkxomkyAzwUX3QzmBG4zU6-tX X-Proofpoint-ORIG-GUID: 2DAj69rTkxomkyAzwUX3QzmBG4zU6-tX Reporting-Meta: AAGhaL4M+/DEyn7at3aDmubE/idP4OdjFw3MIw+utXEBBfLptMUDE/2NdiX0GMFA fYMhaK869vnHWcZbvHFnsh9ebxT97mQxvldZukTNLrJXcuygc5zDpZQLyFReBuTl AQAFBgxG2vFC//vQpgnp+zXfnRxFFnvr9Yhm2QSUYIuJMDWno/X7UzOMOByuMPR0 kJxBi5ikyilmiPyZ4dGni31m55vN+bPlJnfJc2/mNhfzuP1kIfpv6HGqYb9m4hcN m2ekEJpIRIyf5J/XT/vS28dprjoCNnW/J4RnzV7sj045XQMiv0pVLZX2Cn7Gk+ej Q/Kf8NGJCLd/gnxwggrejdr6iRSaAKZvxdGUS/STuEeTbNTgS6MY2Fhn0/M/QN68 CxnXU2+LlgUg7RfiGu6KoDLvuhj7TMnMavSol1YFxs6eVqnUcJaskRqGZNT+M8Ih IB0OANyAHEEAPavnVzQBLQkCpQDL+7bqzvD6ouGq4Skxuc0ZDe0p7ejbL5LuvDGM BMEiV0BxmFgzJ7Uc3USyV2HQs+88DIh3hLwswQZ7Asyv 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 Sat Apr 9 04:50:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12807594 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 aib29ajc246.phx1.oracleemaildelivery.com (aib29ajc246.phx1.oracleemaildelivery.com [192.29.103.246]) (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 01E70C433EF for ; Sat, 9 Apr 2022 04:52:08 +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=PanAfvS2rvSy/Tk3m6Ojv7Ej99OAW/h1bDRRMoYl+v7ooz5pDfPrbjyZg+AXZ2ARoSWUEpIljB6h RF29t/lDbmHdvSO8RuLKIckLaGxR1S9Pmn5iScYZhfC0TI24h40/8AhFIjDjAhvcEuaq4kxgB7YP IozsHd0I4XLNhausA7MrT5ab7TMVnX5UUEamT7epPjAS6PNWRl/Te6xpxJcxLKAzJ8yUPLNKpadV EpVGv8HbcuyISR0aWhvGtnWYEOhFVJ2SLMjfraRGUuMWEM7X3kPhB1roBq+gE+IeMkkbHQd4Nwv6 kjP4MgHtaW+nzFUxRhbEdq2uk+HWZjHyt2ZD/A== 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=ptaQGzue3eoMPTQXD2SQdS1gKvNkeqfQuDnYMhsaP67KrDMuLkFNHvXt9TeT/QLTqUsj6/KRDdyn 0/7PX72HugN/S/hNB20EekeWP6uwo7hszG4fJZRu7OJpYo4FpdVZPiSz5oDijTpqjNeW8FvSMR47 rN/IU8kltX7S5zvmZO9rfM46Yobq9R+UHtOCelnF8dthDxjqBgnb2sWHSvCAkGp8kEkxgV4eVY1O 3xfIp1seLyPvwezn9hvqTHitnd0v46CR3tAESXw/FJg6ltOlfCSQFXAgLULuJzAExLiAmKu0Ecjj h+9noCehB7rrbJSGjf2EJR9oh/PgaQcsc8tC2g== Received: by omta-ad1-fd3-101-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RA200OH32UWKN20@omta-ad1-fd3-101-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:52:08 +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=bHToJbTwXX9JeK0n0FFEHck7oK nA96qn4tsO9VvTxVN8oChK/ZngVrRM/0RF6G9ra3tv3c4LiSpAW93VdnTUb837bG7nj26lWP035AX +oB1LRxVd3o4RNZBzKIPVYYv/AqgqQH13jSTRjPJXLj+fHe3sQ7lQiOs0AqFOPiV0QvmbZSG1K8qh 9AilEZ6nzAlZEnIp9Du8I20RfuJmhuvcocvyHX9G65n9qxdF8wS5MzRNFD9kn7Nula/Xd3cMLnifm ikockttcbAn2ou+cROly75gq/5PqLm1F2FPp9pVf438qn2667h4Aje3z8zrXhBCgwdMkGUyOJsCBu B0U5qlrw==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:30 +0200 Message-id: <20220409045043.23593-15-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 127.0.0.1 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 clxscore=231 priorityscore=30 bulkscore=0 suspectscore=0 mlxlogscore=821 lowpriorityscore=0 phishscore=0 spamscore=0 mlxscore=0 adultscore=0 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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: localhost X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-GUID: EL-gAWYWdoQkptaDOhP85Fytge0tyGaT X-Proofpoint-ORIG-GUID: EL-gAWYWdoQkptaDOhP85Fytge0tyGaT Reporting-Meta: AAGYUbwR03wnJcf9syls7qDkPkrGJquYqpqGSkvddjM4z9O9rws9yNH1OGdrJXlo sJEH7cRSG+Yo7QSuIMgk+XXXIBylt63VZKYMpCELIaIwEPna380OKBAU4I1s/KTo x6z40TIKAsSxx1VA/tELGO2mr8/BrcinNeWY6gINcbJedCAlXJhpgujov/6pT2g5 fdRnaaVRKjk3PscLxchf3x5FZeghtjD9ceU86FaOX41c11XvfxSpfTObWquQRxAZ zmAvoIBFKi0I5tecbtcQ8LW3Ff83yRlVsyjlQtPwnG2FHQ41H7Pz1PfKT0iGMvkN L7WqbL9C/wZmoFKEXIEpopBJDGhexHPUHEGXQbmOSwQC1KMGuQcr9ELg0LWTX58+ WefSnayxRmkqGCcalxKh7REc3AHrgQ6V9Xq4ncPEWAeDl/w4ZME5y03KaaEM+PuS gDkR3QosC5uVAsPQ/wOzfAvgTzbyC4AvRgUaRCN3V4dHKsXBrDfauHWe8tuhJptg 8A6Hh6bBb9LVWFNKNPEfFUm2ZAyf/7ZD90TtarrhyRnw 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 Sat Apr 9 04:50: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: 12807595 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 aib29ajc246.phx1.oracleemaildelivery.com (aib29ajc246.phx1.oracleemaildelivery.com [192.29.103.246]) (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 0E0A4C433FE for ; Sat, 9 Apr 2022 04:52:19 +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=viN139iyDmfU6ID5+2PE3KfqysiE3lAF3ha68GPRYl57+AfArgeDLxeI+eR1PvcadQq8i+9x5EuA +A65bESTIHDU+s8ne3/VN+zbiaHHAjR95IG+IQGozG7XpwYZ2iKkkz1vlSpr9Y6FQzPrd/B5FaCW 4ro1PJWgZ1xUtVBuumRJClj+G+d/rfJrYDy7ZY6TrQI5bhWZaqghHz3BuU8AeJd1BLQ75hFfY1oy F6gKMwoBNlVvxyfDd/TjWKj1PUaZ6gQKkmK6V2lmo9CY00qdKVTB8X57rxaplfzjKg5tyio6B6z6 rihRPq0LvIIBVJqZykEjNbd50ok4fqRTSqAorg== 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=qafpUkDoU9D0gbV/80fPnlva7Jub88B1m3qoQ6rJGwwsYeIhs6u/XePLfV8V8UdIzYr5Twvnu/um G9MnfPdMs74BgXOQ/m9NRA1oZ2F3ShYGh9M+Ey9N39eETIG6G+819mIWwyVsbct4OMY+f4RBYmTe GDRW97oQrO7t3VhBIQFJY6fOzOpUeoFWMrviToPmaqmeCbmmls5yrGO025UEVlRMGo7eYVTpQLtK J+FYqtaXQKGZfX6BU6fRIeRyjp4O5lP7MKzwaO5MsgLu+eur388z3k3kLAbhIPNyuSv29hTIJHcr rkxHaZbIaPM2K89IrXiy+o7ArMTlHBHOBjxVqA== Received: by omta-ad1-fd3-101-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RA200OHP2V6KN20@omta-ad1-fd3-101-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:52:18 +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=tiIaiEVMWAbVYZUjb2lOkfyysx dbx49Qpm+lo+UUevAGrVDIkvKOBa+44snHlQ0a+KaxdGF8tKMoYuXWs/fvRv0ae96tcME++4ORVYu qYaC1vBwLvlzDvH7/c4A7h9mvUaVl8+MzbhpnW7kmDycYjo20v3XRILfplXYTrbZMX8JEk4N43tKH ZGQP+OitiIrdN0xV7JNnkLHd6fyLWakKMo7lxXmk9Yj+ODdh4QMMFZVM+vhTm4zDm7nCREr0fmSsA waBKGG0G7evAOkXMc1HpZXEoglbkXIOtFpSCT7RrqLEic0YOHBHXQ9EKk4JuDHcopl0LFeqmVS4RI X94UE+Ww==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:32 +0200 Message-id: <20220409045043.23593-17-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 127.0.0.1 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 impostorscore=0 suspectscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 spamscore=0 clxscore=234 mlxscore=0 phishscore=0 priorityscore=254 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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-GUID: GtHTf4woTxrf6MMswXTSg7DYMr7SlHvE X-Proofpoint-ORIG-GUID: GtHTf4woTxrf6MMswXTSg7DYMr7SlHvE Reporting-Meta: AAFQ3Y4DMhQgdJqMfnK77xkwq0/oyZWlNhuSDFad4CAJtwFPUqH698cqTfSaqjSe 9WnZCDpSF8XO+o2ESCmFzll12eAB8kj3CQAdpd3IvI9rbVMHw05a89QffsQ3+oFS FYGY+x8FQFEa4Z7FxYsG9m/PJR9Fe4eYBDrN37pN9Z0XzbMddrAQU4EOfd3sSJbn fEJlpndQb5JPlzVvO4MUixiL/QtM3zR03CEFqAjtQMXESXepxl7sIr1aaodRWHhr vZkT8azncr2S1sQUmiPgnTonGsN4rl0TZZ4wJbyMDG8SEtN/9yOn6VIMYsypgmJR p2cj9D6cOTBSYb50nZL7LRthtACPYfxeC66okIFTaooQzxpMuOqaggGBAwtMlcv+ JE7U+7L3xRx02hP+p8yOJrlawGjWEdSzfbovoVCtgZ4CzYDmEL76CHOa9WHi5c29 2SVLKZZIyiuKIqq/3odEXo3TOA9iBNbSaip/n5qP1deLCanwnuHv5bYHdskYn3OL 1Sh09CdGqhWWHoUgPd+u6+gfgKFPuviY4pKiyRTq6dsh 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 Sat Apr 9 04:50: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: 12807598 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 1AAB4C433EF for ; Sat, 9 Apr 2022 04:52:26 +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=P2sTUZ5G18vB0LIOw9VoNLpFk2TXvI9xdIp3rYm87a2YqqpWbznuKDXqqUxXDyun+QLFneMK6qhN 1NarSxptWl/SMNj8FJ+gjPO5NBzrp5BImIXueMERyg3HDEKTRd0CJuac6BQSU5ZNrFCg6vHm17Mn fhGptaRLeEzQA1822lebxV1HeH+8WZE2yUEusiHT/iF7P2I3a1lH9yI4EaQZY9sHzJs4UfrlIKfh 5r9jmO0WckJ6zkjklRGIA7wTN7zquKngYo0RzAkIgHqHY1o4zl44o4Ksx/Q3v0BcReCrzTP2e2H+ 6qTqvAHGew5Zi7QYEvqHFxMZG6WSviAzRYJtBQ== 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=eaRlrxuqktvheSYn96GTPkoVvQnly8oTCov2ukfnLREgsJtRAoHfcpNqcFSS1CWRQs6zCcVnGA08 kjPL7u0tINdrlE2VOzpfTF6a/HzasYNR7BL/FD+cluTCyhFWlGDocdtSotytWTDoLUJOw3CKZ0bF VWDPtkCSGCnq76pnGNYf/u86bC65s4hlddy12BVrrIj3U3VTd0cY/lpeVaTzgmHYLlG+lLbnJVg0 7GMPTiOQvY8hww3CiMbeoAdWs5ss+2DvRElo+Hl+ukpA7xTVGmYD59JZRAcUYutSNkX9lAPExVXz RWC3U6qx/YD8Lmz9+3BA0cfe5AsMK2CdzotbXQ== 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 <0RA200AMG2VDPB70@omta-ad2-fd3-202-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:52:25 +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=ZwXWqq27tMeyVdjCd9/fIV+62b YxoMIWLS5QBW9+N570g/a7MqnPHccUJQp/73S/ehTJ9VEsGu0nZXpLT2GsIb95dlGJnKSkFIT7WNJ Q2sY9of4Z8TkC7fc/FklkIOgdhls0Ao3F7MloWBwUhbTcUSp/MjOHIau/ybVaMror8iobGwcOp0AA +a4GNDWpu5gRhJyLqGbdZW5DNs6lIAJYj08W7f1olcpdRSmv2+7GaRf1xJ5QApQRYFU40mFosdlZy 0ALRAEA3rIIwBWnBlj8QEgYL1eIM3It3IcCM+Tc/eC3LmnRLah4kAgVmx2WJTHuXLjilmSIpHNWrZ 1FnhvyJg==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:33 +0200 Message-id: <20220409045043.23593-18-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 127.0.0.1 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 priorityscore=265 lowpriorityscore=0 bulkscore=0 suspectscore=0 mlxlogscore=927 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 impostorscore=0 phishscore=0 clxscore=234 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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: localhost X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: sJ1REQvhlLDYPFJepbRNtMzm4OBs9ijp X-Proofpoint-GUID: sJ1REQvhlLDYPFJepbRNtMzm4OBs9ijp Reporting-Meta: AAExOUvFAqsXTEfR/OODF/yYiQm59NFG5kcqK2naHn/u8uOM32BshWMCPCWHW0Ml nL7xzGb/CJA5fiYE3tjv3ozJxoIFJkxJyBOJWTNwHIIR+xdPAtZOZ+9YjU4rclJx ANx2kcPBN6hiWOcTqmoZAYX8HmSDNY8czGnc8hM0He6//d6NuCcUiUSabdZdd/BH gGjrZD+j11y70klbST1w07MqooF04f8NaP5UTnmXMnjecZ1xEJCfpzPxkDiaGYVD JQE8jxI2sQXRRY+kYf50srbBgUgZLRF9/If67YnK+O9bgxW7oO0zkVeRVaTno5fk 4uoprHdg5jtwByXqJxXOhIxGj97dyYpXBkShLrahg54haYIQ7+zDY8Cuxr2i5R86 hX26FwFY5r9JWnlIVtbcYbqW1okykftH55D0d5gUHA2WVLpB3wzhMli0VAZxVAJ5 Y327ZYZ9DRuapkXu7lob/1TmFYsljs6pBCkqp0lV7wO2elLdHqRBYbjEy/8Dj2Fx N1kZRoErYvVCZrX8EPB9pKHWm7Dbiow3PVaI6+Q7FrY= 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 Sat Apr 9 04:50: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: 12807596 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 658BBC43219 for ; Sat, 9 Apr 2022 04:52:25 +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=TA3XIrp3M38mbygXVIN9LLyOswCcHH8BMuM4Y5Q2U/JEwGwLyn6YQo2rijJXAMjcsqpIRgZBGf9B k3bBTGqupHXSzH7FYqBvOcs5J/JikaZ3ldOpYD9VfYhcf2yj6GKobJxuFIJHWAHU1ZbRz6sRa0qF loUAgiOxTx683DvJNrDYupeO0AelKnt4iGODQdwl1CaB32nWSnwBfZggNkVn1NXDsvlZwSPp74y2 /pH9GchlMawUTo9LkfiBGggS8KkAoh2ht0Yv3qSO0UaUk5FmSfV4DJtXaziM5ePau/yh0I85hiwU jS4OJx+N4KJhmwL7l/v3qJKOFCMLurlxClKISg== 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=c37DhvLUSJepeeOAPr9oaotRc2nTcpJmI+RHlIPA6CYAeUlfUae4czWvaCl2FgCZDTO6+9Tv0+uG CIs4hPF/EzYJVisBVKfmGcushh5cIrbblYlxHKq/XTRZ78uFkxSgNXYIvrgupPxbl4K4LSAx3hkA oxIvBGJJBtTcgtuWfi1jCgr4TO14Sj2+LsUP/0f7ixjZ/+Usj69e8fZQ6+i0W/QZkvIvlmlhGk6U ZL/kxlyeyYnMu6qxfCMkkef9XYiuM6pDXGh6NtjpSlCXCfozHh2YvIuUJzyuut0M6yzNk2gyDrT5 KFssMigGJitgYecUJu+sG4Y0DHtunw+gxqiU0Q== 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 <0RA2006G72VCY7B0@omta-ad3-fd3-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:52:24 +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=TToQ+IG68ZTma6i9nDz6xx4LYK D0aw9uFluTWmoLPN8wS4Tw4ptzJ/n+LwG2AuHxcLmQEWYx1aZe+l+/EUb07HA13ebYd+zXWtHqs00 wx9o5AAPH2KJPl0+jag4OLclg/JD37wQiqgJHq6T1H6FWx+UFz58+SDkab9YWBuWtwT6h/pIgt6FR AzrhjmPB8W4cd/F2sRVPHfKdDw0YBBrQTFPQ9a74BSKEWHHl6H0cqEhdUPbu4a8zWq2vD/QaSCtLv QCIx9f2iUsf6SUo5Q4SNMv/t99ukC9ZdAasasKnk54ghRUz188l1onQf3RFgK9e1sPw7Yo1mCiQup PdxOz5qQ==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:34 +0200 Message-id: <20220409045043.23593-19-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 127.0.0.1 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 clxscore=230 priorityscore=78 bulkscore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 spamscore=0 mlxscore=0 adultscore=0 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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: Emmi3gecAujEh3p71foqIjRBa1BNrcVp X-Proofpoint-GUID: Emmi3gecAujEh3p71foqIjRBa1BNrcVp Reporting-Meta: AAEbaJwZyG7UVotcEmXCMu7Q49e2rTl+1K7MjNzxvfdj2Z8qeibhBa+5VuSsHX0h CAbfHP7oljkPrpgS+pvfeKsN1DCGDCeic0zcV6h4WSDmY9gM85qhsDvgaQcIRF46 2S+lOvY5VJcw6O8WIr1hz3b1k2d5906VjMTrzwTpXs5Ay85TXEFHCUuOzkrPvjxv UQOBbXfZIewfRroRFROoTRc5W3CtVtxQZZeF1JbjeKokh/VS/CeydnNT7Iv3Bh8B ue+ArXC3CGM+AYXAUdOGr1sZ/rQ5d+nNSTjXb+XeIxqWpVNnTvlaE8MP6qY25JFT x55dMqwz7HYoCRv6eSq+/coEDSlTZooqUMEML7riwywqoRsIWozb1Aa29WZHNK7z 1bhBZvamDR19/PK0x/V/pj4ecgqYIwfc2SOW5bv07Kw6wH6qRcnhgKLgFrRA7giZ Vi+MDk/B5XVe48/pgoYF7MeyPiEhbMUbuydhsaEO0VeZHit9wijHBUZB2P4m9Rx1 /agyHscuE+zNsPirylSWFAqJ6TjDQL7Fj+JvDjHc39ZO 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 Sat Apr 9 04:50:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12807597 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 75295C4321E for ; Sat, 9 Apr 2022 04:52:25 +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=iWe+g7d/f/odv3CjV8s/Il6ECxsC21+pTFi2gHt/qq4V9qKGpD34vofvTya7Yq1HljhMqjESarMW NTh8lRfwvbxTrN4JGue1su6YWAvt1nF6REM6vh8n+Q2rJbQugHWWkgapmUjmp4EX/0hrCc1rF4DL ydiUutQueXpfz+4IGR0NK2YDWIYPoJ5u851IEscXs/PuNhtqG7ecgxPD8tR2Tk0bcB/8/BLT5cQs aGApB78DVkh0IKunlqbNU3WMeYzduhRDFnsCD/+JT8eIltJ7q50q5JgQqV9/+zlaQsdxjSlN74yN EBr1/8CNNQL/yEMMJdhr6S6noKtLawD7LFb0Jg== 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=kzBJSkd2iZz1W9hY3zwGAdBkftZBhQBbY5YMnnUtJEKox4QFmVRqDQE3ZvbkFaOjhYjhKgOHUdKY WkajOcLNxNmog9hI0Cii9FLp9iyFEWsrr3GPyikcE/AE8vXQ2qh4B8EAbFTAdHj0oZP2N24PTMx9 WVqQGxIl6LKakwP2BFBFZYNGMuK01hSzxJ38JVo9QnyYxfeAmUqOOOvsQk7q120dCcY93PDHaotd 0MUaZSxlgp0zvwEo7pvaRUuVgEb/vocFQihCB+fdSKvYP2qFSMy3Jymhz2LRbn7M0pj5FcKke2eV +5WeVGmTTeiV6eRLOb7Nc76PI2hL7vVMCb7UaA== 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 <0RA2004KT2VCHE80@omta-ad2-fd3-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:52:24 +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=Vg9G4nec7vlw9JzY8ZelhLqst6 ucW6GkU1kL/cckjMXF2Ml7hSDWPk0eXkPWwiYReqkgU31v2L8/TZCAwJcIAknq29ONqcGwBOqoyy/ WYEExBpIUNCaVoczlTCCzWmGmVmLb9sdCt2/KpA+J1RiElt3I5LUNJS6TppQaHanfTgucuVfWVEqw AMAgeT/+i8cp5mqhw5xpCWTsnxLqKYlbYbpVf9dEsk8jlTsF0YqgExniCnZNX5XEO12khG8E+nclP kStumcAwUmqAnzRWuX42XMeJAWn+kUo4gGpuhFKBWVbZUS0Ww7Py5+qQcuSTLhz9CYlA7wF2hyPxg ePGLsb7Q==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:35 +0200 Message-id: <20220409045043.23593-20-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 127.0.0.1 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 priorityscore=85 lowpriorityscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 impostorscore=0 phishscore=0 clxscore=237 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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-GUID: vJEpwNOS2OiMzmHbiG479ficb6GNBfpE X-Proofpoint-ORIG-GUID: vJEpwNOS2OiMzmHbiG479ficb6GNBfpE Reporting-Meta: AAEYvo4z6+y5JcQb/QSCQ/eLEPBi2kOmBy5cURIoBAi9Nqy1Pxrihp9MWqVJ/fK5 hgY+CyE/nyt+slE1Ay9aWv3d3yKLlbc9+L3TiqeuQQTZr9qC8Z7LtwAhF81i9u46 0+zhCSwgIfw5WJ8tyVLBeGhwR3cWTwj0tGoNkgXmvGSEy+Wp2ko8gaKFaJZx3n8B Uy7Uh0XnMINdjPbJwrp4DkJmCK5iN2G1Ve4Eu9e0MZ+x968NyuqF7G30V3TrsVDO lWLc+90AKZRJSD8nDXhqM1pHq4Za89JFQN0EEZkwFbsH0VeyORpRDjMD+xT/kvXs 8o4YWsNVbRu68txcWSkW/6MZrQ8SJchvs2FoCI4tOvkUyFGyjoWow0JOwksdfCzi S9zmV6r4WaQ5+Tv3etpy5gmmSUzeRIv5ibkT0YP3aakXi8yFhLREstS+HicIc0sB 4rMQGvQJIS8IJ+O/Z8+fRLFASH3jHmCxrZokLGM7r0BO94utFSH7azAU9w5hgRrA L+BqjU4Db0+dcGU5UI0hC2oMeWqIi26gLwFDOxuQ12c= 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 Sat Apr 9 04:50:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12807599 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 3AD18C46467 for ; Sat, 9 Apr 2022 04:52: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=EhzRMAliWQfAp1Rh6krPu4+eAG1WRlU9Bdv6/WRPHMQ=; b=MoIhSekCGAmRbZ5aLl4BlEgbWEUBHxkYh/bLnOopA9IkEBcFTnq7j+8yuWPcVKEcQgqiOoNdu/HO xj3HlLfmLA6bT74jbHY48+O52y0i4vg/HUFE9oN0LYc7nZlnlJePrt3bZB3ecxQC1OW7VKz0ZI+Y A/b7kWUIq+BlzCbHda6NTDYxo34Isqxp1aTKHGer5y9P86KkfZzxfHvJAmxcHPNo17iBVlr7uaf6 eg9ltDT77ptnOoBN5AoPZwb0123qFsqodDH6awKSO/S0KTSU4iefS1fhZ1835AEbR1XaRMdvJuAP 12BB1CuvcYqpwr4Gn8vS1tVhqp0k+yqqApYxTg== 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=Jm/kYUCPN70e8vebKGx257R1RTSYl8+aS1ojL6tzPlH/7G6w7Ew78SHtqkQJCQV6LGSXS5UIkCDn 3gUTsZEVmcf0Awy/btvN7fC+JJPSiQkH3uV6Lx4efoJOIfAMcag1eqd9fdql83s2zaEIJeUF3mh4 jOF1mKEZ2DlB1HAHxhETeph05SScQyvPtF2+70sqDkXaLXgx6w8fMqoGz+aEmqudtBsRaKVLsLsA DlMG3R3Yh9ZZXvzlDvHfkq6mHMqQq3XsoZpDUcWDjvwv/95k38ZiMXWGm3oH9CaaP/0kc6AJFb/Q iwMxdZoKjyKjl3wtGQ8gTnguhYHEz1dBOEXZ+w== 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 <0RA200N5V2VGZJ00@omta-ad1-fd3-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:52: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: 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=eX3MLxgs7+LMLexFHqIdmiQ1Yi JdldSlm4poJNjPdmeRgScog9CyFDEOKE36j3Y8GOp25ZxOav5fY5REWK35ZSyRrUZZpvLOWxApha8 AqMJ/MRcKr/CciLBe0jYueVDtJe90F1Pdg6qhOzgnLBHrJsW74l04GpKIl/5YuRS1FbaP4TBsToNP 0GMgdPs2iWYbeYRMarbkSLZIEMdyAXHMZf+OWZlI5UmjWZF1rz7GghGKiiX6rIFIXD4QKrdrCfgbK fUs8lbnQ+FGDvl7FzdU6CQADQv8poqc/NeAD2tkAuI0L7ZIL5HeAN+izt/vpd0COwgfEQET8Ojz2e P5cDct/w==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:36 +0200 Message-id: <20220409045043.23593-21-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 127.0.0.1 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 priorityscore=0 lowpriorityscore=0 bulkscore=0 suspectscore=0 mlxlogscore=893 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 impostorscore=0 phishscore=0 clxscore=237 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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: localhost X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: z0CH6xLf2Bz_STGzPzRM1hC49C9urDYr X-Proofpoint-GUID: z0CH6xLf2Bz_STGzPzRM1hC49C9urDYr Reporting-Meta: AAGd+mS7qnea2yf0mu2jG9OHBi/K+xS/+F7NFK+hYDj8I9opzM9lI+5b2Yfg4Zy1 qw882c8sXe0WiavM7LRv3ZgqMkYB0i7r1yJzOpWD/2P1H8uOWhb2fJGEi5jGjP+W j3AzivXprhOmLjaQGchvCXUagtdv5qvuK0AxwJZYUi5sA4KjKhvkzE21lH/kFu4c 3YE4tlAkqDpbP/BlN9S0WBwrMe471e+7bpQl1Q7Ua8JN3INg8iPyFp8YAq5W7XiM BcImwdUxRhn0UoKc05St04Q0+MbU6kauhOwgpltyVBgv4a8WW1bv5mHPxkewXH6P UrvMZnKu1v6LzLth75dVbmoV0ivaEV+aPQ7h4v0+JYIO9xi6pBrnGDGEASmiOtmc CVu6A+Y5WKzSOMB3BKzvJAwXC0bNg3qooYgPxG8DHMXxNbX5tsFKR4abbi49Euhv h7z3ursyevj+HCuYh9xyJnJW9PRJpGdweaZibDDAXkZVJ7p+Q1rBqgmM8UW/I6o0 Xm0mNeNff0e5bL9DNEuiETJmt5QcD5HQWBaaoViiJ5RP 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 Sat Apr 9 04:50:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12807600 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 84F37C433FE for ; Sat, 9 Apr 2022 04:52:34 +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=X6vmY7q1f19rWVvniGuNgkDQ1LgwKP9GuhfmShssINC+nnZeXJOFVBimcb++/aiHZveZmUw3YYqz vmwautoWIrzf780pCDXbcpYEUrRUQaS5HXB0FckvI7DKycOaYdTI5I4OeryTaiHoZiAt7hlrIZh8 szTtz8eTI0uKSluRehTgvic8VAxw06Sx6p5lUFudkqxd39DrBNnEznLr5R6bOmRByUaW9dq72qpm GswfdJ51IXK2v6xctplBGktWblO2166HtzrF9IjGBJyu0EJ46Ktos6dhhbvq2CIIe+mMf9kxYwuX ALdkrHKGy/Qxu1iSvEze86aLyXM2Taa2Lkv8sQ== 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=EAmfNjhRXWCW2ftha0QVN9QYm57YlWwHpuQC1py1J066y2f0992Xn972YpJTs802Hy80lW7fruPm 7t+euv5HTmdb9mdbrrks/YcWJ12jvATw+yGTOQcsO9IxadWk7vT3J/ppNY2DhojgJL0cZg6U+vx9 5fxVZicRCVhNVlZVWZo13LKhMSXZYxaJvSSRAbCUGOl9SZ4/bcWO1ZWbaNNfSSOexqyemhW3YVVY G3LdGGyM7geX3qnHIqHIMYhNc47GZCxs0/mcFvgOrWF4Wb1rIxviuwjz0IXaXCMQ7cCaoUNJJd/T OMN20yrJliEWWwcWo/+50aKZnqjvcxev+Ch14g== 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 <0RA200H692VMAE40@omta-ad3-fd1-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:52:34 +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=y5la5uK0xpIhSXtbBy/onPBwBU FwHrEP+WgCDZWr9RLCmtiWZSBy3JZlP6LxFpLTBM+Nd9/2cM4fDgGet2bc0H2JEDJaYCnGjCubDq2 Hs9FWJmFBvCUS8AQuenxCnFR0cA41FyTmlSTltbkCVEHfSM9sSnD7oPEGCN8ZX07uJjnHoINaZAsZ npSJrgPfthjgK/j1zKU81zTY86HdQv5lyyod3YfTKkYVFRwo/gHNLmU33ucR809tSrrS9oMBFQRBz lw/QH9mmRBGuHmyXN8YuW/Z648JV/+xEquH5iy/QTyXSZMkqO0YMVV1cNnL6OuVpWP4hui/t8N1mQ LEn+3oVA==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:37 +0200 Message-id: <20220409045043.23593-22-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 127.0.0.1 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 impostorscore=0 suspectscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 spamscore=0 clxscore=235 mlxscore=0 phishscore=0 priorityscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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-GUID: EZDxTRl3U3B_zk5y76i5ZIV8szW5yEwf X-Proofpoint-ORIG-GUID: EZDxTRl3U3B_zk5y76i5ZIV8szW5yEwf Reporting-Meta: AAEkcv24sjpkyNU35BOp+ETJ2rWlvMR3b4Mhqs397MlYdLaQ9bTXpG5J4mBLulWK hRfdMQLTHJkFw7ebVKCWt5UIzQcriSnXI3cltjQZkIXQErA2GJ1F04BhiJKo7ezf z6X7G3Y9Lme8Kx8wrPdcWYhknjvwYBP2BjCx+X0AKgE9H5BNclgyd07B+3aDBeLi dGA9gHkItT6Y9gUyi5y7QskTLoEQ6/8qMYoxSXMnank0Puu+37K5aixctCb6eZDp 1YVC75jSgkTs9M1dUlPHXFg/G9jJyJaRMWMn+32WlwxBMqrgnianiQB0x2K5Hmi1 ZvJopugQREaVPzL+D7CNjaAgGoK/BmNotYu432CS6YjnrOQfBHzjjWmeJ+d301NS x8fiHb6+6d6t5GK9Z5Qz1IYF0m0Bjx15oWGqBkREvRCy1AOIY05Vw2aTfFeYQXlB UO6Wy/F20KWb9i1z90umHl29/rZS1XjO3Gu7XRA7fvfHEe2S8/L5TVOKwX9JzBRg BFV/YSghWntXG+/uS9SivYj7kiuSZgNdLAjCnTQDhv1T 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 Sat Apr 9 04:50:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12807601 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 aib29ajc246.phx1.oracleemaildelivery.com (aib29ajc246.phx1.oracleemaildelivery.com [192.29.103.246]) (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 72934C4321E for ; Sat, 9 Apr 2022 04:52:56 +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=daJxywWh8mGxpC3UGIYlY164k+NizWepxXQTlsblmupr5669BkGO1trkSaIBtF8W3cWLzpoR86wW mZuPfXc43vlr1kQ2pX4EPKv+Npyd+KGfsec/ENzd+L9CKnLAWFaP/qyqPmt4Fam6ZrCdlYTT1bwB EBXQV/hd2qEkXYcE/dDb/uCxCnCD3czF+WkLQ2+fzFREe4IEabhW/fuDdJmyVMa/oFnUMOWmPNyj MtiI1v6+5tEDrugLl/yHyr117tEprymWF/Ci7EyF5BFDWffPHPfPoGtdKSNARXAbkC1TYa6bSKjS bfaTipzZzWzfQmidW+Rq8uwCXQDKY/dp+5ZHRA== 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=rj4mNU9LBEBoTLee6mWqjMxYunLRsnp9LYB5wNkKgflOLziEA/0qid2iDQ+ztTR5d91O2lVgyz16 h3ls2k/AA6Nhiao4OhEBpcTuPnj7/U8am6f4c2NUXrh67nJZlJZFwUmyNuSoU2FEHC1X7C3SA7kj bTfvp/GKsOlX2D3AG8uXrZMXQqVc/qqfbhg/K9OBAB7xZBFYVMxrrUNdStnMVfuBTx0qkTSTvBR9 GS6H/dmT9cAPFs4l6Sayj2S+E9ECURvzkNBFtnDOpcDcZCcQ4S+M8ec5FzOWfe4+SA7BaXnliiho hEHLxSD5trtwI7uPoSXmcVcVPUIhX+4g3Nt1HA== Received: by omta-ad1-fd3-101-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220319 64bit (built Mar 19 2022)) with ESMTPS id <0RA200OL62W7KN20@omta-ad1-fd3-101-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Sat, 09 Apr 2022 04:52:55 +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=nqH1nBV8lOr2r5wyOjol3g7s8X NGopilIp147x4XNnQqzR5o2YWkY6IO58VVUojmV/ASvSDXVzRQHv+BqUNN8ISkIuVH5Huq+5W/+g6 Fx9NKN7nsNjG6IaaR01B6x8gfqb84JVGaMt2Mch/XsNqmw38mh/kWIOczl1+aSfojYjwvPWnkVT0z zeBYxWSj02o09fDuqh1c1ftABUKI9QxyXU2GCBR2V2aNbgjbyvKcSUL75+QEIgn+hIxNaN3b6eMN+ HQ75AhIB7YFYQ9KIFGF2dUiaHQ4ZLNQzEzLlTd1WzYc4Lz5oFphMfcUxRdKyObtKnqHpozib+pvzE Et/uKlCg==; To: Jens Axboe Date: Sat, 9 Apr 2022 06:50:43 +0200 Message-id: <20220409045043.23593-28-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-reply-to: <20220409045043.23593-1-hch@lst.de> References: <20220409045043.23593-1-hch@lst.de> MIME-version: 1.0 X-Source-IP: 198.137.202.133 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10311 signatures=695566 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 clxscore=235 priorityscore=78 bulkscore=0 suspectscore=0 mlxlogscore=286 lowpriorityscore=0 phishscore=0 spamscore=0 mlxscore=0 adultscore=0 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204090027 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: a7uiHKUx0YCjqEejn87R6xlOE6kYHc0O X-Proofpoint-GUID: a7uiHKUx0YCjqEejn87R6xlOE6kYHc0O Reporting-Meta: AAGhaL4M+/DEyn7at3aDmubE/idP4OdjFw3MIw+utXEBBfLptMUDE/2NdiX0GMFA fYMhaK869vnHWcZbvHGDsh9ebxT97mQxvlcUPkeCx22sQCa1GWuHdate6JtQSLRY JWGc2G7OuUkeQCg93t4qS7tclQzx8gM+M++SUGeWiaoq21GGMJ3kJ2Udlmveqopc tuGiPwrby6tdyNdaZEe8NMGSGf/kJUa/h4dCt6n7omZu3dW02TpvwjS4Ifj5WMUQ JuxH9YJUmug+rwzQtUe6RB7Xr9gyN2y8TlW+u4H6qx9iAlphz7SWAfTVPRzawYpq ai35GxfTTFHYjdr3MXC5ilSZcgnBE18BCqhNDFjSCNMhdlrfHxiWKgrP1nEwoK8Z 9xZbyIJWoTMgEZrIh8oz543JXgQD5cxHe20GJwcG+xkMcUuCNLFWt402vCIs8XYR yVQr2w5717TIlf6cpxc+ZJk+/2+uxBIej/rAImqlE616S41pYKCC1cWoRP0XWMMj CpnoM0FUg6q3Bflps5Nc7aEgoP9zYCiLOC1wXNa4dJ+o 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)