Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp869870rdb; Wed, 6 Dec 2023 02:11:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IEASPknpKGukIDk4xXKRNNZJrDcwL2adFnpopKX+tcEdl64If3ygKpxljSMcACeOGPKnjeu X-Received: by 2002:a17:90a:a882:b0:285:7e62:2822 with SMTP id h2-20020a17090aa88200b002857e622822mr3295808pjq.16.1701857495015; Wed, 06 Dec 2023 02:11:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701857495; cv=none; d=google.com; s=arc-20160816; b=x+Bx/9sNbRSJhayRuNxfs9u1R6SxFLjTuG1wRv1khFsa78HOLQ6ZEMLTu1qOsb7Ca2 JB9GSXGaZsh3IFNh1mp3mNH+8Wq+cNraud5K82i4ZKyfhzpWIHL/q1y2CbGQ9P+pX88j VmHTxaoqpb81/auM+kCogD17+d4nbZVRuJMWTJvwf9Knqzn+sf+5kWrqjdTkHpodO/Iq u7BovBQPBZbmbvkQ1Co1INeck7XffMeo2J97Q86TEgbeO51MGgbVol+wAu/FbWEGiusn A7Lpo/nxBGzgpviqW1W24QaAB8837BI0G92ePyNx3m692rAvZeaTQ8zvsrHZ8lG8PfLR QBnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:mime-version:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=SF1N2aEMUVTCNqgb0+5ohRAM5D566oKMRQvrVXH9YeE=; fh=VlGIuj4ltDvQwfJtc25qeqnITB9G68kSSsxINcCgb7s=; b=TZ8KuVoD0MB8hOhTQyz0kojohHvL24D4BoxHEOlMriGLt7SRA2RsR+9DtL0rxmFIaa bojgAyKf6jDs6AgCdjDJgpd2JLD1uw2wbbAsaKlIdr+WlXDR9OmiMoYujbz44B4aieQx eXZyp2Za2H4H3Z8+ro/BegOS5oW2oFKJq8EYuoIvARxp65coKcOL9u+ufZ3rCC3Xxp3W GtTV0Pt0K76n3GOBI7uDSzbSOMldZlnFMiDO/TPh+Pwazy9LevOFV4N6gkcEFMaBmrBS PRkiJ59Wds2tMaftKVoadXf4Tda5OcwjlYtp21wpa8PF4omDR2u/KrXfo6jRxni6GUk7 uT1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=bb596vxZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id x20-20020a17090ab01400b002865781c521si7544378pjq.95.2023.12.06.02.11.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 02:11:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=bb596vxZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 0A8CA80C5C9B; Wed, 6 Dec 2023 02:11:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377562AbjLFKLA (ORCPT + 99 others); Wed, 6 Dec 2023 05:11:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377427AbjLFKKk (ORCPT ); Wed, 6 Dec 2023 05:10:40 -0500 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92E6B12B for ; Wed, 6 Dec 2023 02:10:43 -0800 (PST) Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20231206101042epoutp01aee117e0a4577b1d2421c8f9d2170796~eNlOhACEy0289502895epoutp01h for ; Wed, 6 Dec 2023 10:10:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20231206101042epoutp01aee117e0a4577b1d2421c8f9d2170796~eNlOhACEy0289502895epoutp01h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1701857442; bh=SF1N2aEMUVTCNqgb0+5ohRAM5D566oKMRQvrVXH9YeE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bb596vxZSzDq6HUO6OJryULZFPb5XEJdCNrLcfyZ4hxnPwAG3Nnp6hEPwozaULZy4 orqqqZuKkIWr7H4IgfRLUiPhiGk+TTjkiBzUQbhHaSl9MKE9e7au8UM0dNdjEcOAtP GiR5P4CiZr0YFR3Wukup8myASUFKlni0FYWtBNAc= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20231206101041epcas5p3237c541b3548a36a5cbe4510ba0336e7~eNlNywgn70506805068epcas5p3V; Wed, 6 Dec 2023 10:10:41 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.183]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4SlY7g1vy7z4x9Pp; Wed, 6 Dec 2023 10:10:39 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 6D.03.09634.F9840756; Wed, 6 Dec 2023 19:10:39 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20231206101038epcas5p49984074d09421f0f60e231e33db8b9e7~eNlK5-s1R0156201562epcas5p4x; Wed, 6 Dec 2023 10:10:38 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231206101038epsmtrp117841ac668b2752ba50e9a8c2f2d58a1~eNlK32slC1053310533epsmtrp1j; Wed, 6 Dec 2023 10:10:38 +0000 (GMT) X-AuditID: b6c32a49-eebff700000025a2-7f-6570489fb8eb Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 43.B5.07368.D9840756; Wed, 6 Dec 2023 19:10:37 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231206101030epsmtip2d34b4a231c1c746d0b685aa105f7840b~eNlDvozXf0087000870epsmtip2A; Wed, 6 Dec 2023 10:10:29 +0000 (GMT) From: Kanchan Joshi To: Jens Axboe , Jonathan Corbet , Alasdair Kergon , Mike Snitzer , Mikulas Patocka , dm-devel@lists.linux.dev, Keith Busch , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , Alexander Viro , Christian Brauner Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, nitheshshetty@gmail.com, anuj1072538@gmail.com, gost.dev@samsung.com, mcgrof@kernel.org, Nitesh Shetty , Hannes Reinecke , Kanchan Joshi , Anuj Gupta , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v18 01/12] block: Introduce queue limits and sysfs for copy-offload support Date: Wed, 6 Dec 2023 15:32:33 +0530 Message-Id: <20231206100253.13100-2-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231206100253.13100-1-joshi.k@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA02Te1BUdRTH+917ubvrtHZZUH+Bk7hTGTA8Nhf64bih+eg2xMAMjjFFgxvc Adpn+/A5DAQDrCTPbSJWkWdhmDqCAcsrZWddhHAFRJBXEbuFESEypDysdlkq//ucc77ndx6/ OWycp2d5sVPkGkYlF0v55Aai0eTrF1BOK5lgnY6FrnTfxNH84gqBMgqf4ujieAGJZkyPALJd zwGooqqMQPevGzHUVlWMoW8umjFk/nuWRMWd9wCyDxow1D7ijyqzawjU1n6LQAMt50hU/rWd hT4baiZRreUvDA0X2gEq0g1iqNn2KUCNK+U4ujwzR6CuEW9kfWpx2+NNGw3jLNo6cZWgB3q1 dH3daZJuqEmjpxtKAd16P52kq/P1bnRe5h8kPW8fIei5jkGSzr9WB+iGnlP0Qv1LdL1tFot+ 4X3J7mRGnMiofBh5giIxRZ4k4kfExO+LDwkNFgQIwtAbfB+5WMaI+PvfjQ44mCJ17IXvc1Qs 1Tpc0WK1mh/05m6VQqthfJIVao2IzygTpUqhMlAtlqm18qRAOaPZJQgOfj3EITwiSR4/3cpS NoqOL2U8IdPB2M5cwGZDSgiH5jS5gMPmUa0AFvwuyQUbHPwIQJu5h+Uy/gSw5Ic5wqlyJvxo 1eOuQDuAlvJV0mUsADhtH8Ccz5KUL7yj1zoTPKlvcWi8KnBqcMqEQ3Plz6Qz4EF9CLPPNa4x Qb0C707VsZzMpRCc763CXdW2wdL+x2t+DhUG9b+6/FzKHd4qta11hDs0md+dXesIUt9zYJ7+ C+BK3g+N/TXrbXvA3yzXWC72gg8Kstc5AfaX3sZcrIFTbTfWORxmdRfgzmFwxzBXWoJctTbC vBUb5lodF+qyeS71djhRbHdz8RY4+WXNOtOwYKBzfVlnAJwbbcYKwTbDMyMYnhnB8H+1CoDX gRcZpVqWxKhDlAI5c+y/f01QyOrB2nX4vdMMxn96GNgJMDboBJCN8z25UquC4XETxSdOMipF vEorZdSdIMSx4yLca1OCwnFeck28QBgWLAwNDRWG7QwV8LdwZ7LKEnlUkljDSBhGyaj+zcPY HK907LW+orHeuJXmw8JXs4YelOxws1Z4d4vCc3IiYz+YrPAbW+44kHUn+0b0ZFnTiX2SJEGk tqWIdWjUc6vx/EfPr+q6q83LmyzMTDqx616q91HsOTxymO5ip70cNu7tMRPFR+r3aocljC5q 1m0+6omVuFTdtNc69nEL3zf/bFxQZqp6yWSKzdzYcfKxwEOVaql7u0I2GuM1UpZ5MKJ/+82O rgu1MTzEOR70ltHcdNf9lwsTl5L9oS0vdR67/JXpkP/yjp62M2kP961OuZ/KWAyk+rrMm6Ol R6Z5ss/1hgUY28E639NnDi8ZKN17TNS7ddGwZ+qwsZ6zFMfaHF4ZcfuTtnw+oU4WC/xwlVr8 D34F2iemBAAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJIsWRmVeSWpSXmKPExsWy7bCSvO5cj4JUg1VXLC3WnzrGbPHx628W i6YJf5ktVt/tZ7N4ffgTo8WTA+2MFgsWzWWxuHlgJ5PFnkWTmCxWrj7KZHH0/1s2i0mHrjFa PL06i8li7y1ti4VtS1gs9uw9yWJxedccNov5y56yW3Rf38Fmsfz4PyaLGxOeMlpM7LjKZLHj SSOjxbbf85kt1r1+z2Jx4pa0xfm/x1kdpD12zrrL7nH+3kYWj8tnSz02repk89i8pN7jxeaZ jB67bzaweSzum8zq0dv8js3j49NbLB7v911l8+jbsorRY/Ppao/Pm+Q8Nj15yxTAH8Vlk5Ka k1mWWqRvl8CVcbdzN3vBNtuKn00/2BoY7xh3MXJySAiYSNw/P5m5i5GLQ0hgN6PE/pMNrBAJ cYnmaz/YIWxhiZX/nrNDFH1klHjet4qti5GDg01AU+LC5FKQuIjADmaJn2ubmUAcZoHLzBLT Fh5hBOkWFoiWOP39ONhUFgFViSuPV4FN5RWwkPh4dhEzxAZ5iZmXvoPFOQUsJSY/h4gLAdXs a5zOAlEvKHFy5hMwmxmovnnrbOYJjAKzkKRmIUktYGRaxSiZWlCcm56bbFhgmJdarlecmFtc mpeul5yfu4kRHPtaGjsY783/p3eIkYmD8RCjBAezkghvzvn8VCHelMTKqtSi/Pii0pzU4kOM 0hwsSuK8hjNmpwgJpCeWpGanphakFsFkmTg4pRqY3s5iMhSVEWkPWts1p5rp5VOPZcGTXHM9 gx5vvrjbzH/FouUK+eY3s/yYuz+cvD75xG79b/qRDu8/Jvf37PMXcbp0a1PhxO8vr/jL5MZt 8haTzHB5eLHHyorj7NE7U5kyPiWZzdLrZWU6sVKY2XJbzWn32u4+c4HLrU3LWCqPi7OGLf+b svA2174uq4wHEvqzl2spn/035cdNU8W6usV3pSuFQ2MVgr0b3FY5Vc86wyDVueuOeqrS9xSP +WuYLrYc++TzJ8U2eJ2N8/5Tz1Zyau6c+UfIunKD+WLDpYd+luzk3am+LdWxZ6uJ7VWTqVXf axcYVzjqqVb4bORafvzPPK5rk5jO3p+0OG9978OdSizFGYmGWsxFxYkA66GVEmwDAAA= X-CMS-MailID: 20231206101038epcas5p49984074d09421f0f60e231e33db8b9e7 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20231206101038epcas5p49984074d09421f0f60e231e33db8b9e7 References: <20231206100253.13100-1-joshi.k@samsung.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 06 Dec 2023 02:11:29 -0800 (PST) From: Nitesh Shetty Add device limits as sysfs entries, - copy_max_bytes (RW) - copy_max_hw_bytes (RO) Above limits help to split the copy payload in block layer. copy_max_bytes: maximum total length of copy in single payload. copy_max_hw_bytes: Reflects the device supported maximum limit. Reviewed-by: Hannes Reinecke Reviewed-by: Luis Chamberlain Signed-off-by: Nitesh Shetty Signed-off-by: Kanchan Joshi Signed-off-by: Anuj Gupta --- Documentation/ABI/stable/sysfs-block | 23 ++++++++++++++++++ block/blk-settings.c | 24 +++++++++++++++++++ block/blk-sysfs.c | 36 ++++++++++++++++++++++++++++ include/linux/blkdev.h | 13 ++++++++++ 4 files changed, 96 insertions(+) diff --git a/Documentation/ABI/stable/sysfs-block b/Documentation/ABI/stable/sysfs-block index 1fe9a553c37b..96ba701e57da 100644 --- a/Documentation/ABI/stable/sysfs-block +++ b/Documentation/ABI/stable/sysfs-block @@ -155,6 +155,29 @@ Description: last zone of the device which may be smaller. +What: /sys/block//queue/copy_max_bytes +Date: August 2023 +Contact: linux-block@vger.kernel.org +Description: + [RW] This is the maximum number of bytes that the block layer + will allow for a copy request. This is always smaller or + equal to the maximum size allowed by the hardware, indicated by + 'copy_max_hw_bytes'. An attempt to set a value higher than + 'copy_max_hw_bytes' will truncate this to 'copy_max_hw_bytes'. + Writing '0' to this file will disable offloading copies for this + device, instead copy is done via emulation. + + +What: /sys/block//queue/copy_max_hw_bytes +Date: August 2023 +Contact: linux-block@vger.kernel.org +Description: + [RO] This is the maximum number of bytes that the hardware + will allow for single data copy request. + A value of 0 means that the device does not support + copy offload. + + What: /sys/block//queue/crypto/ Date: February 2022 Contact: linux-block@vger.kernel.org diff --git a/block/blk-settings.c b/block/blk-settings.c index 0046b447268f..4441711ac364 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -59,6 +59,8 @@ void blk_set_default_limits(struct queue_limits *lim) lim->zoned = BLK_ZONED_NONE; lim->zone_write_granularity = 0; lim->dma_alignment = 511; + lim->max_copy_hw_sectors = 0; + lim->max_copy_sectors = 0; } /** @@ -82,6 +84,8 @@ void blk_set_stacking_limits(struct queue_limits *lim) lim->max_dev_sectors = UINT_MAX; lim->max_write_zeroes_sectors = UINT_MAX; lim->max_zone_append_sectors = UINT_MAX; + lim->max_copy_hw_sectors = UINT_MAX; + lim->max_copy_sectors = UINT_MAX; } EXPORT_SYMBOL(blk_set_stacking_limits); @@ -183,6 +187,22 @@ void blk_queue_max_discard_sectors(struct request_queue *q, } EXPORT_SYMBOL(blk_queue_max_discard_sectors); +/* + * blk_queue_max_copy_hw_sectors - set max sectors for a single copy payload + * @q: the request queue for the device + * @max_copy_sectors: maximum number of sectors to copy + */ +void blk_queue_max_copy_hw_sectors(struct request_queue *q, + unsigned int max_copy_sectors) +{ + if (max_copy_sectors > (BLK_COPY_MAX_BYTES >> SECTOR_SHIFT)) + max_copy_sectors = BLK_COPY_MAX_BYTES >> SECTOR_SHIFT; + + q->limits.max_copy_hw_sectors = max_copy_sectors; + q->limits.max_copy_sectors = max_copy_sectors; +} +EXPORT_SYMBOL_GPL(blk_queue_max_copy_hw_sectors); + /** * blk_queue_max_secure_erase_sectors - set max sectors for a secure erase * @q: the request queue for the device @@ -578,6 +598,10 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, t->max_segment_size = min_not_zero(t->max_segment_size, b->max_segment_size); + t->max_copy_sectors = min(t->max_copy_sectors, b->max_copy_sectors); + t->max_copy_hw_sectors = min(t->max_copy_hw_sectors, + b->max_copy_hw_sectors); + t->misaligned |= b->misaligned; alignment = queue_limit_alignment_offset(b, start); diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 0b2d04766324..7193a1f015f9 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -199,6 +199,37 @@ static ssize_t queue_discard_zeroes_data_show(struct request_queue *q, char *pag return queue_var_show(0, page); } +static ssize_t queue_copy_hw_max_show(struct request_queue *q, char *page) +{ + return sprintf(page, "%llu\n", (unsigned long long) + q->limits.max_copy_hw_sectors << SECTOR_SHIFT); +} + +static ssize_t queue_copy_max_show(struct request_queue *q, char *page) +{ + return sprintf(page, "%llu\n", (unsigned long long) + q->limits.max_copy_sectors << SECTOR_SHIFT); +} + +static ssize_t queue_copy_max_store(struct request_queue *q, const char *page, + size_t count) +{ + unsigned long max_copy; + ssize_t ret = queue_var_store(&max_copy, page, count); + + if (ret < 0) + return ret; + + if (max_copy & (queue_logical_block_size(q) - 1)) + return -EINVAL; + + max_copy >>= SECTOR_SHIFT; + q->limits.max_copy_sectors = min_t(unsigned int, max_copy, + q->limits.max_copy_hw_sectors); + + return count; +} + static ssize_t queue_write_same_max_show(struct request_queue *q, char *page) { return queue_var_show(0, page); @@ -517,6 +548,9 @@ QUEUE_RO_ENTRY(queue_nr_zones, "nr_zones"); QUEUE_RO_ENTRY(queue_max_open_zones, "max_open_zones"); QUEUE_RO_ENTRY(queue_max_active_zones, "max_active_zones"); +QUEUE_RO_ENTRY(queue_copy_hw_max, "copy_max_hw_bytes"); +QUEUE_RW_ENTRY(queue_copy_max, "copy_max_bytes"); + QUEUE_RW_ENTRY(queue_nomerges, "nomerges"); QUEUE_RW_ENTRY(queue_rq_affinity, "rq_affinity"); QUEUE_RW_ENTRY(queue_poll, "io_poll"); @@ -634,6 +668,8 @@ static struct attribute *queue_attrs[] = { &queue_discard_max_entry.attr, &queue_discard_max_hw_entry.attr, &queue_discard_zeroes_data_entry.attr, + &queue_copy_hw_max_entry.attr, + &queue_copy_max_entry.attr, &queue_write_same_max_entry.attr, &queue_write_zeroes_max_entry.attr, &queue_zone_append_max_entry.attr, diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 3f8a21cd9233..4e17945041c8 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -311,6 +311,9 @@ struct queue_limits { unsigned int discard_alignment; unsigned int zone_write_granularity; + unsigned int max_copy_hw_sectors; + unsigned int max_copy_sectors; + unsigned short max_segments; unsigned short max_integrity_segments; unsigned short max_discard_segments; @@ -893,6 +896,8 @@ extern void blk_queue_chunk_sectors(struct request_queue *, unsigned int); extern void blk_queue_max_segments(struct request_queue *, unsigned short); extern void blk_queue_max_discard_segments(struct request_queue *, unsigned short); +extern void blk_queue_max_copy_hw_sectors(struct request_queue *q, + unsigned int max_copy_sectors); void blk_queue_max_secure_erase_sectors(struct request_queue *q, unsigned int max_sectors); extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); @@ -1211,6 +1216,14 @@ static inline unsigned int bdev_discard_granularity(struct block_device *bdev) return bdev_get_queue(bdev)->limits.discard_granularity; } +/* maximum copy offload length, this is set to 128MB based on current testing */ +#define BLK_COPY_MAX_BYTES (1 << 27) + +static inline unsigned int bdev_max_copy_sectors(struct block_device *bdev) +{ + return bdev_get_queue(bdev)->limits.max_copy_sectors; +} + static inline unsigned int bdev_max_secure_erase_sectors(struct block_device *bdev) { -- 2.35.1.500.gb896f729e2