From patchwork Tue Dec 4 23:37:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 10712763 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE14417DB for ; Tue, 4 Dec 2018 23:38:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E194529C06 for ; Tue, 4 Dec 2018 23:38:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D60F929C3A; Tue, 4 Dec 2018 23:38:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90AB629ED2 for ; Tue, 4 Dec 2018 23:38:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726171AbeLDXiE (ORCPT ); Tue, 4 Dec 2018 18:38:04 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:41256 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726504AbeLDXiE (ORCPT ); Tue, 4 Dec 2018 18:38:04 -0500 Received: by mail-pl1-f193.google.com with SMTP id u6so9065312plm.8 for ; Tue, 04 Dec 2018 15:38:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=L8yxXuFlKRVZGhU6vByhKAQcKxwaMq31dRwuK5kkt+A=; b=I0fiKTp97lWAptjPCAJ8bghiFPuKgt5x2fcBaV7748QwKc7zzf4m4DfGDe942PAQic zBBx1+lC5KaXPKmpoOdHPxTW9utb1ekRhc9z89V0DYtU71ZX4Ps8HASp1uAI15onLctU QyJ5hIkTzm8t4ZZ4q7p0aYpa+yjpSq54ovVx1/X0mUyVpUIlwPE7XpPfV17gavUEUAX2 wpuUO1RSmxyj30V0Idkzk7Osz4hvVoRXGOajE08JYmUYxRCX6RvqpOAIgfviMS8Wp5UZ 58QjIGEIOgpq9LkKn5iwLKfFl1G2hOiLxrT8J2k2iKlZNsZIH6bWwe574r292S0UJ/Gj 5P2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=L8yxXuFlKRVZGhU6vByhKAQcKxwaMq31dRwuK5kkt+A=; b=RRAkOuxOpdnYemhAiz4fywaM4GladzxHw0YQXyAOudGND9Skr4Gghqi0JdYb69SD9M J58V7A40Ec8dgMVp1z5HqNqgEQos3j+ky4CCL3XVPSmWodLijnwGQD1qSDr8uHmB6fgV AlxVhKLJSr5csS93wDD3KRlMrWCXeDTUcAdAQbc9kW65p1cfsWK8WGY8VcBzETui600N 1HnjSp6ihbkN3WQprKKR15s7+jB48VzSXmuT8Il0QCsFU4BxWPaXp2sD3f6NYa5m8gHw PPbv8U9qTw8FLtcQ5z5HMQ1o07pg4ZCIfhsGPG+SxWE4aQNaY4oV/n0PhaBOhNqR/qvO t2Ag== X-Gm-Message-State: AA+aEWYCHKr354p934hwOxS2CzcdnWqLHfHC+4YulLJkAwaBtEQJQn7Z sBVTjc6E2b1QFTVap10HdKPWU0m+8y0= X-Google-Smtp-Source: AFSGD/VnjMZuzmOf/CuJrjb3quTvbHG8WmRQRAYgkuLMvn4Hf7iAjytZlj5cSIt4aZIq1aXjBKGoXA== X-Received: by 2002:a17:902:a5c3:: with SMTP id t3mr12422871plq.117.1543966683426; Tue, 04 Dec 2018 15:38:03 -0800 (PST) Received: from x1.localdomain (66.29.188.166.static.utbb.net. [66.29.188.166]) by smtp.gmail.com with ESMTPSA id t13sm22527635pgr.42.2018.12.04.15.38.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Dec 2018 15:38:02 -0800 (PST) From: Jens Axboe To: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-aio@kvack.org Cc: hch@lst.de, jmoyer@redhat.com, Jens Axboe Subject: [PATCH 12/26] aio: abstract out io_event filler helper Date: Tue, 4 Dec 2018 16:37:15 -0700 Message-Id: <20181204233729.26776-13-axboe@kernel.dk> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181204233729.26776-1-axboe@kernel.dk> References: <20181204233729.26776-1-axboe@kernel.dk> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Jens Axboe --- fs/aio.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 06c8bcc72496..173f1f79dc8f 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -1063,6 +1063,15 @@ static inline void iocb_put(struct aio_kiocb *iocb) } } +static void aio_fill_event(struct io_event *ev, struct aio_kiocb *iocb, + long res, long res2) +{ + ev->obj = (u64)(unsigned long)iocb->ki_user_iocb; + ev->data = iocb->ki_user_data; + ev->res = res; + ev->res2 = res2; +} + /* aio_complete * Called when the io request on the given iocb is complete. */ @@ -1090,10 +1099,7 @@ static void aio_complete(struct aio_kiocb *iocb, long res, long res2) ev_page = kmap_atomic(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]); event = ev_page + pos % AIO_EVENTS_PER_PAGE; - event->obj = (u64)(unsigned long)iocb->ki_user_iocb; - event->data = iocb->ki_user_data; - event->res = res; - event->res2 = res2; + aio_fill_event(event, iocb, res, res2); kunmap_atomic(ev_page); flush_dcache_page(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]);