Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3958418ybt; Sun, 5 Jul 2020 11:54:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5j1dK/FJGlsviM4VARLnLp+syYXsMSxKSx8gAVqy7HQs6WoYiNAot32uHFuKKn4YgaoS3 X-Received: by 2002:aa7:db57:: with SMTP id n23mr51233088edt.235.1593975260918; Sun, 05 Jul 2020 11:54:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593975260; cv=none; d=google.com; s=arc-20160816; b=JrIsPQbxIFh7vZ6wn6wISFiOZCne0yG7CudqxMCrT6IxXSb7Jt67GaFD6fpU/tL5Kj iOBRz/tXT0XlZYvCL1zjCMGCPQSQGPb7M0Hc+nx/8dx7jTwA3xpo1h+gH6QQAl5pt6fd YzL9snc6tAYK9mFISYcmErZFRoFYyyZll+76pSDwPBkTMbuhfokZu0Yj1amksuu8WurK 1LintBEf1c7OQpUP6nECB4tOZzxJWIrFQWQqUiZS2j0dnQRWw1yODORjkN6twwLouVzD X6/Yecd8vsO4ZQvOVpY984ga0fS9PHHvL4Hy4eCVjphhcMl7oOenKTjPyacPQc7UzBRQ 0z5Q== 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=EDeoKzff2L3XGHadZi/OIFUby3HIdjDpDQcs/wY5K7A=; b=y6xnkJKeeINzjs5rNKNYcgyVyrwHOaN0RfUMjoEFpADLanoFaB2XiQOtTEVb1dneml 3gQlS7hXLM2GrwgnIkl3Gd0EQq2G7vsyLfhUE78sC9HjVxyHpVynIbpom+dCaXzNhMww rzl3RcSJCWMuKv96tVWwVqlf+lVP3qvz65btqPVi8K/RrQWt2S7s0E3KjGXQB53J/OVm /Br7ErXXI89rdz2LPUQi+F/5LCCb0PlbCEDVropoU2vGBdMBwVkareD4eP4Yx6RnC5F9 3zqsF5kzjPRfMdYJOlFpHaiNgFj0F+OH/vQ1twnOzigKmR8vHLoFiSOFeOalLhVyOnFR PC1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=h0vCiK0v; 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 i18si11613450edr.67.2020.07.05.11.53.58; Sun, 05 Jul 2020 11:54:20 -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=h0vCiK0v; 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 S1728177AbgGESwf (ORCPT + 99 others); Sun, 5 Jul 2020 14:52:35 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:40529 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728122AbgGESwb (ORCPT ); Sun, 5 Jul 2020 14:52:31 -0400 Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20200705185228epoutp0353af20f5e15e3d1d7ffd922a66b4729b~e7-PcCzZ02570125701epoutp034 for ; Sun, 5 Jul 2020 18:52:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20200705185228epoutp0353af20f5e15e3d1d7ffd922a66b4729b~e7-PcCzZ02570125701epoutp034 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1593975148; bh=EDeoKzff2L3XGHadZi/OIFUby3HIdjDpDQcs/wY5K7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h0vCiK0vfynf7uS3gvJlWms2MQeu8M+FS+SHtQUQvyafvenqgHCZAmcoXOB9EryHX g0o5FTw/BJ7ecm3vKmE8M4/PLFDnUakZZZlR21BhHKAegbJkXAPA2JAB+aQEXA90bi /Uwb6T6y989qhkukq4YITiC1rW6ouyz7ApWmsyOk= Received: from epsmges5p2new.samsung.com (unknown [182.195.42.74]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20200705185228epcas5p4d63536fb4ff71ca1a9d91322c2aec8b2~e7-O7A85D1418914189epcas5p4D; Sun, 5 Jul 2020 18:52:28 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id D5.C7.09703.C61220F5; Mon, 6 Jul 2020 03:52:28 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20200705185227epcas5p16fba3cb92561794b960184c89fdf2bb7~e7-OS5KwJ2311023110epcas5p1E; Sun, 5 Jul 2020 18:52:27 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200705185227epsmtrp1958b2733946f97338ab9ed5a3835c095~e7-OSHD770303903039epsmtrp1_; Sun, 5 Jul 2020 18:52:27 +0000 (GMT) X-AuditID: b6c32a4a-4b5ff700000025e7-54-5f02216c3ddb Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 4D.37.08303.B61220F5; Mon, 6 Jul 2020 03:52:27 +0900 (KST) Received: from localhost.localdomain (unknown [107.110.206.5]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200705185224epsmtip27b31b5b2d629a5e08596d2873cb48d57~e7-Ln6_Kc3204432044epsmtip2i; Sun, 5 Jul 2020 18:52:24 +0000 (GMT) From: Kanchan Joshi To: axboe@kernel.dk, viro@zeniv.linux.org.uk, bcrl@kvack.org Cc: hch@infradead.org, Damien.LeMoal@wdc.com, asml.silence@gmail.com, 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, Selvakumar S , Kanchan Joshi , Nitesh Shetty , Javier Gonzalez Subject: [PATCH v3 4/4] io_uring: add support for zone-append Date: Mon, 6 Jul 2020 00:17:50 +0530 Message-Id: <1593974870-18919-5-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1593974870-18919-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprHKsWRmVeSWpSXmKPExsWy7bCmlm6OIlO8wY0OTovf06ewWsxZtY3R YvXdfjaLrn9bWCxa278xWZyesIjJ4l3rORaLx3c+s1sc/f+WzWLKtCZGi723tC327D3JYnF5 1xw2ixXbj7BYbPs9n9niypRFzBavf5xkszj/9zirg5DHzll32T02r9DyuHy21GPTp0nsHt1X fzB69G1ZxejxeZOcR/uBbiaPTU/eMgVwRnHZpKTmZJalFunbJXBlzJm1gb1grnRFzzexBsaF Yl2MHBwSAiYSL9uluhi5OIQEdjNKTNmxhgXC+cQosat7IhOE85lR4uepl8xdjJxgHX1Pb7NB JHYBJVYdQqg6/qeTEWQum4CmxIXJpSCmiICNxM4lKiAlzALtzBIndt5hAhkkLGArce7PKnYQ m0VAVeLOmUlgNq+As8TGi+dZIZbJSdw81wm2mFPARaJt92lmkEESAls4JI6encYGUeQi8f7g OyhbWOLV8S3sELaUxMv+Nii7WOLXnaNQzR2MEtcbZrJAJOwlLu75ywRyKTPQ0et36YOEmQX4 JHp/P2GChBGvREebEES1osS9SU+hbhOXeD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lecmFtcmpeul5yfu4kRHANaWjsY96z6oHeIkYmD8RCjBAezkghvrzZjvBBvSmJlVWpRfnxR aU5q8SFGaQ4WJXHer7MWxgkJpCeWpGanphakFsFkmTg4pRqYavVfztGIPcy9oVLt6qZ9Mrnf bX27pzp3/rs8L9b/Su7V1VXMtVxqLx33Tn532udU1wNWYRXdk4nLzVrfvrly4tAq6zO+cYY+ ebu8zmYZfWx6Wjrj+LU/3YontPXqE2vk/N60zxd5/3pPZ4u6gNfMNx9uu36p2xDucLw7psj3 /IQ/1QYnWkrzfWz/t9jUuT5IMJY3OexyqtYi4fHW5J+WP/588a2Mfchyso9tX5rUpXS1X7Vf JVvW//WfO+nsfvmSxtXcLfxnvlza/6Uj2/HLZct+R57HhetaWXz+H8mtFNof9EhKd3pX2T/m NZ0xD39/v1LiE8WyzemW/r78yTdceOU/exy78ftaUepS611flFiKMxINtZiLihMBLkoc7vAC AAA= X-CMS-MailID: 20200705185227epcas5p16fba3cb92561794b960184c89fdf2bb7 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" CMS-TYPE: 105P X-CMS-RootMailID: 20200705185227epcas5p16fba3cb92561794b960184c89fdf2bb7 References: <1593974870-18919-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 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 cqe->flags. Signed-off-by: Selvakumar S Signed-off-by: Kanchan Joshi Signed-off-by: Nitesh Shetty Signed-off-by: Javier Gonzalez --- fs/io_uring.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 155f3d8..cbde4df 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), }; 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; @@ -1955,6 +1962,10 @@ static void io_complete_rw_common(struct kiocb *kiocb, long res) 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 +1973,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 +1986,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); @@ -2739,6 +2753,9 @@ static int io_write(struct io_kiocb *req, bool force_nonblock) SB_FREEZE_WRITE); } kiocb->ki_flags |= IOCB_WRITE; + /* zone-append requires few extra steps during completion */ + if (kiocb->ki_flags & IOCB_ZONE_APPEND) + req->flags |= REQ_F_ZONE_APPEND; if (!force_nonblock) current->signal->rlim[RLIMIT_FSIZE].rlim_cur = req->fsize; -- 2.7.4