From patchwork Tue Nov 29 15:46:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinlong Chen X-Patchwork-Id: 27307 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp419785wrr; Tue, 29 Nov 2022 07:51:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf4yddTRt8IAepVEgK8XQG9w7j+7jHfZOD10YzaHspzwVK8UWcXT5K0qM9Vbw8LmWtTFUt8X X-Received: by 2002:a17:906:547:b0:7ad:9028:4b17 with SMTP id k7-20020a170906054700b007ad90284b17mr48593037eja.366.1669737086486; Tue, 29 Nov 2022 07:51:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669737086; cv=none; d=google.com; s=arc-20160816; b=gPQ/GiCzKLiLwd633L24VPpN3pznDdEFzOWKiFqs+jm31l47GMABxTmch/dD2Bg8RC ua5QdxwQNYVsX3PoqugLxvnYQ8C+iqZ4AWnF+bhHcP+nZMDaN0HO+nKkAqJbpolZR9QB vIpslf7zEbzbqfWaBhvonnQnmXdzxrWTc6a5ZXxQV/jgaMbF2dP4Y6UO2L5e8rWHPc9v cIbzU0vCb4fM0mJHtJ4k/rrfDamoC8T5O/7JYeDv2hpPi8yW0iLf70XuheOG6oxE69p/ WToVm/pcOI2MBG+3wfeMFDi/oYft1XLkIjn0p9MMiIUz2Q3sfpc+YAHcjyIeLOGtIo4G fAGw== 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; bh=9sxgxF1W3ku5h5nELiBKOV6Kv8JTblUB5gE4iqbFc/Y=; b=pKaiuXWOJXTEe6afvyi+aPWFPC9lnVolssRWA2TB8fesQg2DyYc13RTRs2K6wi7Qtt P8pGFyq23cdAC3oN+QRuTTiezYdjkZq9BT1BOG350i5tKNycic/xgrcSbOku0qcLFWbn y1+/PTRWlTuPMyLGcWsLYZXW34Akr7RJ1s5qFRGSQ4d/vIiVykMg+mtKa54P2PgFV1t9 ZICAmOK4hf2WPZVTIktzQvgNtN0eCOtmhX8i3tfHqz93CRp9Rmr8SSdi1ewcauBi4D5x 0y8+eFoUmIUWsNrQDSJus+EDt9Y079Q0GifyOgGATSqbr50zCJmmGOi1YiYNHcixK5/p QJ7Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be4-20020a1709070a4400b0077c5ec87ec2si13317321ejc.297.2022.11.29.07.50.53; Tue, 29 Nov 2022 07:51:26 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235914AbiK2PrH (ORCPT + 99 others); Tue, 29 Nov 2022 10:47:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235956AbiK2Pq6 (ORCPT ); Tue, 29 Nov 2022 10:46:58 -0500 Received: from zju.edu.cn (mail.zju.edu.cn [61.164.42.155]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 40D9131DE9; Tue, 29 Nov 2022 07:46:57 -0800 (PST) Received: from localhost.localdomain (unknown [10.14.30.50]) by mail-app4 (Coremail) with SMTP id cS_KCgBnaMxfKYZjT2esCA--.15899S3; Tue, 29 Nov 2022 23:46:54 +0800 (CST) From: Jinlong Chen To: axboe@kernel.dk Cc: hch@lst.de, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, nickyc975@zju.edu.cn Subject: [PATCH v2 1/5] elevator: print none at first in elv_iosched_show even if the queue has a scheduler Date: Tue, 29 Nov 2022 23:46:34 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CM-TRANSID: cS_KCgBnaMxfKYZjT2esCA--.15899S3 X-Coremail-Antispam: 1UD129KBjvdXoW7XFW3XFWrXFWruF4fGF1xZrb_yoWDtFXEqa yFq3Z7Jws8J34jkF4jvF1xtFWFvws3XF15Kwsrtr97Ga1jga47Arn7uFs8X34DGFWUua43 AwnrZ3s7AwnFkjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbIAFc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wAFIxvE14AK wVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20x vE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4UJVW0owA2z4x0Y4vEx4A2 jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAac4AC62xK8xCEY4 vEwIxC4wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv 7VC0I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r 1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCF04k20xvY0x0E wIxGrwCF04k20xvE74AGY7Cv6cx26r4fKr1UJr1l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2 IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v2 6r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2 IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv 67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyT uYvjfUFYFADUUUU X-CM-SenderInfo: qssqjiaqqzq6lmxovvfxof0/1tbiAgIJB1ZdtcpCQAADs7 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham 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?1750846235206034252?= X-GMAIL-MSGID: =?utf-8?q?1750846235206034252?= This makes the printing order of the io schedulers consistent, and removes a redundant q->elevator check. Signed-off-by: Jinlong Chen Reviewed-by: Christoph Hellwig --- block/elevator.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/block/elevator.c b/block/elevator.c index 599413620558..308bee253564 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -767,10 +767,12 @@ ssize_t elv_iosched_show(struct request_queue *q, char *name) if (!elv_support_iosched(q)) return sprintf(name, "none\n"); - if (!q->elevator) + if (!q->elevator) { len += sprintf(name+len, "[none] "); - else + } else { + len += sprintf(name+len, "none "); cur = eq->type; + } spin_lock(&elv_list_lock); list_for_each_entry(e, &elv_list, list) { @@ -783,9 +785,6 @@ ssize_t elv_iosched_show(struct request_queue *q, char *name) } spin_unlock(&elv_list_lock); - if (q->elevator) - len += sprintf(name+len, "none"); - len += sprintf(len+name, "\n"); return len; } From patchwork Tue Nov 29 15:46:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinlong Chen X-Patchwork-Id: 27305 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp419659wrr; Tue, 29 Nov 2022 07:51:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf6g3J3/U33sdiDM8HtL/EzhSVGyZZFwiRweU8VihHA7VLvA4VdwfRUku4kLaki2MyNM4Zu9 X-Received: by 2002:a17:906:684a:b0:7bc:73e6:b2c3 with SMTP id a10-20020a170906684a00b007bc73e6b2c3mr18518499ejs.451.1669737069845; Tue, 29 Nov 2022 07:51:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669737069; cv=none; d=google.com; s=arc-20160816; b=IBuQFsjTtZIq2wgD37zayL5XNsg2J5d7ZnKLojDb34ObSUZ9xUBb9GNsLamt9LZGaN fjCSNa5sdKeBM2dUpPoF/PvyJ+/s+XQozfHGaGTExQPq7yKqMyQmv+0HUABxUQC9T/l0 e9yeuLsUsRCPdQX7tXiRzyBZdbyLPGvzcwS3ARkRrCoSgDBbZVSgQGMUXEqJvVcSyJ7Y nDHlK5nI4tsSCwUegAeTkpIgEkyBI7tcV/MvByOEQBmue9lmtFEMRwwpSm1oRvjrDVS8 AYty3svHwDaZUGHRstl7p5rbg1tbYXqHgXjRmBKITacah8gf098WzrTn/DbmNtPhpLxp aBjQ== 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; bh=PKhOOvtlfb2qi0t8kP3a+apl+9/7kIQvBSOWJ9+Wfec=; b=wS8S01f0vgcFR2Qb8nia8Rg6EbQ6wVNKHGDhrwWbSm3j4ZD8w4j3YqeN0477My0gXT BGb4Uai6D70vrKk0XeAwAOKIgEZv0+Rqju7BA81tHRv+fJZa0S7Yf8y9qsriV9K6t0UL AcAR+BWhhQY0wooPCe8iIVaSp9MivOb4W20X4Ng+UqyBDSmV0NVimLTxNcU/wOwLUGrM Zl+xQxdYRIIJRI5aYIYtoQ15kwSRdDK9nu0Mau4SY7z62rdtz5hplBYAWfSqJ3ebWEVo zodBGbOp159VqtR9DPMJoYbo2BLSVcuuKGoROWhS0kPMMBaopfmTCNR3Q8vnsxrl91/t IA9g== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mm6-20020a170906cc4600b00783df65ae5esi9089938ejb.683.2022.11.29.07.50.37; Tue, 29 Nov 2022 07:51:09 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235999AbiK2PrN (ORCPT + 99 others); Tue, 29 Nov 2022 10:47:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235961AbiK2PrA (ORCPT ); Tue, 29 Nov 2022 10:47:00 -0500 Received: from zju.edu.cn (mail.zju.edu.cn [61.164.42.155]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 376816315A; Tue, 29 Nov 2022 07:46:59 -0800 (PST) Received: from localhost.localdomain (unknown [10.14.30.50]) by mail-app4 (Coremail) with SMTP id cS_KCgBnaMxfKYZjT2esCA--.15899S4; Tue, 29 Nov 2022 23:46:56 +0800 (CST) From: Jinlong Chen To: axboe@kernel.dk Cc: hch@lst.de, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, nickyc975@zju.edu.cn Subject: [PATCH v2 2/5] elevator: replace continue with else-if in elv_iosched_show Date: Tue, 29 Nov 2022 23:46:35 +0800 Message-Id: <77ac19ba556efd2c8639a6396eb4203c59bc13d6.1669736350.git.nickyc975@zju.edu.cn> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CM-TRANSID: cS_KCgBnaMxfKYZjT2esCA--.15899S4 X-Coremail-Antispam: 1UD129KBjvdXoWrtr48XryrAr18ArWrur4UJwb_yoW3AFb_Ka s5Xwn7J345Jr9Ikr1jvFn5tFWjvwn3Jr15Kwnrtr97ta90gFyfA3Wxua45JryDWFWUu3s8 Cw1DZFn7CryxKjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbIAFc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wAFIxvE14AK wVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20x vE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4UJVW0owA2z4x0Y4vEx4A2 jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAac4AC62xK8xCEY4 vEwIxC4wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv 7VC0I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r 1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCF04k20xvY0x0E wIxGrwCF04k20xvE74AGY7Cv6cx26r4fKr1UJr1l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2 IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v2 6r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2 IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv 67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyT uYvjfUFYFADUUUU X-CM-SenderInfo: qssqjiaqqzq6lmxovvfxof0/1tbiAgIJB1ZdtcpCQAAFs9 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham 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?1750846217887275458?= X-GMAIL-MSGID: =?utf-8?q?1750846217887275458?= else-if is more readable than continue here. Signed-off-by: Jinlong Chen --- block/elevator.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/block/elevator.c b/block/elevator.c index 308bee253564..ffa750976d25 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -776,11 +776,9 @@ ssize_t elv_iosched_show(struct request_queue *q, char *name) spin_lock(&elv_list_lock); list_for_each_entry(e, &elv_list, list) { - if (e == cur) { + if (e == cur) len += sprintf(name+len, "[%s] ", cur->elevator_name); - continue; - } - if (elv_support_features(q, e)) + else if (elv_support_features(q, e)) len += sprintf(name+len, "%s ", e->elevator_name); } spin_unlock(&elv_list_lock); From patchwork Tue Nov 29 15:46:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinlong Chen X-Patchwork-Id: 27301 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp419003wrr; Tue, 29 Nov 2022 07:49:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf5i/r/GoPsN/pn92RTA003/D/Omok2bM4A/Y23s0MsJVCdOfq27yINPvwGr1PPqj2/adJ2J X-Received: by 2002:a17:906:f13:b0:78d:8e08:76de with SMTP id z19-20020a1709060f1300b0078d8e0876demr48534294eji.12.1669736979005; Tue, 29 Nov 2022 07:49:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669736978; cv=none; d=google.com; s=arc-20160816; b=jo5LLr50oRMQIoiFK13Z727iGwvXbO3KqX5x9oSnUY0HQ4oCceXGx5GvW6x/rS2aEY b1U80uvx4T5dSvL41AmBTQBfEeGRKR/bxwAMSz/WI+BBYog8rDeRH/ropuhjWsU0btOo 382YMabq540AK/HpcqxGnDf4L4t5Rp7lOpbLN3c991TD/3J+iDcEpCc2KRURwdEPCt9y 4KdU+1/GgWVPCboaZ7reixcsiKBoMPndY+gU2co/wGREJvmoXx3R0bKgCvHYqENGC8MI +cm+iK7gRlE+HR4clLoTHpfj5yu8zN8aHmUF0FMrIARRLYrQlo64xGshUyApl0Ppa6rv tMlQ== 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; bh=ejHjjy9/hCNthqPu/XMjhw+tADFwulzSNqVzwLeaYpo=; b=LNfosfC0B4zaWt+k+HdwAFyvFcM7CzK15+UcwX6aVNcJ+DYOzzf/AM0D1S7qAblFl2 jIouf0yxd+IxlaHD1TYsuVJaKLji83g7wU/lycqtPkqtPfXipNxSZ82DYczbiIQRgZId IXaTxiW9sCbIq2KdZB5vgz4aZy77rbelE8PJWrHM47h/4VEGM9HRYuTJTSTrzPhdWpYs egtIRFlc/Vy4oIqF8NGTNRnKVAGAs5BBmebId/ljt+y9bhxgnrNw76Ae1+NlJ5RAH2FT sF/FkiW/nOZzK2SzTQKbxs4oJgnndNhkBb+q7C8PYqsXXzfgc/aVnohhRYGpoy/QjRJ3 Lmkw== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xd10-20020a170907078a00b007bff09aec2csi4701239ejb.1008.2022.11.29.07.49.15; Tue, 29 Nov 2022 07:49:38 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235998AbiK2PrK (ORCPT + 99 others); Tue, 29 Nov 2022 10:47:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235972AbiK2PrC (ORCPT ); Tue, 29 Nov 2022 10:47:02 -0500 Received: from zju.edu.cn (spam.zju.edu.cn [61.164.42.155]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AD38F6315A; Tue, 29 Nov 2022 07:47:01 -0800 (PST) Received: from localhost.localdomain (unknown [10.14.30.50]) by mail-app4 (Coremail) with SMTP id cS_KCgBnaMxfKYZjT2esCA--.15899S5; Tue, 29 Nov 2022 23:46:57 +0800 (CST) From: Jinlong Chen To: axboe@kernel.dk Cc: hch@lst.de, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, nickyc975@zju.edu.cn Subject: [PATCH v2 3/5] elevator: print e->elevator_name instead of cur->elevator_name in elv_iosched_show Date: Tue, 29 Nov 2022 23:46:36 +0800 Message-Id: <4bae180ffbac608ea0cf46ffa9739ce0973b60aa.1669736350.git.nickyc975@zju.edu.cn> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CM-TRANSID: cS_KCgBnaMxfKYZjT2esCA--.15899S5 X-Coremail-Antispam: 1UD129KBjvdXoW7Wr4kWF13KF4fJFyfXw4fXwb_yoW3Zrg_KF y5twn7Gwn8Jry2kr1YyF1ftrW0qwn3Jr1FkwnrtrZ7KayF9FyUZFn7Zas8ArykGFWUu3s8 u3WDZFykAr1xKjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbIAFc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wAFIxvE14AK wVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20x vE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4UJVW0owA2z4x0Y4vEx4A2 jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAac4AC62xK8xCEY4 vEwIxC4wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv 7VC0I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r 1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCF04k20xvY0x0E wIxGrwCF04k20xvE74AGY7Cv6cx26r4fKr1UJr1l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2 IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v2 6r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2 IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv 67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyT uYvjfUFYFADUUUU X-CM-SenderInfo: qssqjiaqqzq6lmxovvfxof0/1tbiAgIJB1ZdtcpCQAAHs- X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham 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?1750846122507842481?= X-GMAIL-MSGID: =?utf-8?q?1750846122507842481?= Printing e->elevator_name in all cases improves the readability. Suggested-by: Christoph Hellwig Signed-off-by: Jinlong Chen --- block/elevator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/elevator.c b/block/elevator.c index ffa750976d25..b2f2252f29e7 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -777,7 +777,7 @@ ssize_t elv_iosched_show(struct request_queue *q, char *name) spin_lock(&elv_list_lock); list_for_each_entry(e, &elv_list, list) { if (e == cur) - len += sprintf(name+len, "[%s] ", cur->elevator_name); + len += sprintf(name+len, "[%s] ", e->elevator_name); else if (elv_support_features(q, e)) len += sprintf(name+len, "%s ", e->elevator_name); } From patchwork Tue Nov 29 15:46:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinlong Chen X-Patchwork-Id: 27308 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp420355wrr; Tue, 29 Nov 2022 07:52:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf6T8/pAeoXjYk0+VD+HCJOU3OwO5cyfSG2H5jHuhRA7VVYzWJ1ZIU7L358i+JDYl7sutwnI X-Received: by 2002:a05:6402:184b:b0:46a:2692:76e7 with SMTP id v11-20020a056402184b00b0046a269276e7mr30462255edy.387.1669737163977; Tue, 29 Nov 2022 07:52:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669737163; cv=none; d=google.com; s=arc-20160816; b=uWJhMl4fek5+XKhhAxo1YtTDOI8Iejl1y6yMqGUcU8HrIgITi+rkzsX/gcXAB8emkf fdY23gvH+m0rkAX8NgxL1D33VDg7lJ1Ofmye5/wDlufNxbQ4ysSoXdzqAeLjgLO3wGOR JqM8q9cXw5ACbTThfRKRidvKligP3FOozvOvWDZnsOcTBSd6V0IWlumOhVjhNqPMgagS mKpPQ+SjykzQUcKBD99b2+ZO6SmksHGq3v8HaBvvP+epCNfZ0vqyN2rc7b7ExIY7Uo5R QLSPGz/ePXbt7QeSx1p1r8D6xo7welqMvdXdv4rV5YvdR8iot1o79bpKLpLEi7iTj8wr 8KgA== 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; bh=Rk/zup9YwtP6wVEyU/8jIMHrhqpi4hLvC8UOwjsZdG8=; b=ReP+xkcB2OA7ryn0CmyuDc+obm+gBEcGuORI9tQLrzpYUgLbyai77oPS1BnNyOsPlv OcvOuNwJb2GzDMUpdtXgzTZ2b1EL2KQ1OAPHk0wIZv9MeRQ5sJ8jTuquN+JXIWwGEOyn K5qLf7yPfykenYt1ItECV2QHziB1enbgr6ZS8QXELTE7kKqzWrJVhII6DWQpQeKbw+IW oMl4UKtJn+4bmyQwKfDtkQM91oKO+q6mzm+93gfXJ8Vq711Y2Ag2FQygWY+wWONOF5lH 85/12MUq/kmaBtJmlos+oGSaqyf3wxFo5SwdL3J2ttK3W1QiZGNpeOgPdPwkbfnzomYv jKWg== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr10-20020a056402222a00b004634dd8b6edsi1913721edb.296.2022.11.29.07.52.17; Tue, 29 Nov 2022 07:52:43 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236019AbiK2PrS (ORCPT + 99 others); Tue, 29 Nov 2022 10:47:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235970AbiK2PrC (ORCPT ); Tue, 29 Nov 2022 10:47:02 -0500 Received: from zju.edu.cn (mail.zju.edu.cn [61.164.42.155]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3B2E459FED; Tue, 29 Nov 2022 07:47:01 -0800 (PST) Received: from localhost.localdomain (unknown [10.14.30.50]) by mail-app4 (Coremail) with SMTP id cS_KCgBnaMxfKYZjT2esCA--.15899S6; Tue, 29 Nov 2022 23:46:58 +0800 (CST) From: Jinlong Chen To: axboe@kernel.dk Cc: hch@lst.de, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, nickyc975@zju.edu.cn Subject: [PATCH v2 4/5] elevator: repalce "len+name" with "name+len" in elv_iosched_show Date: Tue, 29 Nov 2022 23:46:37 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CM-TRANSID: cS_KCgBnaMxfKYZjT2esCA--.15899S6 X-Coremail-Antispam: 1UD129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UjIYCTnIWjp_UUUYV7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr1j 6rxdM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2vYz4IE04k24VAvwVAKI4IrM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI 64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8Jw Am72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAG YxC7MxAIw28IcxkI7VAKI48JMxAIw28IcVCjz48v1sIEY20_GFWkJr1UJwCFx2IqxVCFs4 IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1r MI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJV WUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j 6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYx BIdaVFxhVjvjDU0xZFpf9x0JUAkucUUUUU= X-CM-SenderInfo: qssqjiaqqzq6lmxovvfxof0/1tbiAgEJB1ZdtcpF9wAAsL X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham 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?1750846316362505098?= X-GMAIL-MSGID: =?utf-8?q?1750846316362505098?= The "pointer + offset" pattern is more resonable. Signed-off-by: Jinlong Chen Reviewed-by: Christoph Hellwig --- block/elevator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/elevator.c b/block/elevator.c index b2f2252f29e7..8a5c171306f1 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -783,7 +783,7 @@ ssize_t elv_iosched_show(struct request_queue *q, char *name) } spin_unlock(&elv_list_lock); - len += sprintf(len+name, "\n"); + len += sprintf(name+len, "\n"); return len; } From patchwork Tue Nov 29 15:46:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinlong Chen X-Patchwork-Id: 27303 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp419563wrr; Tue, 29 Nov 2022 07:50:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf5I3gsWt3ril1wHcJ7YopyQO0FfZY8BJoPS9Ti7jSSm2E/zX8Yr2LXaIbTwkDuOywdQ79QW X-Received: by 2002:a17:907:7f8e:b0:7bb:52b2:4162 with SMTP id qk14-20020a1709077f8e00b007bb52b24162mr22348488ejc.608.1669737058289; Tue, 29 Nov 2022 07:50:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669737058; cv=none; d=google.com; s=arc-20160816; b=fb5WjLtjMTSPjfy8yj2gxJ8WofxFLMMjgmF3on5IMhc8UUwZcOOkZ4C5nQMGGBFPmq Ieq3rQHgdEM+k8Y0vJ+XCr+fqpqA/WA2Dmrva+hKMsOaWeEotASU0+2H4+aJpHUlfUCo Z+nBnk9ZvgSauc+RXbtzuW8YbsjDaNAf8t2MwzhbEKgQW9x+rNG6zzD46a7GJQtz0a4a BPHMH47/VBIkhepLzlZTeX4dbNZYq5t6P9TS5GuUc2FYPCsEz2oijwyL0LNkIZGiU0oZ +xJQZmtF/TW8BPHQXTyIMtaEs+v5xW2WKgNbhObYvcc2sc/vd/sD/WVNYpWpzREMyhA7 V99w== 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; bh=xvBFtP9ydez2BICxB7kkhbG4T2wO92bQjPSKBUbdvLI=; b=b+Kc2lV1iyG5L/Z0rif01wkyPNIjQYgZ4Z7hY77sVNYyfeA/lAeWERIf3pdHD05Vso 5Dd3oDCqnBbmeDOfwKigQ1JxSquPNmqfDvMEcrOyIDVgRNiu0efEgvyR9RQqqVZre/57 HtsxYG+iBVrn6OstGwnlt2L0/e2VbLpaStVlh1AVj9FZL5sKmN2lxxmrBGoDoD3voZH7 RV8A7y3V08ibosHLdQh/RmmoBTL+as1SZASRToTc1RRMtBhpkaRPecJgoEgc8q6wJTcY HZxIN5G/YCjQt4L4WJjJyEG5jaG8aWawsFwSGtwuRPlmoJgirh78S4fDT0FfNLE0SY+3 3vGQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f4-20020a50fc84000000b0046b42b984f1si3965519edq.492.2022.11.29.07.50.26; Tue, 29 Nov 2022 07:50:58 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236014AbiK2PrV (ORCPT + 99 others); Tue, 29 Nov 2022 10:47:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235979AbiK2PrE (ORCPT ); Tue, 29 Nov 2022 10:47:04 -0500 Received: from zju.edu.cn (spam.zju.edu.cn [61.164.42.155]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3993B63B90; Tue, 29 Nov 2022 07:47:03 -0800 (PST) Received: from localhost.localdomain (unknown [10.14.30.50]) by mail-app4 (Coremail) with SMTP id cS_KCgBnaMxfKYZjT2esCA--.15899S7; Tue, 29 Nov 2022 23:46:59 +0800 (CST) From: Jinlong Chen To: axboe@kernel.dk Cc: hch@lst.de, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, nickyc975@zju.edu.cn Subject: [PATCH v2 5/5] elevator: use bool instead of int as the return type of elv_iosched_allow_bio_merge Date: Tue, 29 Nov 2022 23:46:38 +0800 Message-Id: <0db0a0298758d60d0f4df8b7126ac6a381e5a5bb.1669736350.git.nickyc975@zju.edu.cn> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CM-TRANSID: cS_KCgBnaMxfKYZjT2esCA--.15899S7 X-Coremail-Antispam: 1UD129KBjvdXoWruFWrKw17WF1fZr1UWFW8Xrb_yoWDGFc_C3 4Fkwn7uFyDCry5Ar42v3W2kFyvvan3XFyDur13Kr97Aa1qg3W8Aw1xZrsxJry8Wr4xW3W5 G3ZFvF17KFnxKjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbIAFc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wAFIxvE14AK wVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20x vE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4UJVW0owA2z4x0Y4vEx4A2 jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAac4AC62xK8xCEY4 vEwIxC4wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv 7VC0I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r 1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCF04k20xvY0x0E wIxGrwCF04k20xvE74AGY7Cv6cx26r4fKr1UJr1l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2 IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v2 6r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_JFI_Gr1lIxAIcVC0I7IYx2 IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv 67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyT uYvjfUFYFADUUUU X-CM-SenderInfo: qssqjiaqqzq6lmxovvfxof0/1tbiAgEJB1ZdtcpF+AABsF X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham 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?1750846205436064492?= X-GMAIL-MSGID: =?utf-8?q?1750846205436064492?= We have bool type now, update the old signature. Signed-off-by: Jinlong Chen Reviewed-by: Christoph Hellwig --- block/elevator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/elevator.c b/block/elevator.c index 8a5c171306f1..14e03632b5b5 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -57,7 +57,7 @@ static LIST_HEAD(elv_list); * Query io scheduler to see if the current process issuing bio may be * merged with rq. */ -static int elv_iosched_allow_bio_merge(struct request *rq, struct bio *bio) +static bool elv_iosched_allow_bio_merge(struct request *rq, struct bio *bio) { struct request_queue *q = rq->q; struct elevator_queue *e = q->elevator; @@ -65,7 +65,7 @@ static int elv_iosched_allow_bio_merge(struct request *rq, struct bio *bio) if (e->type->ops.allow_merge) return e->type->ops.allow_merge(q, rq, bio); - return 1; + return true; } /*