From patchwork Thu Mar 30 14:53:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 77225 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1186432vqo; Thu, 30 Mar 2023 07:56:40 -0700 (PDT) X-Google-Smtp-Source: AKy350apnJTJN4nD4TWkUEMePZJf5wzggdA+G4e9CzHVs1MZcAgaU2L4M41bzZGDurLJ77QLDr5I X-Received: by 2002:a17:907:7b9e:b0:8b1:fc:b06d with SMTP id ne30-20020a1709077b9e00b008b100fcb06dmr27318364ejc.77.1680188200536; Thu, 30 Mar 2023 07:56:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680188200; cv=none; d=google.com; s=arc-20160816; b=MojBMiZYq2OuKU92FOaxVRZaMVddgJyzC0GkWom13+EpOtuxmI/s79e5PCJ2Z1IME+ QkxQn549Et1QYJuz5n5h3wTsljP2peYazzo0IMyhaB+UF2WKzh3WwkqEAWlmri+q/LFl gNAYdLk22zrCkeXbyiC/hS8mc0L0g0SXVz0M9yaFquJG4RfLEqIcdune49lfDXZVisll vHaTagd174EGprViE7vpRrjPv3+Iw49Gr9ITz7VkEaXKaLA2VMya/+uvyWYF0yrbFGEN tczRhQUkIJ1Z9geVmhvlJBe0qIJo0U5Kv+thmURssTI0fkuH9aZU9vr9zBs02AMqEPIZ NTlw== 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=mFbJzcJB80Re1Q+sgkx/0FejbOmENveKGMdPIGHHusQ=; b=LfXt1GLxxrEs3AHoZcPRhOyvvT2F5E8hQu7c6MN1+Z5GqtSNXAjGHCtXr3q5O/hjNj 2AAAgTXLnF2xOAlcxkKe4f0TdIXAZhl0EJXyyzvpkY6rDzeMf0wyi6Hk7oH7b+tg4hd2 eTyTOk6c5RvuOx+hge0NTgUbFkINkJHmJb4ZHuZ9aT5Px4ckOxrM8O7DEifw6Q4iOGua b2EfvmViB4UmRcSkLOlXFwTop0i2utBSYDEc9KR8Ir8zjR+Z6S5Yu1l1w/RlKIP9KopE RHeMl5ODm/IpuJQXPI4FtKsCo6V5mxiW7w/xiN5Px8tmgFzLEAckw0q+U8XX3Wv7gMV0 NxIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fAaanC13; 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 i20-20020a170906115400b008b17cc2e38asi295226eja.582.2023.03.30.07.56.16; Thu, 30 Mar 2023 07:56:40 -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=fAaanC13; 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 S232556AbjC3Oy5 (ORCPT + 99 others); Thu, 30 Mar 2023 10:54:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232431AbjC3Oyu (ORCPT ); Thu, 30 Mar 2023 10:54:50 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3054DBDDC; Thu, 30 Mar 2023 07:54:43 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id r11so19373800wrr.12; Thu, 30 Mar 2023 07:54:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680188082; 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=mFbJzcJB80Re1Q+sgkx/0FejbOmENveKGMdPIGHHusQ=; b=fAaanC13ZIcJPOqlgTHTTR8OQ622D5DOKgBDq8AivQ6OZol52ff75ivXCbEWtrKlC5 58sKNg8ei9TLxFzneeQcX+weXD5pVTkx5Una8QbUQ0N0zBSz4/9zQLBi2nTYeg17d/07 BDhvnc5atjth6fl/hQ5ySvlGOQ4T/zeoOqc1+3smISDFKVYbnru8vA3kiUons8RW7x/9 9BBOsInbG1nNwAtXQR4YCUNxAWpzV6a4ttCV3W5sudKKKy/FayqZQN9Pt/AsjOb5bby8 VnWKU1P6pGUsEfhtkSI0HXYIv9yMTfVnkL7D6zLr5YFZHIhgMR7qyMLLX2+qBWF9JQkJ jaZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680188082; 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=mFbJzcJB80Re1Q+sgkx/0FejbOmENveKGMdPIGHHusQ=; b=7pdXaNG7xaXlQoYQxmzQdHSSeilQEnirizGCc5mSCujOHfKjUwniSq1Pf/gjuNOS5L GDW63J88pzh0TvN2etLkbFWD5qU52vkrANFpkX2kJLrkjH7PmMKNQaGxIl02ccwgpeaS KDsXSsAUc2P+L0vDfG1RKUFNK5VB/pXiDDvXFNNB9+PYCv1Kdi2iKo360wWzU8uscMhl NVT3gV/h3hsxSTzpywLrx5+6U/CyjURJ1nTLsq0Imrdteaqed5I2vdJt+6rv3Rs/53Av FtODsPjjD1qNaFahqIzWIYiI7L8al3AJrH5SKisVQbUGF4baF3qrfJhSEkfL+UlirgmN MTkQ== X-Gm-Message-State: AAQBX9e/w8p5SKdUhVIRKpspyG4DExUS/oCHWPpPxUm3gQs13yMuz3Lo uGlkt6hsqkpGzexBLc1pO3wzXX5gXiY= X-Received: by 2002:a5d:53c8:0:b0:2dd:2a04:b73f with SMTP id a8-20020a5d53c8000000b002dd2a04b73fmr15772746wrw.49.1680188082258; Thu, 30 Mar 2023 07:54:42 -0700 (PDT) Received: from 127.0.0.1localhost (82-132-231-234.dab.02.net. [82.132.231.234]) by smtp.gmail.com with ESMTPSA id d7-20020adffbc7000000b002d5a8d8442asm28727962wrs.37.2023.03.30.07.54.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 07:54:42 -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 07/11] io_uring/rsrc: rename rsrc_list Date: Thu, 30 Mar 2023 15:53:25 +0100 Message-Id: <00684614f29297882e2c03456351532cf027e167.1680187408.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?1761805022892311906?= X-GMAIL-MSGID: =?utf-8?q?1761805022892311906?= 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 e122b6e5f9c5..10006fb169d2 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 fd3bdd30a993..c68846de031f 100644 --- a/io_uring/rsrc.h +++ b/io_uring/rsrc.h @@ -39,10 +39,16 @@ struct io_rsrc_data { struct io_rsrc_node { int refs; struct list_head node; - struct list_head rsrc_list; struct io_rsrc_data *rsrc_data; struct llist_node llist; 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 {