Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1731999ybt; Thu, 25 Jun 2020 12:43:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxl8Z2pD9tSxPcCug3fggWdSJ8n0M2ju/FTc7i0qE5PE33EvUVWvpolCqhmQg4o25urTSfR X-Received: by 2002:a50:d80f:: with SMTP id o15mr15957884edj.156.1593114181398; Thu, 25 Jun 2020 12:43:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593114181; cv=none; d=google.com; s=arc-20160816; b=fDZ5YyW3qbiui3ZM8e7QT+bWWFDOfsepqOW4aYgX5elbs05E3M93J+vTrQKEs7YLmn 07BpuiNM0zzBqNxuCuqcU/VHnufypZr0nHSmQeY14pEwLMmTG1IYYRWPeGMIOoKUlNdK j1iI7h/+0feIMi3ahTq7fuJVT17R7Qt8Vlr9mfMthjcjgG1cU01WYWTYplJiVfY+cfa7 o3SMwFW7tQX7MjeaOs+Hk7kga4spuTYmcjhKwRp7F6t01YGQ1S7z7xAjG4zrANLYv8Mj QZFWexj+nS00r2o9MOFjnrAwhViuFA97u/ySOlPc6MVelAc629W1UprxDcTxro8BI+Oe ipkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:subject:autocrypt:from:references:cc:to:dkim-signature; bh=5d7yXKsJreT4Cu2Emc3DWVDyO2KlqiIjpk5Uc0grAno=; b=Rdy6dSuvdDu3u+eocAhuMDuz1llZVg6cJU+1QZy3kyaboxxv87Z2VSFuqiEQGLseFw pfT7w5RGk+UknRG9e70HauogWRJMRTfdxosj1vJmxYK1NlbZEs1lXrd1fZFq7YxN2Lso pZu5rWFVlkG1mNmnnFgrx+H7TZvfAPTcrV2P7hC4c6iD6HTX24bracLqmgs09H4GXNZT KDgYd2vZCHRyy4UtHvHAKYrtU3DCmSfC12jsb1DH4jAUBtidqL+4WgBiQgdMEscSXUI7 n4qXx01hSxF5t0VhUICdKAzWrgBDQj1S8A3lUcyVulZ2l05Wv0N7hHispUtOElUiN/mc //Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HjfSUyCJ; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm27si14365563edb.308.2020.06.25.12.42.33; Thu, 25 Jun 2020 12:43:01 -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=@gmail.com header.s=20161025 header.b=HjfSUyCJ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406782AbgFYTmC (ORCPT + 99 others); Thu, 25 Jun 2020 15:42:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406069AbgFYTmB (ORCPT ); Thu, 25 Jun 2020 15:42:01 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 421D8C08C5C1; Thu, 25 Jun 2020 12:42:01 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id u26so7396194wmn.1; Thu, 25 Jun 2020 12:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:references:from:autocrypt:subject:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=5d7yXKsJreT4Cu2Emc3DWVDyO2KlqiIjpk5Uc0grAno=; b=HjfSUyCJNlrbOK3ZphHfy1CFNMGdjX43SUMxvrEDi0TC+s0SRLvtxkr7LJYiEVYIJ2 41zxxwb0xG7lo1OxhQfdinh5CyAV75rQ9ao1jrv7zd12YLt7ZKxDQzolrswIrWf6O+xc VsNGN88J8CNZ4QC7cnadRnEwVbsr1Mu5VuT5lQ8pDfkgEvBd1mhQzQGnCR1jBQxLbgRx 0Tsx51nEqHZl54c+S97Ii5DXnMQFYroicheOAoSdlzEfqYFRfsTLMYJxmPrGcbEmCS/c 6NKQ2g4UbLQ18KNH4cDHlwe5/4P2zDqcQos8etaYgqYDdME49pXkFP/obHDg9bQR8ULM /DzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:autocrypt:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=5d7yXKsJreT4Cu2Emc3DWVDyO2KlqiIjpk5Uc0grAno=; b=iszhr9hJvmpfn8rbp6OYIvkuvAcj1eGz38wN3bR2UdoasSqpCUmbLSBhvIQYbrmp7w FBDPtPlciZGQimN+H1+ZzplV+74Dd7czro4aJVmi11KADoiZJbRoWPm8lXvQitt89VBn PmLqpeqe8JuI27yBqrY9i9leN14vxDZ7UWBY9s8jMaU+1zsHddH1y30qsuYLGOHjJDd5 n8d1JmW0B5lQtNtE0B4dj1JToSMPRGekvRJjXbcC9SBCaMqgFbfvKtVVUNMvoZBIqTlA tDgqgK74fOTXkiOaRs3cPiSr+FtO+YephxkXyXnmRDTgoiCMUKAeEPzUBTt8kZxbIXBA zb4g== X-Gm-Message-State: AOAM533NpFxip1DpE2Q7KAZfEWmZ3X/GSOgbDD44hQvJ0o/az7oWwNcO UbaqFKbjMbRqGmlJcKxaFQ0haouoYeE= X-Received: by 2002:a1c:2503:: with SMTP id l3mr5049987wml.188.1593114119871; Thu, 25 Jun 2020 12:41:59 -0700 (PDT) Received: from [192.168.43.154] ([5.100.193.85]) by smtp.gmail.com with ESMTPSA id d201sm13529261wmd.34.2020.06.25.12.41.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Jun 2020 12:41:59 -0700 (PDT) To: Kanchan Joshi , axboe@kernel.dk, viro@zeniv.linux.org.uk, bcrl@kvack.org Cc: Damien.LeMoal@wdc.com, hch@infradead.org, linux-fsdevel@vger.kernel.org, mb@lightnvm.io, linux-kernel@vger.kernel.org, linux-aio@kvack.org, io-uring@vger.kernel.org, linux-block@vger.kernel.org, selvakuma.s1@samsung.com, nj.shetty@samsung.com, javier.gonz@samsung.com References: <1593105349-19270-1-git-send-email-joshi.k@samsung.com> <1593105349-19270-3-git-send-email-joshi.k@samsung.com> From: Pavel Begunkov Autocrypt: addr=asml.silence@gmail.com; prefer-encrypt=mutual; keydata= mQINBFmKBOQBEAC76ZFxLAKpDw0bKQ8CEiYJRGn8MHTUhURL02/7n1t0HkKQx2K1fCXClbps bdwSHrhOWdW61pmfMbDYbTj6ZvGRvhoLWfGkzujB2wjNcbNTXIoOzJEGISHaPf6E2IQx1ik9 6uqVkK1OMb7qRvKH0i7HYP4WJzYbEWVyLiAxUj611mC9tgd73oqZ2pLYzGTqF2j6a/obaqha +hXuWTvpDQXqcOZJXIW43atprH03G1tQs7VwR21Q1eq6Yvy2ESLdc38EqCszBfQRMmKy+cfp W3U9Mb1w0L680pXrONcnlDBCN7/sghGeMHjGKfNANjPc+0hzz3rApPxpoE7HC1uRiwC4et83 CKnncH1l7zgeBT9Oa3qEiBlaa1ZCBqrA4dY+z5fWJYjMpwI1SNp37RtF8fKXbKQg+JuUjAa9 Y6oXeyEvDHMyJYMcinl6xCqCBAXPHnHmawkMMgjr3BBRzODmMr+CPVvnYe7BFYfo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mGyY+moIzxsuLmT93rqyII 5rSbbcTLe6KBYcs24XEoo49Zm9oDA3jYvNpeYD8rDcnNbuZh9kTgBwFN41JHOPv0W2FEEWqe JsCwQdcOQ56rtezdCJUYmRAt3BsfjN3Jn3N6rpodi4Dkdli8HylM5iq4ooeb5VkQ7UZxbCWt UVMKkOCdFhutRmYp0mbv2e87IK4erwNHQRkHUkzbsuym8RVpAZbLzLPIYK/J3RTErL6Z99N2 m3J6pjwSJY/zNwuFPs9zGEnRO4g0BUbwGdbuvDzaq6/3OJLKohr5eLXNU3JkT+3HezydWm3W OPhauth7W0db74Qd49HXK0xe/aPrK+Cp+kU1HRactyNtF8jZQbhMCC8vMGukZtWaAwpjWiiH bA== Subject: Re: [PATCH v2 2/2] io_uring: add support for zone-append Message-ID: Date: Thu, 25 Jun 2020 22:40:24 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <1593105349-19270-3-git-send-email-joshi.k@samsung.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/06/2020 20:15, Kanchan Joshi wrote: > From: Selvakumar S > > For zone-append, block-layer will return zone-relative offset via ret2 > of ki_complete interface. Make changes to collect it, and send to > user-space using ceq->flags. > Detect and report early error if zone-append is requested with > fixed-buffers. > > Signed-off-by: Selvakumar S > Signed-off-by: Kanchan Joshi > Signed-off-by: Nitesh Shetty > Signed-off-by: Javier Gonzalez > --- > fs/io_uring.c | 32 ++++++++++++++++++++++++++++++-- > 1 file changed, 30 insertions(+), 2 deletions(-) > > diff --git a/fs/io_uring.c b/fs/io_uring.c > index 155f3d8..31a9da58 100644 > --- a/fs/io_uring.c > +++ b/fs/io_uring.c > @@ -402,6 +402,8 @@ struct io_rw { > struct kiocb kiocb; > u64 addr; > u64 len; > + /* zone-relative offset for append, in sectors */ > + u32 append_offset; > }; > > struct io_connect { > @@ -541,6 +543,7 @@ enum { > REQ_F_NO_FILE_TABLE_BIT, > REQ_F_QUEUE_TIMEOUT_BIT, > REQ_F_WORK_INITIALIZED_BIT, > + REQ_F_ZONE_APPEND_BIT, > > /* not a real bit, just to check we're not overflowing the space */ > __REQ_F_LAST_BIT, > @@ -598,6 +601,8 @@ enum { > REQ_F_QUEUE_TIMEOUT = BIT(REQ_F_QUEUE_TIMEOUT_BIT), > /* io_wq_work is initialized */ > REQ_F_WORK_INITIALIZED = BIT(REQ_F_WORK_INITIALIZED_BIT), > + /* to return zone relative offset for zone append*/ > + REQ_F_ZONE_APPEND = BIT(REQ_F_ZONE_APPEND_BIT), Do we need a new flag? We can check for IOCB_ZONE_APPEND, flags are always close by in req->rw.kiocb.ki_flags. May require to be careful about not setting it for read, so not screwing buf select. > }; > > struct async_poll { > @@ -1745,6 +1750,8 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events, > > if (req->flags & REQ_F_BUFFER_SELECTED) > cflags = io_put_kbuf(req); > + if (req->flags & REQ_F_ZONE_APPEND) > + cflags = req->rw.append_offset; > > __io_cqring_fill_event(req, req->result, cflags); > (*nr_events)++; > @@ -1943,7 +1950,7 @@ static inline void req_set_fail_links(struct io_kiocb *req) > req->flags |= REQ_F_FAIL_LINK; > } > > -static void io_complete_rw_common(struct kiocb *kiocb, long res) > +static void io_complete_rw_common(struct kiocb *kiocb, long res, long res2) > { > struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw.kiocb); > int cflags = 0; > @@ -1953,8 +1960,14 @@ static void io_complete_rw_common(struct kiocb *kiocb, long res) > > if (res != req->result) > req_set_fail_links(req); > + > if (req->flags & REQ_F_BUFFER_SELECTED) > cflags = io_put_kbuf(req); > + > + /* use cflags to return zone append completion result */ > + if (req->flags & REQ_F_ZONE_APPEND) > + cflags = res2; > + > __io_cqring_add_event(req, res, cflags); > } > > @@ -1962,7 +1975,7 @@ static void io_complete_rw(struct kiocb *kiocb, long res, long res2) > { > struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw.kiocb); > > - io_complete_rw_common(kiocb, res); > + io_complete_rw_common(kiocb, res, res2); > io_put_req(req); > } > > @@ -1975,6 +1988,9 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res, long res2) > > if (res != req->result) > req_set_fail_links(req); > + if (req->flags & REQ_F_ZONE_APPEND) > + req->rw.append_offset = res2; > + > req->result = res; > if (res != -EAGAIN) > WRITE_ONCE(req->iopoll_completed, 1); > @@ -2127,6 +2143,9 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe, > if (kiocb->ki_flags & IOCB_NOWAIT) > req->flags |= REQ_F_NOWAIT; > > + if (kiocb->ki_flags & IOCB_ZONE_APPEND) > + req->flags |= REQ_F_ZONE_APPEND; > + > if (force_nonblock) > kiocb->ki_flags |= IOCB_NOWAIT; > > @@ -2409,6 +2428,14 @@ static ssize_t io_import_iovec(int rw, struct io_kiocb *req, > > opcode = req->opcode; > if (opcode == IORING_OP_READ_FIXED || opcode == IORING_OP_WRITE_FIXED) { > + /* > + * fixed-buffers not supported for zone-append. > + * This check can be removed when block-layer starts > + * supporting append with iov_iter of bvec type > + */ > + if (req->flags == REQ_F_ZONE_APPEND) s/==/&/ > + return -EINVAL; > + > *iovec = NULL; > return io_import_fixed(req, rw, iter); > } > @@ -2704,6 +2731,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock) > req->rw.kiocb.ki_flags &= ~IOCB_NOWAIT; > > req->result = 0; > + Extra \n > io_size = ret; > if (req->flags & REQ_F_LINK_HEAD) > req->result = io_size; > -- Pavel Begunkov