From patchwork Fri Sep 29 10:27:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13403984 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4665E80A98 for ; Fri, 29 Sep 2023 10:28:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233082AbjI2K2r (ORCPT ); Fri, 29 Sep 2023 06:28:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233054AbjI2K2a (ORCPT ); Fri, 29 Sep 2023 06:28:30 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2667C1A8; Fri, 29 Sep 2023 03:28:28 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38SK92ww009603; Fri, 29 Sep 2023 10:28:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=cVuZiHiJsxm4zbLeUGXsGcN0aXuQSv3J86nYfRkukD0=; b=AHw+n45aLWAP88COCvnlkcGWLywqpcYoPdX1AEbHF1xjFpqf8Qx0vH8OUOHxv+ytm61s T18+CDcRz/RBJWGdYUnUdOZhaYNQ+ZRc82Ows1Vy6yzTlJU2osjFjqqKLwSQXehnPaTU +gXB/sDKdVTlr3UsIK7C3o3jNVTfMhAQZRuaBf5ZhRlF00xOkunEN3CF2rIX1IudiLBA F20tiB07WiYW22lkYu+lvkbz7Ct3r+k84YcEpoxyQJHOi7UDULHe5CmOBNMgFW0wlNBd bT1Lkq/DArNGetQLjzPrm1M5rqpd1LuxKMIjDlzRQv6wX6NGaC/OM3JRd+vUL2HeHkjR cA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3t9r2dpjk5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 Sep 2023 10:28:14 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 38TAKh39015906; Fri, 29 Sep 2023 10:28:13 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2100.outbound.protection.outlook.com [104.47.70.100]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3t9pfh4vr3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 Sep 2023 10:28:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LzCLXMdpPj+IT4vka/mnL7osUe0cexKJUuipl7r5s2LcmnuVgYLTCWX8Ap0KbGuIPyKZlheFE8FIsdtxSxxmmK2g7f8Y0g3yiYjf2z6daG0GePImK9BnYL8YEZHdqOTDtNyxdi/Q4V+CXAXtKG/Ow1iGwCBNzxdv+OqREgGVdbn552qGEG3WKYrZWSLZhYwbjB/QnCotaln0X+ygaRzuxW8EtUR5ed0I3OoouUh/cT8w+BZNtPJ4f3i82O0IX/KSfULmJ5RhI9Fx6NVZQ1FDctYOAlz4k7CqgCDJmx9P0YRbSx6OeZxbQ2kH7AK6K3w7EAgLcLw4zTZMdqbwVJAZug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cVuZiHiJsxm4zbLeUGXsGcN0aXuQSv3J86nYfRkukD0=; b=TX+HiTjIT3hGRJxiQQFtKRCU2AXEN4g8G75cbHn0Z/ET/OTnDaBZkZNbd9yVTYSTWJtE80iyBr5G4t5TUzIYYsjBIbfEZPo/M2IySfAZCdBKHv5cl5AMRQqIZjZEe9dRaWVnfYPkuUrXjmOH/9sKjJFbpYj293S1QJBDL+WptcXrFH16FlBz/Gft/8RfwZqIbTr+j2FJfR/W1LjMw8SZqRlUYKo1qz1W2FtNpHeaMMrfjEz5oCVSyoQDZidrGDqiujNcHyUqRvFNQ5UQLUawUn96T56k3/Yi8Dc1DH+PKDk2AMaAOo3mN0NRopbFxr2B2rBJbbGY5Wm2t7NUiQRsUQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cVuZiHiJsxm4zbLeUGXsGcN0aXuQSv3J86nYfRkukD0=; b=xbXLjL8WHByauy5ZIRMIXSlXSdeenEqmbHK1sv5VK8fIKGUvQPbbbXpCNtVTMgo/eEMQMWoi2SKYv4DELx3bSbvF7ociCs+v0eZ4iQP5lopaNy6Zr2f5IvIjSSvzv7tOqhkjNGsBOeG/eo2NwiTFpOeB33ilx6PyVJBkK0lRvr8= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB6153.namprd10.prod.outlook.com (2603:10b6:510:1f7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Fri, 29 Sep 2023 10:28:11 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::ebfd:c49c:6b8:6fce]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::ebfd:c49c:6b8:6fce%7]) with mapi id 15.20.6813.027; Fri, 29 Sep 2023 10:28:11 +0000 From: John Garry To: axboe@kernel.dk, kbusch@kernel.org, hch@lst.de, sagi@grimberg.me, jejb@linux.ibm.com, martin.petersen@oracle.com, djwong@kernel.org, viro@zeniv.linux.org.uk, brauner@kernel.org, chandan.babu@oracle.com, dchinner@redhat.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, tytso@mit.edu, jbongio@google.com, linux-api@vger.kernel.org, John Garry Subject: [PATCH 07/21] block: Limit atomic write IO size according to atomic_write_max_sectors Date: Fri, 29 Sep 2023 10:27:12 +0000 Message-Id: <20230929102726.2985188-8-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230929102726.2985188-1-john.g.garry@oracle.com> References: <20230929102726.2985188-1-john.g.garry@oracle.com> X-ClientProxiedBy: PH0PR07CA0052.namprd07.prod.outlook.com (2603:10b6:510:e::27) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB6153:EE_ X-MS-Office365-Filtering-Correlation-Id: d3dde887-7db9-403d-44d0-08dbc0d6c81b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vJf7GJ35ZFPwM9xrdi6jsmHBYVqRaVAwPIiBrg/Ki49DpbG2QFXB64RhrMpAhW6FdCblIhmZGEqG0EiaqVDfXhg0EnIVtzAKMvUh3M+wHKZPuTq8ji9xkPVsYdHMGCNzgtXl5mtlbXZ81cJCMlgr+ONK/EM8aVwrop5+S1VKH3UcT9z4Dk2WibLQwG3aSUhN1ZfGeV+xCrQgNq+qlzHWQVa4479cyZFA8t8hepXqMNG+iJ2u/d3LUC9OJGviL+wUSYEczsyIy3zapV6x0xZPK9tM9wPEoYHiMPC/CstQDLh73clj1nX1ICc2dluCuGgH+KiVY6YfSgAkTGCH7vE6nzH0myAPjqYtN7o8c3fw3N5pBIcLcG4Dp88qR2gfzJhJ3ASW4qCqODu5Yf9RavMNwItJSmaMofMs4AT5hHwIAV6ZJ0ZYMNRERgegUhuyaWvHhw6qpjoNHU1ao2vBM0z6Ds2VoEgHm/SyJyMDE2FB/T9hTiU5prAeRYkLnt2ir3fVJKZg7eBC+oBYkQ0rctqc6Q/eVcg8yqROnGNblmf9nXYYYc0Gs9vzOzRhW2UKR8BIcLdslvmVGqUH91NT1xBbDsV5ujQMkFQ+25k5rOcQ6ws= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(39860400002)(366004)(346002)(376002)(396003)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(6506007)(6512007)(921005)(107886003)(1076003)(26005)(2616005)(8936002)(4326008)(36756003)(103116003)(66556008)(7416002)(2906002)(5660300002)(41300700001)(66946007)(86362001)(316002)(8676002)(66476007)(478600001)(38100700002)(6486002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EhmaTwfPMi/+q6vSiDySN0uI9VDxbQkO+RUP/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EyP4L971ajEKoY13Gp7fkYEEDQqWSN/c7IkPOggsOusDKbnxFFaUNB/XsMbdRU7tdfpYYaL0c8teHjH/h++0kWF6l6TlS12tCPuO3UFZPukT6db8dzCTWzlgXStT3rhE2WAb5gQ1OVHjDCEfgVC4SAPVJhFMySFL5OYakto+yn6MP7gPJYOmWlPf1l2j/LlHPXI9qU9/yKKWw5P4qHtbLekIOTq+QieUnm5vnKed+686cVdimxX+1Xe1DI+LDxLXnU66lEkmboWkNpbWo7jSkQK9HwrZvU3tZbq5f5B8+3921PEwYjl6tuCnM7i3Jqu06r0nXyusTJpKhu/hSiZgv4Dj2o1Seye6I5eL6B0eZ1WYzvYWbB3U8u3Rvy/rLx30QqgTLCsEPPpAshPC51BZUg28qqTDcFSEXTXjRPfod+KUwGl86EFAHK+aQyAeAxQMsQVV8G1YNa6yVzNbZA81VZZZRYP0ORj52KvWFrR+gQnDutZzbOvfPjLAwYQ7Nvz8Y3oOHI80rL+eWOuSjfDZWaDbi16km84Gf4DcKWRSElnnpwz9U0FpYHgFpuBOrhXiluF22y86O9fd3pYlfYnKSWW32zEHL7RvRFthOSKpt20xTTaXbtEDsWTHA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3dde887-7db9-403d-44d0-08dbc0d6c81b X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2023 10:28:11.7002 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fgWKZOfdmunQGsQsmQsLhXZDFNxCoD8NbRHDAToBfWMj5l4CgxG450mr3+OqSIbQHBEDZTtdvBLVbXDuGuCFQA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6153 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-29_08,2023-09-28_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 mlxscore=0 malwarescore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309290089 X-Proofpoint-GUID: dafVnUl1F-EIX_RZaatTlGJI4LOmzBAH X-Proofpoint-ORIG-GUID: dafVnUl1F-EIX_RZaatTlGJI4LOmzBAH Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Currently an IO size is limited to the request_queue limits max_sectors. Limit the size for an atomic write to queue limit atomic_write_max_sectors value. Signed-off-by: John Garry --- note: atomic_write_max_sectors should prob be limited to max_sectors, which it isn't block/blk-merge.c | 12 +++++++++++- block/blk.h | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index 0ccc251e22ff..8d4de9253fe9 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -171,7 +171,17 @@ static inline unsigned get_max_io_size(struct bio *bio, { unsigned pbs = lim->physical_block_size >> SECTOR_SHIFT; unsigned lbs = lim->logical_block_size >> SECTOR_SHIFT; - unsigned max_sectors = lim->max_sectors, start, end; + unsigned max_sectors, start, end; + + /* + * We ignore lim->max_sectors for atomic writes simply because + * it may less than bio->write_atomic_unit, which we cannot + * tolerate. + */ + if (bio->bi_opf & REQ_ATOMIC) + max_sectors = lim->atomic_write_max_sectors; + else + max_sectors = lim->max_sectors; if (lim->chunk_sectors) { max_sectors = min(max_sectors, diff --git a/block/blk.h b/block/blk.h index 94e330e9c853..6f6cd5b1830a 100644 --- a/block/blk.h +++ b/block/blk.h @@ -178,6 +178,9 @@ static inline unsigned int blk_queue_get_max_sectors(struct request *rq) if (unlikely(op == REQ_OP_WRITE_ZEROES)) return q->limits.max_write_zeroes_sectors; + if (rq->cmd_flags & REQ_ATOMIC) + return q->limits.atomic_write_max_sectors; + return q->limits.max_sectors; }