Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2306515ybh; Fri, 24 Jul 2020 09:27:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAg32nZFOJsBz1AgONhaOCY/7TFRJM7bSPzHgf3/twB1hOSV8CCDuhRzc5XrYYzVRjRQH0 X-Received: by 2002:a50:fc97:: with SMTP id f23mr9398434edq.255.1595608026323; Fri, 24 Jul 2020 09:27:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595608026; cv=none; d=google.com; s=arc-20160816; b=f3zlVGjstww5Kw6XkQfk7kD9g++csXX8LjJLfXSg5CyS7KB2NGagRNZctiJTLNHq5/ Um7v6cQip58QeePv+XWo0YxzHc5UOW9rSx2ZiZtbt40db8I+C1BjsSNGgmAU903G06/L Dc4Xvt18HvKO3hQSCy0BuY9XEC1QZgQjaUpTGmxWgMKVPLwv3Xbay1oYmVc+Tk7hv48G Tgr5pRcZU/1/VTO2G+GxONwbleqWjt16yci6ERfXEW3JcZQXe5U7YwYr7igei/7XyPMe X2R0cCYOYO+0SbCTR2QXv3QuwqgkS7rQhZyAqKzIL/yrzKoduOiUQ2QnevnR1CbMX4Ci ppnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=+K/IUmUogGLkZXpodowxoJ/FLK3QQNBHyElRvdThP3s=; b=ykUEHduTOnTezGlrFWwqcHUGrxh3cYXHmyJQGxhz7S2kdpCKB8kP8pOB4/cqKreaBT GKorrXuGVyqenY8HlYF7+71eK+sK5mAoGtxyT3T0iVPJ7D7eEthxUaG5SNTrm0cz4EMJ OOX1goqJtMVJu2JpCJ9ylnE2coVntKKdDoOVWbzO70i3HtB3hryCHYWPqEHlD8JAekxQ Swcux+A61oorUwn8KUA/LMzzFKyi17xmN8ZPU1mus+7U4qnd/dIYNp9KCTE9hkeBzf0h FWJrUZIzs6avBefjp6wL5uGlhtb5oVg/9dbB7f1u3spDmZEpkRdcxlSSYYSsM2796/hd 4jAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=NwpGOYFV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp1si1294722ejc.708.2020.07.24.09.26.43; Fri, 24 Jul 2020 09:27:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=NwpGOYFV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726990AbgGXQYA (ORCPT + 99 others); Fri, 24 Jul 2020 12:24:00 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:16981 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726988AbgGXQX7 (ORCPT ); Fri, 24 Jul 2020 12:23:59 -0400 Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20200724162357epoutp04a7fa7147d5bd16f001820196545fbe8a~kvN_4sJel3120231202epoutp048 for ; Fri, 24 Jul 2020 16:23:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20200724162357epoutp04a7fa7147d5bd16f001820196545fbe8a~kvN_4sJel3120231202epoutp048 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1595607837; bh=+K/IUmUogGLkZXpodowxoJ/FLK3QQNBHyElRvdThP3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NwpGOYFVSun6Onz/lxGDkmIzLhwN8dpbvVUU5XEFBXCaE/CCVz/eWhtKiCtf3VHT7 q9pwCtM5y5Ap7RaGOnVLh+z6YmZ8VExcMBLtjO3kiA2oSNwwbGTBm4CqbZhzDmlBpF 6Iz7J7QV6YqvipOJjqTvOzvDh8LK2kiLZw6GN9Mc= Received: from epsmges5p2new.samsung.com (unknown [182.195.42.74]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20200724162355epcas5p14c10449e6256a8ac7315a7916be62e96~kvN9y9akW0808308083epcas5p12; Fri, 24 Jul 2020 16:23:55 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 2F.CE.40333.B1B0B1F5; Sat, 25 Jul 2020 01:23:55 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20200724155346epcas5p2cfb383fe9904a45280c6145f4c13e1b4~kuzoV0vvb0555205552epcas5p2Z; Fri, 24 Jul 2020 15:53:46 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200724155346epsmtrp2e1e45c2609438de6fb93596d26e21103~kuzoU-y1f3047030470epsmtrp2C; Fri, 24 Jul 2020 15:53:46 +0000 (GMT) X-AuditID: b6c32a4a-9a7ff70000019d8d-86-5f1b0b1be864 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 9A.A9.08303.9040B1F5; Sat, 25 Jul 2020 00:53:45 +0900 (KST) Received: from localhost.localdomain (unknown [107.110.206.5]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200724155343epsmtip141811e600c138774385c1799ffec5e05~kuzlsG1Sv0293902939epsmtip1w; Fri, 24 Jul 2020 15:53:43 +0000 (GMT) From: Kanchan Joshi To: axboe@kernel.dk, viro@zeniv.linux.org.uk, bcrl@kvack.org Cc: willy@infradead.org, hch@infradead.org, Damien.LeMoal@wdc.com, asml.silence@gmail.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-aio@kvack.org, io-uring@vger.kernel.org, linux-block@vger.kernel.org, linux-api@vger.kernel.org, Kanchan Joshi , Selvakumar S , Nitesh Shetty , Javier Gonzalez Subject: [PATCH v4 5/6] block: enable zone-append for iov_iter of bvec type Date: Fri, 24 Jul 2020 21:19:21 +0530 Message-Id: <1595605762-17010-6-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595605762-17010-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrBKsWRmVeSWpSXmKPExsWy7bCmpq40t3S8wfKfhha/p09htZizahuj xeq7/WwWXf+2sFi0tn9jsjg9YRGTxbvWcywWj+98Zrc4+v8tm8WUaU2MFpu/d7BZ7L2lbbFn 70kWi8u75rBZbPs9n9niypRFzBavf5xkszj/9zirxe8fc9gchD12zrrL7rF5hZbH5bOlHps+ TWL36NuyitHj8yY5j/YD3Uwem568ZQrgiOKySUnNySxLLdK3S+DK+HB2KXPBC4GKRTd/sDUw vuftYuTkkBAwkdi+7jVbFyMXh5DAbkaJ+4fuMkE4nxglXh68CJX5zCgx7/J5ZpiWbz2zoap2 MUrMnDWLBSQBVrXwh18XIwcHm4CmxIXJpSCmiICNxM4lKiAVzALLmSXWrwXbLCzgLTH/VjMz SAmLgKrEpG5hkDCvgLPEzAk7mCA2yUncPNcJtpVTwEXiwsW7jBDxLRwSCzc5gLRKAMU3feaH CAtLvDq+hR3ClpL4/G4vG4RdLPHrzlFmkIMlBDoYJa43zGSBSNhLXNzz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MV9O4ua5TmYQm1PAReLCxbuMIOVCQDUXf5RPYORbwMiwilEytaA4Nz232LDAKC+1 XK84Mbe4NC9dLzk/dxMjOAK0tHYw7ln1Qe8QIxMH4yFGCQ5mJRHeFd+k4oV4UxIrq1KL8uOL SnNSiw8xSnOwKInzfp21ME5IID2xJDU7NbUgtQgmy8TBKdXAdO7O/87KJ3afM7qvsxbycwjq ZQn+OGyyzHffDFlXjVMl6+tquHeFrBDZp/D2TabkMfmbBa4ep69O/u5mL7GiWU5EnL3E0mXL F5OZeVksUy6oHSxL1LnUcmjeJNPI99wt63S1JPNCrk6e/f5qkKjsts17ZU02PrX8+uVBTGXg cb9d8rKBDgd46l2+Xo5bdfHVHBGBbwkduoE6KxJUna1blaZv+3S2bc2T2lN1Z6QXh9dxydyx 3SZhxPCCy5HPbVX338SYkpiGkEDTKDmBx7sK9sn3ClrOCl05+farFb80JMLUPqbYyibcnGlS UbjP/oDm0iBVoUyFUp0mjRteT098YX+R7Gpz9O4GixK21JNKLMUZiYZazEXFiQA38RbV7wIA AA== X-CMS-MailID: 20200724155346epcas5p2cfb383fe9904a45280c6145f4c13e1b4 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20200724155346epcas5p2cfb383fe9904a45280c6145f4c13e1b4 References: <1595605762-17010-1-git-send-email-joshi.k@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org zone-append with bvec iov_iter gives WARN_ON, and returns -EINVAL. Add new helper to process such iov_iter and add pages in bio honoring zone-append specific constraints. This is used to enable zone-append with io-uring fixed-buffer. Signed-off-by: Kanchan Joshi Signed-off-by: Selvakumar S Signed-off-by: Nitesh Shetty Signed-off-by: Javier Gonzalez --- block/bio.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/block/bio.c b/block/bio.c index 0cecdbc..ade9da7 100644 --- a/block/bio.c +++ b/block/bio.c @@ -975,6 +975,30 @@ static int __bio_iov_bvec_add_pages(struct bio *bio, struct iov_iter *iter) iov_iter_advance(iter, size); return 0; } +static int __bio_iov_bvec_append_add_pages(struct bio *bio, struct iov_iter *iter) +{ + const struct bio_vec *bv = iter->bvec; + unsigned int len; + size_t size; + struct request_queue *q = bio->bi_disk->queue; + unsigned int max_append_sectors = queue_max_zone_append_sectors(q); + bool same_page = false; + + if (WARN_ON_ONCE(!max_append_sectors)) + return -EINVAL; + + if (WARN_ON_ONCE(iter->iov_offset > bv->bv_len)) + return -EINVAL; + + len = min_t(size_t, bv->bv_len - iter->iov_offset, iter->count); + size = bio_add_hw_page(q, bio, bv->bv_page, len, + bv->bv_offset + iter->iov_offset, + max_append_sectors, &same_page); + if (unlikely(size != len)) + return -EINVAL; + iov_iter_advance(iter, size); + return 0; +} #define PAGE_PTRS_PER_BVEC (sizeof(struct bio_vec) / sizeof(struct page *)) @@ -1105,9 +1129,10 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter) do { if (bio_op(bio) == REQ_OP_ZONE_APPEND) { - if (WARN_ON_ONCE(is_bvec)) - return -EINVAL; - ret = __bio_iov_append_get_pages(bio, iter); + if (is_bvec) + ret = __bio_iov_bvec_append_add_pages(bio, iter); + else + ret = __bio_iov_append_get_pages(bio, iter); } else { if (is_bvec) ret = __bio_iov_bvec_add_pages(bio, iter); -- 2.7.4