From patchwork Tue Apr 4 12:39:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 79081 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3001607vqo; Tue, 4 Apr 2023 05:54:05 -0700 (PDT) X-Google-Smtp-Source: AKy350ax8QfxIUApLI5r4UXhm1i7hDH57eq4gUcs/QOJp13Vx/VW31ffVJYCq7uesBJGUlQZddW4 X-Received: by 2002:a17:906:cd18:b0:8b2:7567:9c30 with SMTP id oz24-20020a170906cd1800b008b275679c30mr2440980ejb.59.1680612845102; Tue, 04 Apr 2023 05:54:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680612845; cv=none; d=google.com; s=arc-20160816; b=WQNjqk8D4q6CDr9hCpoRr8YcpjOx8rUlQvugfaGLecWYo7/JO3hIw7qqR1Llm8O+Ml TLpYpx8c0H2lZzOYOzCFYaWPge20iF54RkvLPuuKfNRXrYma2ZX1IFdc95VJlq3qjaia rEYMAxzh2xjtpVdeK5JQ+93au8pQUqdR1h7KmagSXn7ph/3zgD78CC4jNA/e7RTvoS+K 6ARq8bMf+FrcOEx35gSxofKv1eyq1qEQgEu+3UOCKhFtNkizBsgHmavJgaCfNgU4YPkp ExTpWZqLWHLg+oln8YCr5M2GKRW9vLYdqsWlbILCc3IUZn/bi9Qlj+sdHpqbbAH8eg/V cBEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=48iFWUfpdleMqEh/dEcvKEXwQRaih9b/03a5Bfe+CrM=; b=Yy2uJF0cS7ClRfXXkAgVY+Q4r5odtg6fLimFQvaafRoxwNOqdVRGwd9JVY4+DVHSW6 ctm5goJNjiVBAgtH5yXQqKzX2MgIjbEXtJHctI387rBLNXxTY8Dvn9vkG6aUIeNCnvxA On2e51AVhSkHnsVMGcC0c24p1ixFNZ2xzyHTSuY4Cx3jwJfCNj/vyiUD11cLH8kTuqfm Zf51eedzWFe/Y5ug2sJVSexaPu22tLAUV8w+VhkugM6/UrY2WkLdqoIykcuPkvM2fBVd FBxfpFtDU/Z4zlXrRfY0y0+9RY9p2j3Q8UrOjBfBeHlBLtYxvnNC8ytq6XZ/H9p2yoaB wfAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gl2kV2u3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u7-20020a17090626c700b009316b784857si2804245ejc.352.2023.04.04.05.53.38; Tue, 04 Apr 2023 05:54:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gl2kV2u3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233561AbjDDMlS (ORCPT + 99 others); Tue, 4 Apr 2023 08:41:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234644AbjDDMk7 (ORCPT ); Tue, 4 Apr 2023 08:40:59 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1F6135A6; Tue, 4 Apr 2023 05:40:56 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id w9so130034910edc.3; Tue, 04 Apr 2023 05:40:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680612055; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=48iFWUfpdleMqEh/dEcvKEXwQRaih9b/03a5Bfe+CrM=; b=gl2kV2u30DiuF6LupyGJhc9fmdXteYGvxc6WMMxQ83owbOpufrLobHdjp7vJ76EHJe DFLCkr9ikzj6jB8Lx9bpBWtWijJTmPgRcduPEEBluNfaPgqUCYx3eXvNRIXw4Im4rrxp ZZldOEBkDIZjteD7LSlQiyopcCqnmHABeZ7kDpsqWuIw6MF5GaLBYTz5NGyCRXGUoxp7 ipMyvoluJLjtxjqftPEjuEVwPK351nasYVHb7iHl5CwuIT3SaQ65gC1IJEF5dF88mWgY FMCIGHgl4laJj+IdD/toCmbvnOTIPaACCFhKUeIpTcSdN8dso/qs6EGr97scyqWTi2bO GKdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680612055; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=48iFWUfpdleMqEh/dEcvKEXwQRaih9b/03a5Bfe+CrM=; b=ukeex1gOJL/QN1OzwNURJZhog2vjwkjp4B35fRbiz4rThDu5QhNPBIim7FK4VXX4Z7 pZ8sqHqmUo5QVGe9jMeAA+/59KJHKm6V+hFuGB1AP4OvrDTqrwRkK7yvOFR7zwMAEo8V j/yGO9AxYQUgG4C8dLlfqYHdm0xjbopdsdna/ctF2DHQUrLy1nDRUnC9IX8RVaLf/aLX T8mcAwqWzRhSqti24draJDvKOM3pMvy2zXzZtNYwcnKRR/tIKtHTMvcTUlnrgbhthcqh g+lB9fECprHe40rbPSr52PMAy2SIoxIZcUFcnpoZS5lkvTCG+4FAdMjWr+2ZknDOjt+B NJow== X-Gm-Message-State: AAQBX9eEjmfrh/MUNWmxJlHoEkFMO5nDcfM0C+jeuiFm4EIb/HxVWiGc kF1EeMTFleCxEjlRw3lbH+FGniKL1aE= X-Received: by 2002:a17:907:bb87:b0:8aa:a9fe:a3fc with SMTP id xo7-20020a170907bb8700b008aaa9fea3fcmr2098510ejc.8.1680612054507; Tue, 04 Apr 2023 05:40:54 -0700 (PDT) Received: from 127.com ([2620:10d:c092:600::2:2b22]) by smtp.gmail.com with ESMTPSA id g8-20020a170906394800b008cafeec917dsm5978851eje.101.2023.04.04.05.40.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 05:40:54 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH v2 07/13] io_uring/rsrc: rename rsrc_list Date: Tue, 4 Apr 2023 13:39:51 +0100 Message-Id: <3e34d4dfc1fdbb6b520f904ee6187c2ccf680efe.1680576071.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762250295021674975?= X-GMAIL-MSGID: =?utf-8?q?1762250295021674975?= We have too many "rsrc" around which makes the name of struct io_rsrc_node::rsrc_list confusing. The field is responsible for keeping a list of files or buffers, so call it item_list and add comments around. Signed-off-by: Pavel Begunkov --- io_uring/rsrc.c | 6 +++--- io_uring/rsrc.h | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index f3493b9d2bbb..2378beecdc0a 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -146,7 +146,7 @@ static void __io_rsrc_put_work(struct io_rsrc_node *ref_node) struct io_ring_ctx *ctx = rsrc_data->ctx; struct io_rsrc_put *prsrc, *tmp; - list_for_each_entry_safe(prsrc, tmp, &ref_node->rsrc_list, list) { + list_for_each_entry_safe(prsrc, tmp, &ref_node->item_list, list) { list_del(&prsrc->list); if (prsrc->tag) { @@ -249,7 +249,7 @@ static struct io_rsrc_node *io_rsrc_node_alloc(void) ref_node->refs = 1; INIT_LIST_HEAD(&ref_node->node); - INIT_LIST_HEAD(&ref_node->rsrc_list); + INIT_LIST_HEAD(&ref_node->item_list); ref_node->done = false; return ref_node; } @@ -737,7 +737,7 @@ int io_queue_rsrc_removal(struct io_rsrc_data *data, unsigned idx, prsrc->tag = *tag_slot; *tag_slot = 0; prsrc->rsrc = rsrc; - list_add(&prsrc->list, &node->rsrc_list); + list_add(&prsrc->list, &node->item_list); return 0; } diff --git a/io_uring/rsrc.h b/io_uring/rsrc.h index a96103095f0f..509a5ea7eabf 100644 --- a/io_uring/rsrc.h +++ b/io_uring/rsrc.h @@ -38,11 +38,17 @@ struct io_rsrc_data { struct io_rsrc_node { struct list_head node; - struct list_head rsrc_list; struct io_rsrc_data *rsrc_data; struct llist_node llist; int refs; bool done; + + /* + * Keeps a list of struct io_rsrc_put to be completed. Each entry + * represents one rsrc (e.g. file or buffer), but all of them should've + * came from the same table and so are of the same type. + */ + struct list_head item_list; }; struct io_mapped_ubuf {