From patchwork Sat Nov 12 08:32:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuwei Guan X-Patchwork-Id: 19127 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1175838wru; Sat, 12 Nov 2022 00:36:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf4AU9Avv5KLR0uh1W0XhjNNLYgkujBfXlk1OQUavMhHqrUtgHW3G1PhmmWiNIFhafo0SEU3 X-Received: by 2002:a17:90a:2fcb:b0:213:258e:7435 with SMTP id n11-20020a17090a2fcb00b00213258e7435mr5540435pjm.137.1668242207194; Sat, 12 Nov 2022 00:36:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668242207; cv=none; d=google.com; s=arc-20160816; b=sBpfRDgHczchDD/l8MmACWcCAgkcByy9X4AgDVPT9xNd1+GsZtO2nZ+Z92ynltjQNq 7eWxffSHFaJsRKK/KpYWvC8B5hq87GS5wOk0YiRsEoNmPDu1qf9WXKnGcTmn1xW+Jz+2 1ecYX9ZFdDRbFjSzGtN/JnxNbIgW0NANIDKaVR2yROn8hipdsmMptpyPMsaY2lc+/cmj uxFJaUlHgp+3i8HqbqfIuN9KYD1cTa5wjgaTLsuAlTkTIpmgNL+Fah/vGkQOl1YV1IUJ KjKO6XfCB3w0yDyeaPMG9KouviA078KfFzxs90i0XbnNSO9cS8G5S5kuaYUZZwq/OVd6 9lMg== 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=4DOeqJ5SMCOeWwnjErWXkoh3b+hyZguii3t6dQS8YmY=; b=lZtl8Vt1hBSNsAqlA//ExgBhuR1gE5n8ZtmxSbjGwKIru1kOG/AdD/gqEy0FucvCmK 3OH+QtprltmaYOfjWqiWqvvGedShfUU6Hyq658jAxEBPadF3p6A2AESg/hUYo6+dEvml mjCyPlB3uPsdwVXv9SgMm1SKOW1r9FYdA0Zef9TkoesHbzaq0rEdp6k8s2f5JtaxN5IC 9gY1bGzzNvUvyqv8OCz4WOq80pR138smtNAiQIMeJsgxQbvw5F0TnaiWmf5UsnRwYZdu w2p2SMhPv8ybhKsPeAzPEJvbwObk87yibp2jPCYpDvDkvpIbmHy4QbiksHWFx2YQ+Hkp sNdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IBxyvjZz; 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 e6-20020a170902b78600b001732b4e99c4si4485473pls.377.2022.11.12.00.36.26; Sat, 12 Nov 2022 00:36:47 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IBxyvjZz; 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 S234617AbiKLId0 (ORCPT + 99 others); Sat, 12 Nov 2022 03:33:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230257AbiKLIdY (ORCPT ); Sat, 12 Nov 2022 03:33:24 -0500 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04EFEC78 for ; Sat, 12 Nov 2022 00:33:23 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id b29so6748558pfp.13 for ; Sat, 12 Nov 2022 00:33:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=4DOeqJ5SMCOeWwnjErWXkoh3b+hyZguii3t6dQS8YmY=; b=IBxyvjZzoJn3lNx52hSdWnd8nch0DPIteXYXXv2nCFcZaF5Vj+cURGaTaeBSQ6OoR7 BUZv7yYyLphZeilhFjf7hRJ3QjCSt4azIF5y3KIh0MEgBpz7j/DwmtJBUUeDlXSEDTzk wmDKnPkt4mwZCRX43AwaY3Tg/5iXPAyZZkjjv482i2mk5iic/sEx1GglPugfioauNr7I 6saBXb/MioFSWS1ltk1EGI5YcIYrBJz3B1tlTosE9zuZUUp5PiXnHmV7NXHlNcr6IcAh 97ilLSggyCO1JAKfDTyNLdsvbIRA3y40zHHVQPWkRynv0GbRx4tqZaKLXa2dSQumi1mS rjLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=4DOeqJ5SMCOeWwnjErWXkoh3b+hyZguii3t6dQS8YmY=; b=S66uZZnL8IluBuSISOyfYVwIXAtzVGXpk8Yg434SXPrN95rbGQqSuD1OEyOrOvU/Wh t3nF+6asZM9Cpnk9QJB9nlcXb76KTp9zRB2zWBOEv4pg8i/E+p3qxMs9mW9IXhGja8Ew CsHwhfEvWlaMSsL2UxDDminYdqZlR3jk3GsqQaOC94zRqC3n1UogFNe5dS5bbeo3IW/d 8otZ2Z4Hfj7vSxxueQNLyEAZqzM/h6HJM41Dmc3ZClKKKmdcIX7220lmQwKXoWXDVxPJ ResnYSszI6Fxt4qTsd7Cnw4HMKp8BLDKoLVm32a0m4YMpF+ZubfgR6ePK3AX78R57dCs B+TQ== X-Gm-Message-State: ANoB5pljqkl1SyVggEPsIDIK0vW90i1iEmVIdxIUWlE2cHDcyYs5OCQL H3l6BK2BeWc0OHFVpNdZDoQ= X-Received: by 2002:a63:1c61:0:b0:464:45f3:8272 with SMTP id c33-20020a631c61000000b0046445f38272mr4755995pgm.610.1668242002513; Sat, 12 Nov 2022 00:33:22 -0800 (PST) Received: from VirtualBox.. ([129.227.152.6]) by smtp.gmail.com with ESMTPSA id i11-20020a1709026acb00b001870533c443sm3066927plt.236.2022.11.12.00.33.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Nov 2022 00:33:22 -0800 (PST) From: Yuwei Guan X-Google-Original-From: Yuwei Guan To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yuwei.Guan@zeekrlife.com Subject: [PATCH 1/3] f2fs: fix to alloc_mode changed after remount on a small volume device Date: Sat, 12 Nov 2022 16:32:48 +0800 Message-Id: <20221112083250.295700-2-Yuwei.Guan@zeekrlife.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221112083250.295700-1-Yuwei.Guan@zeekrlife.com> References: <20221112083250.295700-1-Yuwei.Guan@zeekrlife.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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?1749278740386625914?= X-GMAIL-MSGID: =?utf-8?q?1749278740386625914?= The commit 84b89e5d943d8 ("f2fs: add auto tuning for small devices") add tuning for small volume device, now support to tune alloce_mode to 'reuse' if it's small size. But the alloc_mode will change to 'default' when do remount on this small size dievce. The commit 4cac90d5491c9 ("f2fs: relocate readdir_ra configure initialization") relocates readdir_ra variable to tuning process. This patch fo fix alloc_mode changed when do remount for a small volume device. For a small device, - alloc_mode will keep 'reuse', if no alloc_mode option in remount command, - alloc_mode will be set as remount command, if it has 'alloc_mode='. Signed-off-by: Yuwei Guan --- fs/f2fs/super.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 3834ead04620..2f36824ff84b 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2190,6 +2190,23 @@ static void f2fs_enable_checkpoint(struct f2fs_sb_info *sbi) f2fs_flush_ckpt_thread(sbi); } +static void f2fs_tuning_parameters(struct f2fs_sb_info *sbi, bool is_remount) +{ + struct f2fs_sm_info *sm_i = SM_I(sbi); + + /* adjust parameters according to the volume size */ + if (sm_i->main_segments <= SMALL_VOLUME_SEGMENTS) { + F2FS_OPTION(sbi).alloc_mode = ALLOC_MODE_REUSE; + if (f2fs_block_unit_discard(sbi)) + sm_i->dcc_info->discard_granularity = 1; + sm_i->ipu_policy = 1 << F2FS_IPU_FORCE | + 1 << F2FS_IPU_HONOR_OPU_WRITE; + } + + if (!is_remount) + sbi->readdir_ra = 1; +} + static int f2fs_remount(struct super_block *sb, int *flags, char *data) { struct f2fs_sb_info *sbi = F2FS_SB(sb); @@ -2248,6 +2265,8 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) default_options(sbi); + f2fs_tuning_parameters(sbi, true); + /* parse mount options */ err = parse_options(sb, data, true); if (err) @@ -4054,22 +4073,6 @@ static int f2fs_setup_casefold(struct f2fs_sb_info *sbi) return 0; } -static void f2fs_tuning_parameters(struct f2fs_sb_info *sbi) -{ - struct f2fs_sm_info *sm_i = SM_I(sbi); - - /* adjust parameters according to the volume size */ - if (sm_i->main_segments <= SMALL_VOLUME_SEGMENTS) { - F2FS_OPTION(sbi).alloc_mode = ALLOC_MODE_REUSE; - if (f2fs_block_unit_discard(sbi)) - sm_i->dcc_info->discard_granularity = 1; - sm_i->ipu_policy = 1 << F2FS_IPU_FORCE | - 1 << F2FS_IPU_HONOR_OPU_WRITE; - } - - sbi->readdir_ra = 1; -} - static int f2fs_fill_super(struct super_block *sb, void *data, int silent) { struct f2fs_sb_info *sbi; @@ -4475,7 +4478,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) f2fs_join_shrinker(sbi); - f2fs_tuning_parameters(sbi); + f2fs_tuning_parameters(sbi, false); f2fs_notice(sbi, "Mounted with checkpoint version = %llx", cur_cp_version(F2FS_CKPT(sbi))); From patchwork Sat Nov 12 08:32:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuwei Guan X-Patchwork-Id: 19128 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1176371wru; Sat, 12 Nov 2022 00:38:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf6W44wgsTSFMgq1+onOZVVMQCd8cqr8mi1ro7SODMG89RQA9od6KiQCF37GVECB1QUN2fgd X-Received: by 2002:a63:2053:0:b0:470:1c9c:1d7b with SMTP id r19-20020a632053000000b004701c9c1d7bmr4792346pgm.452.1668242309807; Sat, 12 Nov 2022 00:38:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668242309; cv=none; d=google.com; s=arc-20160816; b=CEs6d0XQjTlsDd7sFLPmICI2Nw3glBeAmxE8RAPpo6JaORnF9Rot9LCPwsFtF8co3T dC8wUKoyzb4u3QiW1fYDxITjGxvxPAGiMFKjGb9qk4UPYvDqCp8DBkk4YKgX3GnLViqN JJAMwpQ4yxeXqi0nIm/eJKeX/LTCBAvS9PXjvCp5mCol3aDY3v1ZPRkqTI6m3ujh9FwF O0fAvzgezZG7vSYYzlgZv5Ik/Wt2Mck9CiPcB1rKxs7dIIxjQ5oZp2BaNb0zjVG6JR53 pLM9pcry+KmCnXxaQl2Thlwl8q9ggaf/uH8VPgf45IepkUq70DPlu/PDXS3fgt2JUwWH +IkQ== 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=uKgNXpHSoU4bJRdAiprU+Siq+ztqOPTG6adKu9Aw2Mw=; b=hEjd/XONKhdHoTDQs+rT2M57aicxIFdHueOfMFFsx9XX0FsycK5/BNzl7iSoS5NsPM SFU7DjRHWtmS9CfVJCMeb5qmPsPi2Vm1AcJONGqCCKiicNqrUP7lGfh/zH9r/FzKrvDe MEvH6v3NovALVmZ2GCpfqfJj2sNH1nS9Ik11nTGsrMzpJZQWzZWD5rmbDhuYjy3TjG4W VrY9oM1aKoOZ1A7maJzTL2ruhW7e/MytWpPIuhy2QpS+vKi7UNM4gXhFfaePLegpQiV4 Q6WTZ19xTabka+roNtOC946NF2xAAA+vKgGx3oztuaMPgBs37tqXqd4TPyX8J3PQEyba +Okw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fBP3FX0p; 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 q18-20020a170902dad200b0017c2a42fc8csi4859957plx.270.2022.11.12.00.38.15; Sat, 12 Nov 2022 00:38:29 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fBP3FX0p; 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 S234717AbiKLIdb (ORCPT + 99 others); Sat, 12 Nov 2022 03:33:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234656AbiKLId1 (ORCPT ); Sat, 12 Nov 2022 03:33:27 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9245FB33 for ; Sat, 12 Nov 2022 00:33:26 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id io19so6025285plb.8 for ; Sat, 12 Nov 2022 00:33:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=uKgNXpHSoU4bJRdAiprU+Siq+ztqOPTG6adKu9Aw2Mw=; b=fBP3FX0pwml50Uh6/7TLPrlSWu4YWvKJq6zHrIeKb0qe8NHom1gBIj7oK7F129fe6y aQulO3GzWYv65HSqRYzxN64wM63L70wge67TQdtKPZ0J5aojcZnDrahYEf9czVi0zdJa oxcEQlq7LokErV4Z76/A1SFCNFHpcAwoCMVTDaMeNmhdSOdQNaFhXUAiUU22//JmaZmY nsoVISIeSGI2ojwWXIRHMNQ4o3YKdSf6cZtJ64c6elvK+q4kuDnCZqO/XyCuW4qrC/bs BfEH5RfWE1ybX/0QxNDyleXrBOMqvSJpKySj1bz+7Wl9B0KgIzyy9VgVRcfJoPrsRr9/ nCCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=uKgNXpHSoU4bJRdAiprU+Siq+ztqOPTG6adKu9Aw2Mw=; b=izVa0XJmJlrR2LuggdPUmNU2K/6hdVNvBjn3hxJtLFG0qACav5Ao8QbdL11ZKpIaVQ RNcZ4op2Gj4VnFr8qED6eQo8Xt04GPCpIYBjO4z6r1xlGb9P5xYmN5Lf1KNBueNKDl+I lNPxmZ8EdMQKYHl36JMDFEnR04GWrLbdM6Eo4Pi9dMkmyAbWlcbUfQvNaHZxqb2L3jS3 3RcHBHsu72EnRXcpa0jKiRDct5D+ICaLC77vFxYdW82pHgJ71ot4+wPrMLdKQrZy60ZH qTf6xp/4dgXO5mgXk63FyIfTN5VTUchMJtMkS2xq+zmHkyR6w5qoL0FQIx3UxLa9LEZZ MVCg== X-Gm-Message-State: ANoB5plDxd5UiChWa12uuUrRn5EIfYwl/c77C6jVVMxnZ7GIqm7qXSmD us0t+fXuWccB7tXtjIOJWeEfEIhVlDg= X-Received: by 2002:a17:90a:d302:b0:20d:2f:709d with SMTP id p2-20020a17090ad30200b0020d002f709dmr5660496pju.40.1668242005943; Sat, 12 Nov 2022 00:33:25 -0800 (PST) Received: from VirtualBox.. ([129.227.152.6]) by smtp.gmail.com with ESMTPSA id i11-20020a1709026acb00b001870533c443sm3066927plt.236.2022.11.12.00.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Nov 2022 00:33:25 -0800 (PST) From: Yuwei Guan X-Google-Original-From: Yuwei Guan To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yuwei.Guan@zeekrlife.com Subject: [PATCH 2/3] f2fs: cleanup for 'f2fs_tuning_parameters' function Date: Sat, 12 Nov 2022 16:32:49 +0800 Message-Id: <20221112083250.295700-3-Yuwei.Guan@zeekrlife.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221112083250.295700-1-Yuwei.Guan@zeekrlife.com> References: <20221112083250.295700-1-Yuwei.Guan@zeekrlife.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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?1749278848402232432?= X-GMAIL-MSGID: =?utf-8?q?1749278848402232432?= A cleanup patch for 'f2fs_tuning_parameters' function. Signed-off-by: Yuwei Guan --- fs/f2fs/super.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 2f36824ff84b..f18ae5410b2c 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2192,14 +2192,12 @@ static void f2fs_enable_checkpoint(struct f2fs_sb_info *sbi) static void f2fs_tuning_parameters(struct f2fs_sb_info *sbi, bool is_remount) { - struct f2fs_sm_info *sm_i = SM_I(sbi); - /* adjust parameters according to the volume size */ - if (sm_i->main_segments <= SMALL_VOLUME_SEGMENTS) { + if (MAIN_SEGS(sbi) <= SMALL_VOLUME_SEGMENTS) { F2FS_OPTION(sbi).alloc_mode = ALLOC_MODE_REUSE; if (f2fs_block_unit_discard(sbi)) - sm_i->dcc_info->discard_granularity = 1; - sm_i->ipu_policy = 1 << F2FS_IPU_FORCE | + SM_I(sbi)->dcc_info->discard_granularity = 1; + SM_I(sbi)->ipu_policy = 1 << F2FS_IPU_FORCE | 1 << F2FS_IPU_HONOR_OPU_WRITE; } From patchwork Sat Nov 12 08:32:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuwei Guan X-Patchwork-Id: 19129 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1176544wru; Sat, 12 Nov 2022 00:39:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Jp9mHlWk+0fvig1UDaOXN4jMtON04kbfhzeTMfP6aekpgxK4oCtKvB1vOCwkyxrKh3r3u X-Received: by 2002:a63:27c1:0:b0:46f:cbca:e54f with SMTP id n184-20020a6327c1000000b0046fcbcae54fmr4688852pgn.146.1668242347993; Sat, 12 Nov 2022 00:39:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668242347; cv=none; d=google.com; s=arc-20160816; b=LyC3Nz/Fo6ZI5/xk/qvIXpMgBqi/za3q2bmjSVGiaF5lwi1CufY3J4kQfwgNudDf45 gk9IbAf8BcV9eMyy0phUX8C9aEJovs08vvXI66Kn0sG80K8KCWjVG0GAPWUgvkpK0ANW c7HY3ceLlqa1JpfRC3zEFsbk24gIsa2+3g+E0B+LdlmwVn7TqmRP1g2Cr3lMcfa/07mC lpcCFCU8DZ+CBEIhKoCLzFGeT4IzbNx5PPQ42gWtg5C8VnXgK553bWT8QKdKsukrpcdb BnFzYi+4gaaziRJ1oeBvouLNr8FG0KK1o6HlWVAxnGR9amX5hb42eHdwY2zA5bNsvPaz 69Qg== 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=HpSAL+Frp6pI5uZevffauYMAMF7An7PWhGzNk6t7irc=; b=S1xAJI+HAO4A0P8+p6rzD3gCa1VTni+AJAUsK9AWjuYSJdFevtcau5LPDmj0jhoGZ1 cPXs2tbFwbZXrB74jijo85fyn1yXARKQg7CQzgUsW8uILwc7u6MRPSyi0i03lfwzBZbw iQbVFfAyflBIiKiA7riinMe7MY+Iw468RY0LaMqIK1VLKhGW9mAqubIzX2j8b7PCpv7q 6q0BeZdR366U2G5n3gstwMDmyXLyKESHECYrq6X8wQJsEIoPrR/ETf/xtUjZ/MVnypp0 AgK7TYT2JJrT6aWzWcQFBv/9r5sgAGbWYGIvY67KnHyDkFMhnSElofDSxaSEThHcX/t1 EWGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BjdmEmrR; 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 g128-20020a636b86000000b00473cd4d74a1si4672558pgc.240.2022.11.12.00.38.46; Sat, 12 Nov 2022 00:39:07 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BjdmEmrR; 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 S234683AbiKLIdh (ORCPT + 99 others); Sat, 12 Nov 2022 03:33:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234743AbiKLIdb (ORCPT ); Sat, 12 Nov 2022 03:33:31 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA93F1082 for ; Sat, 12 Nov 2022 00:33:29 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id g24so6043984plq.3 for ; Sat, 12 Nov 2022 00:33:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=HpSAL+Frp6pI5uZevffauYMAMF7An7PWhGzNk6t7irc=; b=BjdmEmrRmKb1KewQe1wjYXRVdQ/+pvyafqjJ9iLoUU5lLUjrFYCLilfD2swqM8EmvL Mqws98NeNcg21hJWtyVmN7Mfn4wEv911g1lJbhC9FHAyiKlzIN8W8xcG33G0FOdXn44/ eXS024oauWVrIh64Eg7CBLazucVLvHLol7/DzM5W1Sgk9W164p3AeqeHVonaPxZyarIJ ItnN8XGiFU/3cnzMlrcYfLBv0/QzJ03AlGUKU2N7C5KuFG3zcceH64pZxHqsrCCWV3GL Xrm7AlApa4KRWs0lyP0jElIJCjC8StEW4ELpufPTfBGf88QwUYsWrmOU/nogrchzfSqE 7DDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=HpSAL+Frp6pI5uZevffauYMAMF7An7PWhGzNk6t7irc=; b=go1t4X6GWoXwUQ0uutMhTt5kXzwCR9rf1VNl9BZqKH9TZTWw3akpacIN4QWivjD+HQ geFb9Es7//6u4z6FdYD3CnQkqM+w7mh05zs7ArfxbMLAptAPBwoBSBRCyHUqwpHFtpp3 yM/6AVAXQZR1mUMZ+xyOTWg6iCECqeIo57kocaLTA0vieM2vXezD95UNkx9EKf9AiQF/ zxxdbvHdYKm8hoUqWiBpVwxEgOVxmL5J1L9DWubS4IVNqhNr0Xm66Dq74tsy+CYlq4Xl sBI7KVIOAG7nFw8k13Q1E41QcG6oJSjRBXsZag0TDuNcD3UFBR88NfQLJaKpL3U3xA4j wUfw== X-Gm-Message-State: ANoB5plOoZeB3QhgsWMNaVVzMlM8IqZMG+dDROeEONFUP4EV9WU2Siuo NGdGEjTOQGsSAHYh0X4ixWU= X-Received: by 2002:a17:90b:48cd:b0:213:47:57cc with SMTP id li13-20020a17090b48cd00b00213004757ccmr5459327pjb.174.1668242009382; Sat, 12 Nov 2022 00:33:29 -0800 (PST) Received: from VirtualBox.. ([129.227.152.6]) by smtp.gmail.com with ESMTPSA id i11-20020a1709026acb00b001870533c443sm3066927plt.236.2022.11.12.00.33.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Nov 2022 00:33:28 -0800 (PST) From: Yuwei Guan X-Google-Original-From: Yuwei Guan To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yuwei.Guan@zeekrlife.com Subject: [PATCH 3/3] f2fs: change type for 'sbi->readdir_ra' Date: Sat, 12 Nov 2022 16:32:50 +0800 Message-Id: <20221112083250.295700-4-Yuwei.Guan@zeekrlife.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221112083250.295700-1-Yuwei.Guan@zeekrlife.com> References: <20221112083250.295700-1-Yuwei.Guan@zeekrlife.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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?1749278888258560406?= X-GMAIL-MSGID: =?utf-8?q?1749278888258560406?= Before this patch, the varibale 'readdir_ra' takes effect if it's equal to '1' or not, so we can change type for it from 'int' to 'bool'. Signed-off-by: Yuwei Guan --- fs/f2fs/dir.c | 7 +++---- fs/f2fs/f2fs.h | 2 +- fs/f2fs/super.c | 2 +- fs/f2fs/sysfs.c | 5 +++++ 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 21960a899b6a..06d9bf98f5ae 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -1000,13 +1000,12 @@ int f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d, struct fscrypt_str de_name = FSTR_INIT(NULL, 0); struct f2fs_sb_info *sbi = F2FS_I_SB(d->inode); struct blk_plug plug; - bool readdir_ra = sbi->readdir_ra == 1; bool found_valid_dirent = false; int err = 0; bit_pos = ((unsigned long)ctx->pos % d->max); - if (readdir_ra) + if (sbi->readdir_ra) blk_start_plug(&plug); while (bit_pos < d->max) { @@ -1064,14 +1063,14 @@ int f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d, goto out; } - if (readdir_ra) + if (sbi->readdir_ra) f2fs_ra_node_page(sbi, le32_to_cpu(de->ino)); ctx->pos = start_pos + bit_pos; found_valid_dirent = true; } out: - if (readdir_ra) + if (sbi->readdir_ra) blk_finish_plug(&plug); return err; } diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index e6355a5683b7..384840216e7f 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1693,7 +1693,7 @@ struct f2fs_sb_info { unsigned int total_node_count; /* total node block count */ unsigned int total_valid_node_count; /* valid node block count */ int dir_level; /* directory level */ - int readdir_ra; /* readahead inode in readdir */ + bool readdir_ra; /* readahead inode in readdir */ u64 max_io_bytes; /* max io bytes to merge IOs */ block_t user_block_count; /* # of user blocks */ diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index f18ae5410b2c..da304861890f 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2202,7 +2202,7 @@ static void f2fs_tuning_parameters(struct f2fs_sb_info *sbi, bool is_remount) } if (!is_remount) - sbi->readdir_ra = 1; + sbi->readdir_ra = true; } static int f2fs_remount(struct super_block *sb, int *flags, char *data) diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index df27afd71ef4..53fbbb87dd0f 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -649,6 +649,11 @@ static ssize_t __sbi_store(struct f2fs_attr *a, return count; } + if (!strcmp(a->attr.name, "readdir_ra")) { + sbi->readdir_ra = !!t; + return count; + } + *ui = (unsigned int)t; return count;