From patchwork Sat Jan 21 05:12:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 46780 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp602852wrn; Fri, 20 Jan 2023 22:51:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXv0kPglxT+qCVynjJayYk2WF7Ibdv2OPVS01jWeSdjsdd5uzFlQHhDwuGzEejiY3IoePKac X-Received: by 2002:a17:907:d110:b0:7ae:8194:7e06 with SMTP id uy16-20020a170907d11000b007ae81947e06mr20806818ejc.56.1674283912590; Fri, 20 Jan 2023 22:51:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674283912; cv=pass; d=google.com; s=arc-20160816; b=vh3A4s7RgS7NPTuylMACw7sjPKZr4GU3EbV1PFLD6FnIm2meKdO42krlgADfSw2eR2 LguKpQBvURMFfTWr2gP1NluG9l7lUvWkyLmEi+hxp1giXj05tqPAEpmhNC+6dxaMcV9r 0wyPJbkHbMLZT1p1ISyIQaQyE+8IzaxGgbG48lxQCMaBtwNTs2te3w+Nxpv1YFBUHl+G AXK5Aqb4+Y0ucM4oSECI+V7wyPuITR/7TCxr5RYsdiOZIIsCB1KEkiVx8pzvbbDotQ3w F1KIKo3VlxEkOUzNKNmw+MdsL6J7UJIWywiLkxWJOp4vb5p2sWraqS5ABRzyMuGsgL1P VWZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=F6I6DBa4v9rMn+5+loHiuPsJUZqIj5HPxrbzwCe4L98=; b=cORsMM/4XXVpz+UOHzxR2eeeTZsqOKHq/5uzdllQ58B0dQHzJ6yDB75IEVyZS9LSdv sGAz2ld7zlJHK0PfDCGT6qBIBnRrtUEtZluPZbDXyYifBzrTbevd6msVV79yEaRnyACE D+I6fnADLEu2i7xINk6jq6I5MlcN5Jq98m4FJJfK42T5HGXE1HBqWOI6IHH5CIdna21O 8Go4pDW+IEudDdU2FYN3KeZjztRPWTfIEzLzIoqw5aR6QEs+M0ujZ5ieFaeCLhCgyZ1O 7TdiTPLnmkFkzc74qIRqVmj6FCfLFv5JQEJh/poS+Xf7F4fgJK5OGa68FRJqmAYzKgqR iOSg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=D8gUBKtU; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf21-20020a1709077f1500b0087122fab4c0si2933940ejc.155.2023.01.20.22.51.29; Fri, 20 Jan 2023 22:51:52 -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=@vivo.com header.s=selector2 header.b=D8gUBKtU; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229728AbjAUFMc (ORCPT + 99 others); Sat, 21 Jan 2023 00:12:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229711AbjAUFM3 (ORCPT ); Sat, 21 Jan 2023 00:12:29 -0500 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2134.outbound.protection.outlook.com [40.107.117.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB0DA73147 for ; Fri, 20 Jan 2023 21:12:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=buIZAvirdL5M6z7mqoeiyyY34gEdNGZZqK+re0ZzN5SG4P01JpMDDHvj1zF+qN/G16C6gaFD17S77e3PW4OxUzC5hf5yTXUxosvZh6urw9Vl/pVOySbyB2IlaubYnABugBXMeiOZK0sS7lrjSx1yznZm/einb0yEBHt1gH55r69yvZeLTHaHK7JkrE2CGLZQdSG26bT9nHSK8Ih71l9q+hxuKld80YqoVr4KqyAfIK5sPJQ1aZeJmWYzj4hE61UnG/JnEOkwUZKEZU7Sn2Tpug80qrw+nzB7Ul3sHNQJOshEhAw4A0yvYfN7SchIpS31f5qcsL5HUzo0i7hPvbeuXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=F6I6DBa4v9rMn+5+loHiuPsJUZqIj5HPxrbzwCe4L98=; b=TPYjTzVRiHmLC8gSnSid+qEqJBr+RO5neVGvqUaMQpR8yZ6J7qOA/GrDRToeBnr9NpHZVgWrqIveAKs8pI9ejgSREmnmLA2yFqT9j6kzaLgwWZjlrJqrZrHGXu3JnvFneMpg7lkRMEUa8+EyItOt5oC9TO+3pvIWjps5+RG1/sornwtVYO0n5Qrt3JPe1bS7E8ZjfNFY07f2gVYfZyepOGVx8LkjuiqvEDgEQzJRIBYpKF+uxTAFHC/s/lJK7tqJoqF2/M/FoyPdlvd1HpmrKT5ixVyy9nw4SuuXJmduNpkOC9WOrUHazvf897eaEX1HicgZ28XPoIDELfXCMUJSPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F6I6DBa4v9rMn+5+loHiuPsJUZqIj5HPxrbzwCe4L98=; b=D8gUBKtUNosIzmTije3bOVUv+6rP4t76g+quUfiz0Ch4/grwP/3uKnnjY1342/i9/lRw+HDf6/433YyVdX4EQ28bNYUiPBUH2qkqt2H4Qk/lsJS1D/RxnO++Ofh8UDlo/t8/GilcN0cr/3ohMn8JZf1TcyEoSLq3KTeX7Zj9MT3OGJayqe7s0NPBa0y5861vZk7OQXFKr4jIoc7XVldnxq/TiY8gHxIO61+azK2SIvdeoiM9c99QxojzMcKacqLidhQ3WNSNT/r4rpq5nqnKDxsOr8pekwGIL7XsXCAvG+0q8/JpRYL6ZFoMY9NJqwUcbLY9D7N2GJp8Rf+Utvsn2g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by TYZPR06MB3885.apcprd06.prod.outlook.com (2603:1096:400:6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.9; Sat, 21 Jan 2023 05:12:18 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::3e52:d08c:ecf4:d572]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::3e52:d08c:ecf4:d572%5]) with mapi id 15.20.6002.012; Sat, 21 Jan 2023 05:12:18 +0000 From: Yangtao Li To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH v2 1/5] f2fs: fix unnecessary newlines in super.c Date: Sat, 21 Jan 2023 13:12:00 +0800 Message-Id: <20230121051204.81251-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: SI2PR01CA0008.apcprd01.prod.exchangelabs.com (2603:1096:4:191::10) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYZPR06MB3885:EE_ X-MS-Office365-Filtering-Correlation-Id: 15f0235f-20b2-4ff5-fe45-08dafb6e1156 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BItqD6sKQgWbN+bW9blq/u7/rhXqf4YQsu+FN5S5MAz00V89U+bI5TE7ZtdciPxRAJpRjDiIjsKPsflZHJHuOMZvRubJ6WecA1L2YKvNwlvkZQksJ6gS2HXj5EFm71fFYfNqNZ/r0522V22ktmSejAFgHGMFIhaWLbzHM0sI4PSAqgHv4qa/wAAPMXFTMAOK5SZLSUNBo2b8FBNnE13XJ13Kt0SDwotlaiWgxqcCq93J4aB7vDEgd/BVXrK4bRJxx88PSHHl7y/bzasnxO1jnxvxbtCNQWma7xMP3lvpntZbneVmefJODHj6ISYgAoQ46us/HEkRWL7AXybj2RZTwasmqDVat9btVgf1BmdLvw5j3YJi5U9OoJXvrGYB5LNvmXyopkpTIspdTppg+ofoZvvGDl2kWpBHhv9CnpQ1MJu6lEDgGrsoNj3laAlT49CDrIC4iXc9waRdnlw+InIFe92LMQ35EZaqoBOzCLI1UlmUL0DOFsX8jBPWt5dhw0u8UvlTFC8opPN+64xAdR+cPsonUKKWg3uDoD2TlxCDH9XQ2NNjigJtGM9BFCHcw7FWq+UJKCUqIo9XA9CsI8CL5gpFyk/FXve1sO77oMJx3ghCBHnIvBGwvhu3yuMHYbhZXtCWyaXce6RW8wUfu9ZYfoKCZ3AQWggbg2E+Z8DodnR6mt4SfkGmWo5l5QvNW4yEB2FPE1NNyuInuZONM3a2wZHIHeluCbb6d9TaDLmOWQc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(39850400004)(136003)(346002)(376002)(366004)(451199015)(38350700002)(38100700002)(86362001)(6666004)(5660300002)(8936002)(30864003)(2906002)(66556008)(66476007)(8676002)(4326008)(66946007)(41300700001)(1076003)(2616005)(6506007)(6512007)(186003)(26005)(83380400001)(316002)(107886003)(52116002)(478600001)(6486002)(966005)(36756003)(559001)(579004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fp2wBEh2m/4ca7R6LdGZfWuPL7vg8IfQ9XQXzLZBPOZERy67O4fyBwySYI7INnPXe8aGSp0bDcQ77sBxTN29Cw5tJUBOUM/jm5SsToWIXcI4yK79JC5BO8qktyuiWHUs7An8TlW8s0kdETySWLPIgBAIsgByQN5667quaGXJKPe/5c/tiVguPU2+/VqGXDOGlyFq09i5Sp0cci0VIc0Y80LwezyA0h/pO1SDLwFZROn230tQl0o9C6mUbEVxEm9r4MiClv3MVO0S/zulXz+Nwi9N9hEGlIuA5p0xwB569lswsRTucq5qX5/k2+mGGp7ys+Sqx9AHD7ndozQ4xjIu2h5bhnvhJ7qZ5/PJ/HbQ4fkWzwum18fR2bR6K/U6K1d0NMYDmVbIIcGugi1gDtBJqz6b46qCbIBPnhj3FDbyRXz37bkgK9Q7haGVsGE93u3HxfnfRe0CAICBtdr+hJIDBHlS594BU1TcBWiMLOZ41Jf83rUd63Qcd0qy3s5SacAeIZIen8ckwRTFA6/rErF8MAaxK++DBh9y3/EKIrk1kTO5i7fBEmT2n7H5O2B8lUvGeouMCvv9QkjDlOsGQDTTai9h/c5dQdjb48Ftq9Pmpqq1n/xGumhPIPnyScrRBKEQmcfaKUr7jMEFZNXYHeyo1XgMFY6X6asnN4Tr1rsB0WhKzlh8TlEcyFAIINnp2SNUMSDwbjvgRY5m2g8jryZpyDQa4jx4VqLvX6cs9dClwpiw5HFzPIJz8qaosN2nbk7c+rNKp3q7KZbbvvrtQlf7+50r3sco/y2IlZxdxUPAA8mXNQvasMBtV4by1fsj1f0LQKg3Ncy8ChC/KEjtbBlvt399SDnGYgqc5wMoNomPhC0GInMMiN0WliPGhuY4YEQzMnDiCCLxNxtwsJS+Nyiwv1UsE50Sms2ZqFitp54viF3VL2Gx7K+YZVIjq5C1L7GXmfmDtOsjy2h4xaVaKYOzdBvzTxTFMwzw8DlLFX6nDLen3aUTFxOLD1+ge/Vt3cduLru4CTEMqapdl0cKONTsPTGTU2GdWJt0XGKxJhdhZZkNKlv33W7rcFKPJmqDby+m3HYv0oQjFhT08QdbmXjRB1dqN4q/l0+GiJTrpo+C3zJe9yesvV4+rwx8iIMSduoLorr37ikqpcqPkZCE3GJSilTx+JVwBPBnwMxH6O19J9ePUrkInKxT8R/pGhb9PXZgEfiOW7eJ73WTM3K6s3WM+//7pZ2kilk3PkwHxnRRT6cVp4yZlTUFcr4jE7sF/4qr147eRSdkUrXbsfgyNj3YYNUNlZRkUfbdgiLrolNWkv0dD4jEBlKGLbsUtuq0xrv432aeBQoPRbxmhatQRpIglc/0HA2gI8EAKHm1TMX6nQ7EbtM1XPVzPq72NFBQCCH3DhpFrAoc+uMggm9vmEENoA2eTRBzNECgM3xUYH+FjHFkHDggnpw5ZzELgO8+c2xG3PBYtu0p3qKbFfMyNeVT4Zb6xmEg810ygem3uYFbZ3PgJxosPl+Ti0tBhaHAgRnNrm9vdg4iI+IETYwMewVmCXo0Bv2GC+8Dttheqtd2d82DMRBkDOfXyWZTYFFT3GbL X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15f0235f-20b2-4ff5-fe45-08dafb6e1156 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2023 05:12:18.4980 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zBauoIwxaenwimWyLqe0LqP2wGmd/3v42mm1Sljw9Qw/tWoPPQthl6eJDGc0KClIovVBzEBl1egddwiOJcvK/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB3885 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED 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?1755613927560422292?= X-GMAIL-MSGID: =?utf-8?q?1755613927560422292?= commit bdc48fa11e46 ("checkpatch/coding-style: deprecate 80-column warning") increased the limit to 100 columns. Let's remove some unnecessary newlines. BTW remove a unnecessary blank line and fix blow warning: WARNING: printk() should include KERN_ facility level + printk("F2FS not supported on PAGE_SIZE(%lu) != %d\n", PAGE_SIZE, F2FS_BLKSIZE); WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ... + printk(KERN_ERR "F2FS not supported on PAGE_SIZE(%lu) != %d\n", PAGE_SIZE, F2FS_BLKSIZE); Signed-off-by: Yangtao Li --- fs/f2fs/super.c | 493 ++++++++++++++++-------------------------------- 1 file changed, 167 insertions(+), 326 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index d8a65645ee48..0cedb693db58 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -5,6 +5,9 @@ * Copyright (c) 2012 Samsung Electronics Co., Ltd. * http://www.samsung.com/ */ + +#define pr_fmt(fmt) "F2FS: " fmt + #include #include #include @@ -378,8 +381,7 @@ static inline void adjust_unusable_cap_perc(struct f2fs_sb_info *sbi) F2FS_OPTION(sbi).unusable_cap_perc; f2fs_info(sbi, "Adjust unusable cap for checkpoint=disable = %u / %u%%", - F2FS_OPTION(sbi).unusable_cap, - F2FS_OPTION(sbi).unusable_cap_perc); + F2FS_OPTION(sbi).unusable_cap, F2FS_OPTION(sbi).unusable_cap_perc); } static void init_once(void *foo) @@ -417,8 +419,7 @@ static int f2fs_set_qf_name(struct super_block *sb, int qtype, if (strcmp(F2FS_OPTION(sbi).s_qf_names[qtype], qname) == 0) ret = 0; else - f2fs_err(sbi, "%s quota file already specified", - QTYPE2NAME(qtype)); + f2fs_err(sbi, "%s quota file already specified", QTYPE2NAME(qtype)); goto errout; } if (strchr(qname, '/')) { @@ -457,23 +458,18 @@ static int f2fs_check_quota_options(struct f2fs_sb_info *sbi) f2fs_err(sbi, "Project quota feature not enabled. Cannot enable project quota enforcement."); return -1; } - if (F2FS_OPTION(sbi).s_qf_names[USRQUOTA] || - F2FS_OPTION(sbi).s_qf_names[GRPQUOTA] || + if (F2FS_OPTION(sbi).s_qf_names[USRQUOTA] || F2FS_OPTION(sbi).s_qf_names[GRPQUOTA] || F2FS_OPTION(sbi).s_qf_names[PRJQUOTA]) { - if (test_opt(sbi, USRQUOTA) && - F2FS_OPTION(sbi).s_qf_names[USRQUOTA]) + if (test_opt(sbi, USRQUOTA) && F2FS_OPTION(sbi).s_qf_names[USRQUOTA]) clear_opt(sbi, USRQUOTA); - if (test_opt(sbi, GRPQUOTA) && - F2FS_OPTION(sbi).s_qf_names[GRPQUOTA]) + if (test_opt(sbi, GRPQUOTA) && F2FS_OPTION(sbi).s_qf_names[GRPQUOTA]) clear_opt(sbi, GRPQUOTA); - if (test_opt(sbi, PRJQUOTA) && - F2FS_OPTION(sbi).s_qf_names[PRJQUOTA]) + if (test_opt(sbi, PRJQUOTA) && F2FS_OPTION(sbi).s_qf_names[PRJQUOTA]) clear_opt(sbi, PRJQUOTA); - if (test_opt(sbi, GRPQUOTA) || test_opt(sbi, USRQUOTA) || - test_opt(sbi, PRJQUOTA)) { + if (test_opt(sbi, GRPQUOTA) || test_opt(sbi, USRQUOTA) || test_opt(sbi, PRJQUOTA)) { f2fs_err(sbi, "old and new quota format mixing"); return -1; } @@ -502,8 +498,7 @@ static int f2fs_set_test_dummy_encryption(struct super_block *sb, .type = fs_value_is_string, .string = arg->from ? arg->from : "", }; - struct fscrypt_dummy_policy *policy = - &F2FS_OPTION(sbi).dummy_enc_policy; + struct fscrypt_dummy_policy *policy = &F2FS_OPTION(sbi).dummy_enc_policy; int err; if (!IS_ENABLED(CONFIG_FS_ENCRYPTION)) { @@ -530,20 +525,16 @@ static int f2fs_set_test_dummy_encryption(struct super_block *sb, err = fscrypt_parse_test_dummy_encryption(¶m, policy); if (err) { if (err == -EEXIST) - f2fs_warn(sbi, - "Can't change test_dummy_encryption on remount"); + f2fs_warn(sbi, "Can't change test_dummy_encryption on remount"); else if (err == -EINVAL) - f2fs_warn(sbi, "Value of option \"%s\" is unrecognized", - opt); + f2fs_warn(sbi, "Value of option \"%s\" is unrecognized", opt); else - f2fs_warn(sbi, "Error processing option \"%s\" [%d]", - opt, err); + f2fs_warn(sbi, "Error processing option \"%s\" [%d]", opt, err); return -EINVAL; } err = fscrypt_add_test_dummy_key(sb, policy); if (err) { - f2fs_warn(sbi, "Error adding test dummy encryption key [%d]", - err); + f2fs_warn(sbi, "Error adding test dummy encryption key [%d]", err); return err; } f2fs_warn(sbi, "Test dummy encryption mode enabled"); @@ -783,8 +774,7 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) case Opt_active_logs: if (args->from && match_int(args, &arg)) return -EINVAL; - if (arg != 2 && arg != 4 && - arg != NR_CURSEG_PERSIST_TYPE) + if (arg != 2 && arg != 4 && arg != NR_CURSEG_PERSIST_TYPE) return -EINVAL; F2FS_OPTION(sbi).active_logs = arg; break; @@ -1078,8 +1068,7 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) if (!strcmp(name, "lzo")) { #ifdef CONFIG_F2FS_FS_LZO F2FS_OPTION(sbi).compress_level = 0; - F2FS_OPTION(sbi).compress_algorithm = - COMPRESS_LZO; + F2FS_OPTION(sbi).compress_algorithm = COMPRESS_LZO; #else f2fs_info(sbi, "kernel doesn't support lzo compression"); #endif @@ -1090,8 +1079,7 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) kfree(name); return -EINVAL; } - F2FS_OPTION(sbi).compress_algorithm = - COMPRESS_LZ4; + F2FS_OPTION(sbi).compress_algorithm = COMPRESS_LZ4; #else f2fs_info(sbi, "kernel doesn't support lz4 compression"); #endif @@ -1102,16 +1090,14 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) kfree(name); return -EINVAL; } - F2FS_OPTION(sbi).compress_algorithm = - COMPRESS_ZSTD; + F2FS_OPTION(sbi).compress_algorithm = COMPRESS_ZSTD; #else f2fs_info(sbi, "kernel doesn't support zstd compression"); #endif } else if (!strcmp(name, "lzo-rle")) { #ifdef CONFIG_F2FS_FS_LZORLE F2FS_OPTION(sbi).compress_level = 0; - F2FS_OPTION(sbi).compress_algorithm = - COMPRESS_LZORLE; + F2FS_OPTION(sbi).compress_algorithm = COMPRESS_LZORLE; #else f2fs_info(sbi, "kernel doesn't support lzorle compression"); #endif @@ -1128,10 +1114,8 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) } if (args->from && match_int(args, &arg)) return -EINVAL; - if (arg < MIN_COMPRESS_LOG_SIZE || - arg > MAX_COMPRESS_LOG_SIZE) { - f2fs_err(sbi, - "Compress cluster log size is out of range"); + if (arg < MIN_COMPRESS_LOG_SIZE || arg > MAX_COMPRESS_LOG_SIZE) { + f2fs_err(sbi, "Compress cluster log size is out of range"); return -EINVAL; } F2FS_OPTION(sbi).compress_log_size = arg; @@ -1148,10 +1132,8 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) ext = F2FS_OPTION(sbi).extensions; ext_cnt = F2FS_OPTION(sbi).compress_ext_cnt; - if (strlen(name) >= F2FS_EXTENSION_LEN || - ext_cnt >= COMPRESS_EXT_NUM) { - f2fs_err(sbi, - "invalid extension length/number"); + if (strlen(name) >= F2FS_EXTENSION_LEN || ext_cnt >= COMPRESS_EXT_NUM) { + f2fs_err(sbi, "invalid extension length/number"); kfree(name); return -EINVAL; } @@ -1172,10 +1154,8 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) noext = F2FS_OPTION(sbi).noextensions; noext_cnt = F2FS_OPTION(sbi).nocompress_ext_cnt; - if (strlen(name) >= F2FS_EXTENSION_LEN || - noext_cnt >= COMPRESS_EXT_NUM) { - f2fs_err(sbi, - "invalid extension length/number"); + if (strlen(name) >= F2FS_EXTENSION_LEN || noext_cnt >= COMPRESS_EXT_NUM) { + f2fs_err(sbi, "invalid extension length/number"); kfree(name); return -EINVAL; } @@ -1229,14 +1209,11 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) if (!name) return -ENOMEM; if (!strcmp(name, "block")) { - F2FS_OPTION(sbi).discard_unit = - DISCARD_UNIT_BLOCK; + F2FS_OPTION(sbi).discard_unit = DISCARD_UNIT_BLOCK; } else if (!strcmp(name, "segment")) { - F2FS_OPTION(sbi).discard_unit = - DISCARD_UNIT_SEGMENT; + F2FS_OPTION(sbi).discard_unit = DISCARD_UNIT_SEGMENT; } else if (!strcmp(name, "section")) { - F2FS_OPTION(sbi).discard_unit = - DISCARD_UNIT_SECTION; + F2FS_OPTION(sbi).discard_unit = DISCARD_UNIT_SECTION; } else { kfree(name); return -EINVAL; @@ -1248,11 +1225,9 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) if (!name) return -ENOMEM; if (!strcmp(name, "normal")) { - F2FS_OPTION(sbi).memory_mode = - MEMORY_MODE_NORMAL; + F2FS_OPTION(sbi).memory_mode = MEMORY_MODE_NORMAL; } else if (!strcmp(name, "low")) { - F2FS_OPTION(sbi).memory_mode = - MEMORY_MODE_LOW; + F2FS_OPTION(sbi).memory_mode = MEMORY_MODE_LOW; } else { kfree(name); return -EINVAL; @@ -1263,8 +1238,7 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) set_opt(sbi, AGE_EXTENT_CACHE); break; default: - f2fs_err(sbi, "Unrecognized mount option \"%s\" or missing value", - p); + f2fs_err(sbi, "Unrecognized mount option \"%s\" or missing value", p); return -EINVAL; } } @@ -1284,8 +1258,7 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) #endif #if !IS_ENABLED(CONFIG_UNICODE) if (f2fs_sb_has_casefold(sbi)) { - f2fs_err(sbi, - "Filesystem with casefold feature cannot be mounted without CONFIG_UNICODE"); + f2fs_err(sbi, "Filesystem with casefold feature cannot be mounted without CONFIG_UNICODE"); return -EINVAL; } #endif @@ -1296,11 +1269,9 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) */ if (f2fs_sb_has_blkzoned(sbi)) { #ifdef CONFIG_BLK_DEV_ZONED - if (F2FS_OPTION(sbi).discard_unit != - DISCARD_UNIT_SECTION) { + if (F2FS_OPTION(sbi).discard_unit != DISCARD_UNIT_SECTION) { f2fs_info(sbi, "Zoned block device doesn't need small discard, set discard_unit=section by default"); - F2FS_OPTION(sbi).discard_unit = - DISCARD_UNIT_SECTION; + F2FS_OPTION(sbi).discard_unit = DISCARD_UNIT_SECTION; } #else f2fs_err(sbi, "Zoned block device support is not enabled"); @@ -1316,16 +1287,14 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) #endif if (F2FS_IO_SIZE_BITS(sbi) && !f2fs_lfs_mode(sbi)) { - f2fs_err(sbi, "Should set mode=lfs with %uKB-sized IO", - F2FS_IO_SIZE_KB(sbi)); + f2fs_err(sbi, "Should set mode=lfs with %uKB-sized IO", F2FS_IO_SIZE_KB(sbi)); return -EINVAL; } if (test_opt(sbi, INLINE_XATTR_SIZE)) { int min_size, max_size; - if (!f2fs_sb_has_extra_attr(sbi) || - !f2fs_sb_has_flexible_inline_xattr(sbi)) { + if (!f2fs_sb_has_extra_attr(sbi) || !f2fs_sb_has_flexible_inline_xattr(sbi)) { f2fs_err(sbi, "extra_attr or flexible_inline_xattr feature is off"); return -EINVAL; } @@ -1408,8 +1377,7 @@ static int f2fs_drop_inode(struct inode *inode) * drop useless meta/node dirty pages. */ if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) { - if (inode->i_ino == F2FS_NODE_INO(sbi) || - inode->i_ino == F2FS_META_INO(sbi)) { + if (inode->i_ino == F2FS_NODE_INO(sbi) || inode->i_ino == F2FS_META_INO(sbi)) { trace_f2fs_drop_inode(inode, 1); return 1; } @@ -1434,8 +1402,7 @@ static int f2fs_drop_inode(struct inode *inode) sb_start_intwrite(inode->i_sb); f2fs_i_size_write(inode, 0); - f2fs_submit_merged_write_cond(F2FS_I_SB(inode), - inode, NULL, 0, DATA); + f2fs_submit_merged_write_cond(F2FS_I_SB(inode), inode, NULL, 0, DATA); truncate_inode_pages_final(inode->i_mapping); if (F2FS_HAS_BLOCKS(inode)) @@ -1469,8 +1436,7 @@ int f2fs_inode_dirtied(struct inode *inode, bool sync) stat_inc_dirty_inode(sbi, DIRTY_META); } if (sync && list_empty(&F2FS_I(inode)->gdirty_list)) { - list_add_tail(&F2FS_I(inode)->gdirty_list, - &sbi->inode_list[DIRTY_META]); + list_add_tail(&F2FS_I(inode)->gdirty_list, &sbi->inode_list[DIRTY_META]); inc_page_count(sbi, F2FS_DIRTY_IMETA); } spin_unlock(&sbi->inode_lock[DIRTY_META]); @@ -1505,8 +1471,7 @@ static void f2fs_dirty_inode(struct inode *inode, int flags) { struct f2fs_sb_info *sbi = F2FS_I_SB(inode); - if (inode->i_ino == F2FS_NODE_INO(sbi) || - inode->i_ino == F2FS_META_INO(sbi)) + if (inode->i_ino == F2FS_NODE_INO(sbi) || inode->i_ino == F2FS_META_INO(sbi)) return; if (is_inode_flag_set(inode, FI_AUTO_RECOVER)) @@ -1566,8 +1531,7 @@ static void f2fs_put_super(struct super_block *sb) * But, the previous checkpoint was not done by umount, it needs to do * clean checkpoint again. */ - if ((is_sbi_flag_set(sbi, SBI_IS_DIRTY) || - !is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG))) { + if ((is_sbi_flag_set(sbi, SBI_IS_DIRTY) || !is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG))) { struct cp_control cpc = { .reason = CP_UMOUNT, }; @@ -1708,8 +1672,7 @@ static int f2fs_statfs_project(struct super_block *sb, return PTR_ERR(dquot); spin_lock(&dquot->dq_dqb_lock); - limit = min_not_zero(dquot->dq_dqb.dqb_bsoftlimit, - dquot->dq_dqb.dqb_bhardlimit); + limit = min_not_zero(dquot->dq_dqb.dqb_bsoftlimit, dquot->dq_dqb.dqb_bhardlimit); if (limit) limit >>= sb->s_blocksize_bits; @@ -1717,18 +1680,15 @@ static int f2fs_statfs_project(struct super_block *sb, curblock = (dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace) >> sb->s_blocksize_bits; buf->f_blocks = limit; - buf->f_bfree = buf->f_bavail = - (buf->f_blocks > curblock) ? + buf->f_bfree = buf->f_bavail = (buf->f_blocks > curblock) ? (buf->f_blocks - curblock) : 0; } - limit = min_not_zero(dquot->dq_dqb.dqb_isoftlimit, - dquot->dq_dqb.dqb_ihardlimit); + limit = min_not_zero(dquot->dq_dqb.dqb_isoftlimit, dquot->dq_dqb.dqb_ihardlimit); if (limit && buf->f_files > limit) { buf->f_files = limit; - buf->f_ffree = - (buf->f_files > dquot->dq_dqb.dqb_curinodes) ? + buf->f_ffree = (buf->f_files > dquot->dq_dqb.dqb_curinodes) ? (buf->f_files - dquot->dq_dqb.dqb_curinodes) : 0; } @@ -1759,8 +1719,7 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf) user_block_count = sbi->user_block_count; total_valid_node_count = valid_node_count(sbi); avail_node_count = sbi->total_node_count - F2FS_RESERVED_NODE_NUM; - buf->f_bfree = user_block_count - valid_user_blocks(sbi) - - sbi->current_reserved_blocks; + buf->f_bfree = user_block_count - valid_user_blocks(sbi) - sbi->current_reserved_blocks; if (unlikely(buf->f_bfree <= sbi->unusable_block_count)) buf->f_bfree = 0; @@ -1769,8 +1728,7 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf) spin_unlock(&sbi->stat_lock); if (buf->f_bfree > F2FS_OPTION(sbi).root_reserved_blocks) - buf->f_bavail = buf->f_bfree - - F2FS_OPTION(sbi).root_reserved_blocks; + buf->f_bavail = buf->f_bfree - F2FS_OPTION(sbi).root_reserved_blocks; else buf->f_bavail = 0; @@ -1779,8 +1737,7 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf) buf->f_ffree = buf->f_bavail; } else { buf->f_files = avail_node_count; - buf->f_ffree = min(avail_node_count - total_valid_node_count, - buf->f_bavail); + buf->f_ffree = min(avail_node_count - total_valid_node_count, buf->f_bavail); } buf->f_namelen = F2FS_NAME_LEN; @@ -1819,16 +1776,13 @@ static inline void f2fs_show_quota_options(struct seq_file *seq, } if (F2FS_OPTION(sbi).s_qf_names[USRQUOTA]) - seq_show_option(seq, "usrjquota", - F2FS_OPTION(sbi).s_qf_names[USRQUOTA]); + seq_show_option(seq, "usrjquota", F2FS_OPTION(sbi).s_qf_names[USRQUOTA]); if (F2FS_OPTION(sbi).s_qf_names[GRPQUOTA]) - seq_show_option(seq, "grpjquota", - F2FS_OPTION(sbi).s_qf_names[GRPQUOTA]); + seq_show_option(seq, "grpjquota", F2FS_OPTION(sbi).s_qf_names[GRPQUOTA]); if (F2FS_OPTION(sbi).s_qf_names[PRJQUOTA]) - seq_show_option(seq, "prjjquota", - F2FS_OPTION(sbi).s_qf_names[PRJQUOTA]); + seq_show_option(seq, "prjjquota", F2FS_OPTION(sbi).s_qf_names[PRJQUOTA]); #endif } @@ -1862,18 +1816,13 @@ static inline void f2fs_show_compress_options(struct seq_file *seq, if (F2FS_OPTION(sbi).compress_level) seq_printf(seq, ":%d", F2FS_OPTION(sbi).compress_level); - seq_printf(seq, ",compress_log_size=%u", - F2FS_OPTION(sbi).compress_log_size); + seq_printf(seq, ",compress_log_size=%u", F2FS_OPTION(sbi).compress_log_size); - for (i = 0; i < F2FS_OPTION(sbi).compress_ext_cnt; i++) { - seq_printf(seq, ",compress_extension=%s", - F2FS_OPTION(sbi).extensions[i]); - } + for (i = 0; i < F2FS_OPTION(sbi).compress_ext_cnt; i++) + seq_printf(seq, ",compress_extension=%s", F2FS_OPTION(sbi).extensions[i]); - for (i = 0; i < F2FS_OPTION(sbi).nocompress_ext_cnt; i++) { - seq_printf(seq, ",nocompress_extension=%s", - F2FS_OPTION(sbi).noextensions[i]); - } + for (i = 0; i < F2FS_OPTION(sbi).nocompress_ext_cnt; i++) + seq_printf(seq, ",nocompress_extension=%s", F2FS_OPTION(sbi).noextensions[i]); if (F2FS_OPTION(sbi).compress_chksum) seq_puts(seq, ",compress_chksum"); @@ -1931,8 +1880,7 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root) else seq_puts(seq, ",noinline_xattr"); if (test_opt(sbi, INLINE_XATTR_SIZE)) - seq_printf(seq, ",inline_xattr_size=%u", - F2FS_OPTION(sbi).inline_xattr_size); + seq_printf(seq, ",inline_xattr_size=%u", F2FS_OPTION(sbi).inline_xattr_size); #endif #ifdef CONFIG_F2FS_FS_POSIX_ACL if (test_opt(sbi, POSIX_ACL)) @@ -1982,19 +1930,14 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root) if (test_opt(sbi, RESERVE_ROOT)) seq_printf(seq, ",reserve_root=%u,resuid=%u,resgid=%u", F2FS_OPTION(sbi).root_reserved_blocks, - from_kuid_munged(&init_user_ns, - F2FS_OPTION(sbi).s_resuid), - from_kgid_munged(&init_user_ns, - F2FS_OPTION(sbi).s_resgid)); + from_kuid_munged(&init_user_ns, F2FS_OPTION(sbi).s_resuid), + from_kgid_munged(&init_user_ns, F2FS_OPTION(sbi).s_resgid)); if (F2FS_IO_SIZE_BITS(sbi)) - seq_printf(seq, ",io_bits=%u", - F2FS_OPTION(sbi).write_io_size_bits); + seq_printf(seq, ",io_bits=%u", F2FS_OPTION(sbi).write_io_size_bits); #ifdef CONFIG_F2FS_FAULT_INJECTION if (test_opt(sbi, FAULT_INJECTION)) { - seq_printf(seq, ",fault_injection=%u", - F2FS_OPTION(sbi).fault_info.inject_rate); - seq_printf(seq, ",fault_type=%u", - F2FS_OPTION(sbi).fault_info.inject_type); + seq_printf(seq, ",fault_injection=%u", F2FS_OPTION(sbi).fault_info.inject_rate); + seq_printf(seq, ",fault_type=%u", F2FS_OPTION(sbi).fault_info.inject_type); } #endif #ifdef CONFIG_QUOTA @@ -2057,8 +2000,7 @@ static void default_options(struct f2fs_sb_info *sbi) F2FS_OPTION(sbi).active_logs = NR_CURSEG_PERSIST_TYPE; F2FS_OPTION(sbi).inline_xattr_size = DEFAULT_INLINE_XATTR_ADDRS; - if (le32_to_cpu(F2FS_RAW_SUPER(sbi)->segment_count_main) <= - SMALL_VOLUME_SEGMENTS) + if (le32_to_cpu(F2FS_RAW_SUPER(sbi)->segment_count_main) <= SMALL_VOLUME_SEGMENTS) F2FS_OPTION(sbi).alloc_mode = ALLOC_MODE_REUSE; else F2FS_OPTION(sbi).alloc_mode = ALLOC_MODE_DEFAULT; @@ -2242,9 +2184,8 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) org_mount_opt.s_jquota_fmt = F2FS_OPTION(sbi).s_jquota_fmt; for (i = 0; i < MAXQUOTAS; i++) { if (F2FS_OPTION(sbi).s_qf_names[i]) { - org_mount_opt.s_qf_names[i] = - kstrdup(F2FS_OPTION(sbi).s_qf_names[i], - GFP_KERNEL); + org_mount_opt.s_qf_names[i] = kstrdup(F2FS_OPTION(sbi).s_qf_names[i], + GFP_KERNEL); if (!org_mount_opt.s_qf_names[i]) { for (j = 0; j < i; j++) kfree(org_mount_opt.s_qf_names[j]); @@ -2259,8 +2200,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) /* recover superblocks we couldn't write due to previous RO mount */ if (!(*flags & SB_RDONLY) && is_sbi_flag_set(sbi, SBI_NEED_SB_WRITE)) { err = f2fs_commit_super(sbi, false); - f2fs_info(sbi, "Try to recover all the superblocks, ret: %d", - err); + f2fs_info(sbi, "Try to recover all the superblocks, ret: %d", err); if (!err) clear_sbi_flag(sbi, SBI_NEED_SB_WRITE); } @@ -2350,8 +2290,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) * or if background_gc = off is passed in mount * option. Also sync the filesystem. */ - if ((*flags & SB_RDONLY) || - (F2FS_OPTION(sbi).bggc_mode == BGGC_MODE_OFF && + if ((*flags & SB_RDONLY) || (F2FS_OPTION(sbi).bggc_mode == BGGC_MODE_OFF && !test_opt(sbi, GC_MERGE))) { if (sbi->gc_thread) { f2fs_stop_gc_thread(sbi); @@ -2383,9 +2322,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) err = f2fs_start_ckpt_thread(sbi); if (err) { - f2fs_err(sbi, - "Failed to start F2FS issue_checkpoint_thread (%d)", - err); + f2fs_err(sbi, "Failed to start F2FS issue_checkpoint_thread (%d)", err); goto restore_gc; } need_stop_ckpt = true; @@ -2556,11 +2493,9 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type, int tocopy; while (towrite > 0) { - tocopy = min_t(unsigned long, sb->s_blocksize - offset, - towrite); + tocopy = min_t(unsigned long, sb->s_blocksize - offset, towrite); retry: - err = a_ops->write_begin(NULL, mapping, off, tocopy, - &page, &fsdata); + err = a_ops->write_begin(NULL, mapping, off, tocopy, &page, &fsdata); if (unlikely(err)) { if (err == -ENOMEM) { f2fs_io_schedule_timeout(DEFAULT_IO_TIMEOUT); @@ -2572,8 +2507,7 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type, memcpy_to_page(page, offset, data, tocopy); - a_ops->write_end(NULL, mapping, off, tocopy, tocopy, - page, fsdata); + a_ops->write_end(NULL, mapping, off, tocopy, tocopy, page, fsdata); offset = 0; towrite -= tocopy; off += tocopy; @@ -2638,8 +2572,7 @@ int f2fs_enable_quota_files(struct f2fs_sb_info *sbi, bool rdonly) enabled = 1; continue; } - f2fs_err(sbi, "Cannot turn on quotas: %d on %d", - err, i); + f2fs_err(sbi, "Cannot turn on quotas: %d on %d", err, i); } } return enabled; @@ -2700,8 +2633,7 @@ static int f2fs_enable_quotas(struct super_block *sb) type, err); for (type--; type >= 0; type--) dquot_quota_off(sb, type); - set_sbi_flag(F2FS_SB(sb), - SBI_QUOTA_NEED_REPAIR); + set_sbi_flag(F2FS_SB(sb), SBI_QUOTA_NEED_REPAIR); return err; } } @@ -3021,8 +2953,7 @@ static const struct super_operations f2fs_sops = { #ifdef CONFIG_FS_ENCRYPTION static int f2fs_get_context(struct inode *inode, void *ctx, size_t len) { - return f2fs_getxattr(inode, F2FS_XATTR_INDEX_ENCRYPTION, - F2FS_XATTR_NAME_ENCRYPTION_CONTEXT, + return f2fs_getxattr(inode, F2FS_XATTR_INDEX_ENCRYPTION, F2FS_XATTR_NAME_ENCRYPTION_CONTEXT, ctx, len, NULL); } @@ -3041,8 +2972,7 @@ static int f2fs_set_context(struct inode *inode, const void *ctx, size_t len, inode->i_ino == F2FS_ROOT_INO(sbi)) return -EPERM; - return f2fs_setxattr(inode, F2FS_XATTR_INDEX_ENCRYPTION, - F2FS_XATTR_NAME_ENCRYPTION_CONTEXT, + return f2fs_setxattr(inode, F2FS_XATTR_INDEX_ENCRYPTION, F2FS_XATTR_NAME_ENCRYPTION_CONTEXT, ctx, len, fs_data, XATTR_CREATE); } @@ -3130,8 +3060,7 @@ static struct dentry *f2fs_fh_to_dentry(struct super_block *sb, struct fid *fid, static struct dentry *f2fs_fh_to_parent(struct super_block *sb, struct fid *fid, int fh_len, int fh_type) { - return generic_fh_to_parent(sb, fid, fh_len, fh_type, - f2fs_nfs_get_inode); + return generic_fh_to_parent(sb, fid, fh_len, fh_type, f2fs_nfs_get_inode); } static const struct export_operations f2fs_export_ops = { @@ -3203,10 +3132,8 @@ static inline bool sanity_check_area_boundary(struct f2fs_sb_info *sbi, u32 segment_count_main = le32_to_cpu(raw_super->segment_count_main); u32 segment_count = le32_to_cpu(raw_super->segment_count); u32 log_blocks_per_seg = le32_to_cpu(raw_super->log_blocks_per_seg); - u64 main_end_blkaddr = main_blkaddr + - (segment_count_main << log_blocks_per_seg); - u64 seg_end_blkaddr = segment0_blkaddr + - (segment_count << log_blocks_per_seg); + u64 main_end_blkaddr = main_blkaddr + (segment_count_main << log_blocks_per_seg); + u64 seg_end_blkaddr = segment0_blkaddr + (segment_count << log_blocks_per_seg); if (segment0_blkaddr != cp_blkaddr) { f2fs_info(sbi, "Mismatch start address, segment0(%u) cp_blkaddr(%u)", @@ -3214,42 +3141,33 @@ static inline bool sanity_check_area_boundary(struct f2fs_sb_info *sbi, return true; } - if (cp_blkaddr + (segment_count_ckpt << log_blocks_per_seg) != - sit_blkaddr) { + if (cp_blkaddr + (segment_count_ckpt << log_blocks_per_seg) != sit_blkaddr) { f2fs_info(sbi, "Wrong CP boundary, start(%u) end(%u) blocks(%u)", - cp_blkaddr, sit_blkaddr, - segment_count_ckpt << log_blocks_per_seg); + cp_blkaddr, sit_blkaddr, segment_count_ckpt << log_blocks_per_seg); return true; } - if (sit_blkaddr + (segment_count_sit << log_blocks_per_seg) != - nat_blkaddr) { + if (sit_blkaddr + (segment_count_sit << log_blocks_per_seg) != nat_blkaddr) { f2fs_info(sbi, "Wrong SIT boundary, start(%u) end(%u) blocks(%u)", - sit_blkaddr, nat_blkaddr, - segment_count_sit << log_blocks_per_seg); + sit_blkaddr, nat_blkaddr, segment_count_sit << log_blocks_per_seg); return true; } - if (nat_blkaddr + (segment_count_nat << log_blocks_per_seg) != - ssa_blkaddr) { + if (nat_blkaddr + (segment_count_nat << log_blocks_per_seg) != ssa_blkaddr) { f2fs_info(sbi, "Wrong NAT boundary, start(%u) end(%u) blocks(%u)", - nat_blkaddr, ssa_blkaddr, - segment_count_nat << log_blocks_per_seg); + nat_blkaddr, ssa_blkaddr, segment_count_nat << log_blocks_per_seg); return true; } - if (ssa_blkaddr + (segment_count_ssa << log_blocks_per_seg) != - main_blkaddr) { + if (ssa_blkaddr + (segment_count_ssa << log_blocks_per_seg) != main_blkaddr) { f2fs_info(sbi, "Wrong SSA boundary, start(%u) end(%u) blocks(%u)", - ssa_blkaddr, main_blkaddr, - segment_count_ssa << log_blocks_per_seg); + ssa_blkaddr, main_blkaddr, segment_count_ssa << log_blocks_per_seg); return true; } if (main_end_blkaddr > seg_end_blkaddr) { f2fs_info(sbi, "Wrong MAIN_AREA boundary, start(%u) end(%llu) block(%u)", - main_blkaddr, seg_end_blkaddr, - segment_count_main << log_blocks_per_seg); + main_blkaddr, seg_end_blkaddr, segment_count_main << log_blocks_per_seg); return true; } else if (main_end_blkaddr < seg_end_blkaddr) { int err = 0; @@ -3266,9 +3184,8 @@ static inline bool sanity_check_area_boundary(struct f2fs_sb_info *sbi, err = __f2fs_commit_super(bh, NULL); res = err ? "failed" : "done"; } - f2fs_info(sbi, "Fix alignment : %s, start(%u) end(%llu) block(%u)", - res, main_blkaddr, seg_end_blkaddr, - segment_count_main << log_blocks_per_seg); + f2fs_info(sbi, "Fix alignment : %s, start(%u) end(%llu) block(%u)", res, + main_blkaddr, seg_end_blkaddr, segment_count_main << log_blocks_per_seg); if (err) return true; } @@ -3294,10 +3211,8 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi, /* Check checksum_offset and crc in superblock */ if (__F2FS_HAS_FEATURE(raw_super, F2FS_FEATURE_SB_CHKSUM)) { crc_offset = le32_to_cpu(raw_super->checksum_offset); - if (crc_offset != - offsetof(struct f2fs_super_block, crc)) { - f2fs_info(sbi, "Invalid SB checksum offset: %zu", - crc_offset); + if (crc_offset != offsetof(struct f2fs_super_block, crc)) { + f2fs_info(sbi, "Invalid SB checksum offset: %zu", crc_offset); return -EFSCORRUPTED; } crc = le32_to_cpu(raw_super->crc); @@ -3310,8 +3225,7 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi, /* Currently, support only 4KB block size */ if (le32_to_cpu(raw_super->log_blocksize) != F2FS_BLKSIZE_BITS) { f2fs_info(sbi, "Invalid log_blocksize (%u), supports only %u", - le32_to_cpu(raw_super->log_blocksize), - F2FS_BLKSIZE_BITS); + le32_to_cpu(raw_super->log_blocksize), F2FS_BLKSIZE_BITS); return -EFSCORRUPTED; } @@ -3323,17 +3237,14 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi, } /* Currently, support 512/1024/2048/4096 bytes sector size */ - if (le32_to_cpu(raw_super->log_sectorsize) > - F2FS_MAX_LOG_SECTOR_SIZE || - le32_to_cpu(raw_super->log_sectorsize) < - F2FS_MIN_LOG_SECTOR_SIZE) { + if (le32_to_cpu(raw_super->log_sectorsize) > F2FS_MAX_LOG_SECTOR_SIZE || + le32_to_cpu(raw_super->log_sectorsize) < F2FS_MIN_LOG_SECTOR_SIZE) { f2fs_info(sbi, "Invalid log sectorsize (%u)", le32_to_cpu(raw_super->log_sectorsize)); return -EFSCORRUPTED; } if (le32_to_cpu(raw_super->log_sectors_per_block) + - le32_to_cpu(raw_super->log_sectorsize) != - F2FS_MAX_LOG_SECTOR_SIZE) { + le32_to_cpu(raw_super->log_sectorsize) != F2FS_MAX_LOG_SECTOR_SIZE) { f2fs_info(sbi, "Invalid log sectors per block(%u) log sectorsize(%u)", le32_to_cpu(raw_super->log_sectors_per_block), le32_to_cpu(raw_super->log_sectorsize)); @@ -3349,8 +3260,7 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi, /* blocks_per_seg should be 512, given the above check */ blocks_per_seg = 1 << le32_to_cpu(raw_super->log_blocks_per_seg); - if (segment_count > F2FS_MAX_SEGMENT || - segment_count < F2FS_MIN_SEGMENTS) { + if (segment_count > F2FS_MAX_SEGMENT || segment_count < F2FS_MIN_SEGMENTS) { f2fs_info(sbi, "Invalid segment count (%u)", segment_count); return -EFSCORRUPTED; } @@ -3411,29 +3321,24 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi, (le32_to_cpu(raw_super->extension_count) + raw_super->hot_ext_count) > F2FS_MAX_EXTENSION) { f2fs_info(sbi, "Corrupted extension count (%u + %u > %u)", - le32_to_cpu(raw_super->extension_count), - raw_super->hot_ext_count, + le32_to_cpu(raw_super->extension_count), raw_super->hot_ext_count, F2FS_MAX_EXTENSION); return -EFSCORRUPTED; } if (le32_to_cpu(raw_super->cp_payload) >= - (blocks_per_seg - F2FS_CP_PACKS - - NR_CURSEG_PERSIST_TYPE)) { + (blocks_per_seg - F2FS_CP_PACKS - NR_CURSEG_PERSIST_TYPE)) { f2fs_info(sbi, "Insane cp_payload (%u >= %u)", le32_to_cpu(raw_super->cp_payload), - blocks_per_seg - F2FS_CP_PACKS - - NR_CURSEG_PERSIST_TYPE); + blocks_per_seg - F2FS_CP_PACKS - NR_CURSEG_PERSIST_TYPE); return -EFSCORRUPTED; } /* check reserved ino info */ - if (le32_to_cpu(raw_super->node_ino) != 1 || - le32_to_cpu(raw_super->meta_ino) != 2 || + if (le32_to_cpu(raw_super->node_ino) != 1 || le32_to_cpu(raw_super->meta_ino) != 2 || le32_to_cpu(raw_super->root_ino) != 3) { f2fs_info(sbi, "Invalid Fs Meta Ino: node(%u) meta(%u) root(%u)", - le32_to_cpu(raw_super->node_ino), - le32_to_cpu(raw_super->meta_ino), + le32_to_cpu(raw_super->node_ino), le32_to_cpu(raw_super->meta_ino), le32_to_cpu(raw_super->root_ino)); return -EFSCORRUPTED; } @@ -3477,8 +3382,7 @@ int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi) ovp_segments = le32_to_cpu(ckpt->overprov_segment_count); reserved_segments = le32_to_cpu(ckpt->rsvd_segment_count); - if (!f2fs_sb_has_readonly(sbi) && - unlikely(fsmeta < F2FS_MIN_META_SEGMENTS || + if (!f2fs_sb_has_readonly(sbi) && unlikely(fsmeta < F2FS_MIN_META_SEGMENTS || ovp_segments == 0 || reserved_segments == 0)) { f2fs_err(sbi, "Wrong layout: check mkfs.f2fs version"); return 1; @@ -3487,10 +3391,8 @@ int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi) segment_count_main = le32_to_cpu(raw_super->segment_count_main) + (f2fs_sb_has_readonly(sbi) ? 1 : 0); log_blocks_per_seg = le32_to_cpu(raw_super->log_blocks_per_seg); - if (!user_block_count || user_block_count >= - segment_count_main << log_blocks_per_seg) { - f2fs_err(sbi, "Wrong user_block_count: %u", - user_block_count); + if (!user_block_count || user_block_count >= segment_count_main << log_blocks_per_seg) { + f2fs_err(sbi, "Wrong user_block_count: %u", user_block_count); return 1; } @@ -3523,8 +3425,7 @@ int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi) for (j = i + 1; j < NR_CURSEG_NODE_TYPE; j++) { if (le32_to_cpu(ckpt->cur_node_segno[i]) == le32_to_cpu(ckpt->cur_node_segno[j])) { - f2fs_err(sbi, "Node segment (%u, %u) has the same segno: %u", - i, j, + f2fs_err(sbi, "Node segment (%u, %u) has the same segno: %u", i, j, le32_to_cpu(ckpt->cur_node_segno[i])); return 1; } @@ -3542,8 +3443,7 @@ int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi) for (j = i + 1; j < NR_CURSEG_DATA_TYPE; j++) { if (le32_to_cpu(ckpt->cur_data_segno[i]) == le32_to_cpu(ckpt->cur_data_segno[j])) { - f2fs_err(sbi, "Data segment (%u, %u) has the same segno: %u", - i, j, + f2fs_err(sbi, "Data segment (%u, %u) has the same segno: %u", i, j, le32_to_cpu(ckpt->cur_data_segno[i])); return 1; } @@ -3554,8 +3454,7 @@ int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi) if (le32_to_cpu(ckpt->cur_node_segno[i]) == le32_to_cpu(ckpt->cur_data_segno[j])) { f2fs_err(sbi, "Node segment (%u) and Data segment (%u) has the same segno: %u", - i, j, - le32_to_cpu(ckpt->cur_node_segno[i])); + i, j, le32_to_cpu(ckpt->cur_node_segno[i])); return 1; } } @@ -3574,10 +3473,8 @@ int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi) cp_pack_start_sum = __start_sum_addr(sbi); cp_payload = __cp_payload(sbi); if (cp_pack_start_sum < cp_payload + 1 || - cp_pack_start_sum > blocks_per_seg - 1 - - NR_CURSEG_PERSIST_TYPE) { - f2fs_err(sbi, "Wrong cp_pack_start_sum: %u", - cp_pack_start_sum); + cp_pack_start_sum > blocks_per_seg - 1 - NR_CURSEG_PERSIST_TYPE) { + f2fs_err(sbi, "Wrong cp_pack_start_sum: %u", cp_pack_start_sum); return 1; } @@ -3613,8 +3510,7 @@ static void init_sb_info(struct f2fs_sb_info *sbi) struct f2fs_super_block *raw_super = sbi->raw_super; int i; - sbi->log_sectors_per_block = - le32_to_cpu(raw_super->log_sectors_per_block); + sbi->log_sectors_per_block = le32_to_cpu(raw_super->log_sectors_per_block); sbi->log_blocksize = le32_to_cpu(raw_super->log_blocksize); sbi->blocksize = 1 << sbi->log_blocksize; sbi->log_blocks_per_seg = le32_to_cpu(raw_super->log_blocks_per_seg); @@ -3622,8 +3518,7 @@ static void init_sb_info(struct f2fs_sb_info *sbi) sbi->segs_per_sec = le32_to_cpu(raw_super->segs_per_sec); sbi->secs_per_zone = le32_to_cpu(raw_super->secs_per_zone); sbi->total_sections = le32_to_cpu(raw_super->section_count); - sbi->total_node_count = - (le32_to_cpu(raw_super->segment_count_nat) / 2) + sbi->total_node_count = (le32_to_cpu(raw_super->segment_count_nat) / 2) * sbi->blocks_per_seg * NAT_ENTRY_PER_BLOCK; F2FS_ROOT_INO(sbi) = le32_to_cpu(raw_super->root_ino); F2FS_NODE_INO(sbi) = le32_to_cpu(raw_super->node_ino); @@ -3646,8 +3541,7 @@ static void init_sb_info(struct f2fs_sb_info *sbi) sbi->interval_time[DISCARD_TIME] = DEF_IDLE_INTERVAL; sbi->interval_time[GC_TIME] = DEF_IDLE_INTERVAL; sbi->interval_time[DISABLE_TIME] = DEF_DISABLE_INTERVAL; - sbi->interval_time[UMOUNT_DISCARD_TIMEOUT] = - DEF_UMOUNT_DISCARD_TIMEOUT; + sbi->interval_time[UMOUNT_DISCARD_TIMEOUT] = DEF_UMOUNT_DISCARD_TIMEOUT; clear_sbi_flag(sbi, SBI_NEED_FSCK); for (i = 0; i < NR_COUNT_TYPE; i++) @@ -3680,8 +3574,7 @@ static int init_percpu_info(struct f2fs_sb_info *sbi) if (err) goto err_valid_block; - err = percpu_counter_init(&sbi->total_valid_inode_count, 0, - GFP_KERNEL); + err = percpu_counter_init(&sbi->total_valid_inode_count, 0, GFP_KERNEL); if (err) goto err_node_block; return 0; @@ -3704,8 +3597,7 @@ static int f2fs_report_zone_cb(struct blk_zone *zone, unsigned int idx, void *data) { struct f2fs_report_zones_args *rz_args = data; - block_t unusable_blocks = (zone->len - zone->capacity) >> - F2FS_LOG_SECTORS_PER_BLOCK; + block_t unusable_blocks = (zone->len - zone->capacity) >> F2FS_LOG_SECTORS_PER_BLOCK; if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL) return 0; @@ -3739,31 +3631,26 @@ static int init_blkz_info(struct f2fs_sb_info *sbi, int devi) return -EINVAL; } - if (sbi->blocks_per_blkz && sbi->blocks_per_blkz != - SECTOR_TO_BLOCK(zone_sectors)) + if (sbi->blocks_per_blkz && sbi->blocks_per_blkz != SECTOR_TO_BLOCK(zone_sectors)) return -EINVAL; sbi->blocks_per_blkz = SECTOR_TO_BLOCK(zone_sectors); if (sbi->log_blocks_per_blkz && sbi->log_blocks_per_blkz != __ilog2_u32(sbi->blocks_per_blkz)) return -EINVAL; sbi->log_blocks_per_blkz = __ilog2_u32(sbi->blocks_per_blkz); - FDEV(devi).nr_blkz = SECTOR_TO_BLOCK(nr_sectors) >> - sbi->log_blocks_per_blkz; + FDEV(devi).nr_blkz = SECTOR_TO_BLOCK(nr_sectors) >> sbi->log_blocks_per_blkz; if (nr_sectors & (zone_sectors - 1)) FDEV(devi).nr_blkz++; - FDEV(devi).blkz_seq = f2fs_kvzalloc(sbi, - BITS_TO_LONGS(FDEV(devi).nr_blkz) - * sizeof(unsigned long), - GFP_KERNEL); + FDEV(devi).blkz_seq = f2fs_kvzalloc(sbi, BITS_TO_LONGS(FDEV(devi).nr_blkz) * + sizeof(unsigned long), GFP_KERNEL); if (!FDEV(devi).blkz_seq) return -ENOMEM; rep_zone_arg.sbi = sbi; rep_zone_arg.dev = &FDEV(devi); - ret = blkdev_report_zones(bdev, 0, BLK_ALL_ZONES, f2fs_report_zone_cb, - &rep_zone_arg); + ret = blkdev_report_zones(bdev, 0, BLK_ALL_ZONES, f2fs_report_zone_cb, &rep_zone_arg); if (ret < 0) return ret; return 0; @@ -3793,8 +3680,7 @@ static int read_raw_super_block(struct f2fs_sb_info *sbi, for (block = 0; block < 2; block++) { bh = sb_bread(sb, block); if (!bh) { - f2fs_err(sbi, "Unable to read %dth superblock", - block + 1); + f2fs_err(sbi, "Unable to read %dth superblock", block + 1); err = -EIO; *recovery = 1; continue; @@ -3811,8 +3697,7 @@ static int read_raw_super_block(struct f2fs_sb_info *sbi, } if (!*raw_super) { - memcpy(super, bh->b_data + F2FS_SUPER_OFFSET, - sizeof(*super)); + memcpy(super, bh->b_data + F2FS_SUPER_OFFSET, sizeof(*super)); *valid_super_block = block; *raw_super = super; } @@ -3834,16 +3719,14 @@ int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover) __u32 crc = 0; int err; - if ((recover && f2fs_readonly(sbi->sb)) || - bdev_read_only(sbi->sb->s_bdev)) { + if ((recover && f2fs_readonly(sbi->sb)) || bdev_read_only(sbi->sb->s_bdev)) { set_sbi_flag(sbi, SBI_NEED_SB_WRITE); return -EROFS; } /* we should update superblock crc here */ if (!recover && f2fs_sb_has_sb_chksum(sbi)) { - crc = f2fs_crc32(sbi, F2FS_RAW_SUPER(sbi), - offsetof(struct f2fs_super_block, crc)); + crc = f2fs_crc32(sbi, F2FS_RAW_SUPER(sbi), offsetof(struct f2fs_super_block, crc)); F2FS_RAW_SUPER(sbi)->crc = cpu_to_le32(crc); } @@ -3879,8 +3762,7 @@ void f2fs_handle_stop(struct f2fs_sb_info *sbi, unsigned char reason) err = f2fs_commit_super(sbi, false); if (err) - f2fs_err(sbi, "f2fs_commit_super fails to record reason:%u err:%d", - reason, err); + f2fs_err(sbi, "f2fs_commit_super fails to record reason:%u err:%d", reason, err); f2fs_up_write(&sbi->sb_lock); } @@ -3900,8 +3782,7 @@ static bool f2fs_update_errors(struct f2fs_sb_info *sbi) spin_lock(&sbi->error_lock); if (sbi->error_dirty) { - memcpy(F2FS_RAW_SUPER(sbi)->s_errors, sbi->errors, - MAX_F2FS_ERRORS); + memcpy(F2FS_RAW_SUPER(sbi)->s_errors, sbi->errors, MAX_F2FS_ERRORS); sbi->error_dirty = false; need_update = true; } @@ -3923,8 +3804,7 @@ void f2fs_handle_error(struct f2fs_sb_info *sbi, unsigned char error) err = f2fs_commit_super(sbi, false); if (err) - f2fs_err(sbi, "f2fs_commit_super fails to record errors:%u, err:%d", - error, err); + f2fs_err(sbi, "f2fs_commit_super fails to record errors:%u, err:%d", error, err); out_unlock: f2fs_up_write(&sbi->sb_lock); } @@ -3947,10 +3827,8 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi) * Initialize multiple devices information, or single * zoned block device information. */ - sbi->devs = f2fs_kzalloc(sbi, - array_size(max_devices, - sizeof(struct f2fs_dev_info)), - GFP_KERNEL); + sbi->devs = f2fs_kzalloc(sbi, array_size(max_devices, + sizeof(struct f2fs_dev_info)), GFP_KERNEL); if (!sbi->devs) return -ENOMEM; @@ -3964,25 +3842,21 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi) if (max_devices == 1) { /* Single zoned block device mount */ - FDEV(0).bdev = - blkdev_get_by_dev(sbi->sb->s_bdev->bd_dev, + FDEV(0).bdev = blkdev_get_by_dev(sbi->sb->s_bdev->bd_dev, sbi->sb->s_mode, sbi->sb->s_type); } else { /* Multi-device mount */ memcpy(FDEV(i).path, RDEV(i).path, MAX_PATH_LEN); - FDEV(i).total_segments = - le32_to_cpu(RDEV(i).total_segments); + FDEV(i).total_segments = le32_to_cpu(RDEV(i).total_segments); if (i == 0) { FDEV(i).start_blk = 0; FDEV(i).end_blk = FDEV(i).start_blk + - (FDEV(i).total_segments << - sbi->log_blocks_per_seg) - 1 + + (FDEV(i).total_segments << sbi->log_blocks_per_seg) - 1 + le32_to_cpu(raw_super->segment0_blkaddr); } else { FDEV(i).start_blk = FDEV(i - 1).end_blk + 1; FDEV(i).end_blk = FDEV(i).start_blk + - (FDEV(i).total_segments << - sbi->log_blocks_per_seg) - 1; + (FDEV(i).total_segments << sbi->log_blocks_per_seg) - 1; } FDEV(i).bdev = blkdev_get_by_path(FDEV(i).path, sbi->sb->s_mode, sbi->sb->s_type); @@ -3997,8 +3871,7 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi) sbi->aligned_blksize = false; #ifdef CONFIG_BLK_DEV_ZONED - if (bdev_zoned_model(FDEV(i).bdev) == BLK_ZONED_HM && - !f2fs_sb_has_blkzoned(sbi)) { + if (bdev_zoned_model(FDEV(i).bdev) == BLK_ZONED_HM && !f2fs_sb_has_blkzoned(sbi)) { f2fs_err(sbi, "Zoned block device feature not enabled"); return -EINVAL; } @@ -4009,22 +3882,17 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi) } if (max_devices == 1) break; - f2fs_info(sbi, "Mount Device [%2d]: %20s, %8u, %8x - %8x (zone: %s)", - i, FDEV(i).path, - FDEV(i).total_segments, - FDEV(i).start_blk, FDEV(i).end_blk, - bdev_zoned_model(FDEV(i).bdev) == BLK_ZONED_HA ? - "Host-aware" : "Host-managed"); + f2fs_info(sbi, "Mount Device [%2d]: %20s, %8u, %8x - %8x (zone: %s)", i, + FDEV(i).path, FDEV(i).total_segments, FDEV(i).start_blk, + FDEV(i).end_blk, bdev_zoned_model(FDEV(i).bdev) == BLK_ZONED_HA ? + "Host-aware" : "Host-managed"); continue; } #endif - f2fs_info(sbi, "Mount Device [%2d]: %20s, %8u, %8x - %8x", - i, FDEV(i).path, - FDEV(i).total_segments, - FDEV(i).start_blk, FDEV(i).end_blk); + f2fs_info(sbi, "Mount Device [%2d]: %20s, %8u, %8x - %8x", i, + FDEV(i).path, FDEV(i).total_segments, FDEV(i).start_blk, FDEV(i).end_blk); } - f2fs_info(sbi, - "IO Block Size: %8d KB", F2FS_IO_SIZE_KB(sbi)); + f2fs_info(sbi, "IO Block Size: %8d KB", F2FS_IO_SIZE_KB(sbi)); return 0; } @@ -4038,30 +3906,25 @@ static int f2fs_setup_casefold(struct f2fs_sb_info *sbi) encoding_info = f2fs_sb_read_encoding(sbi->raw_super); if (!encoding_info) { - f2fs_err(sbi, - "Encoding requested by superblock is unknown"); + f2fs_err(sbi, "Encoding requested by superblock is unknown"); return -EINVAL; } encoding_flags = le16_to_cpu(sbi->raw_super->s_encoding_flags); encoding = utf8_load(encoding_info->version); if (IS_ERR(encoding)) { - f2fs_err(sbi, - "can't mount with superblock charset: %s-%u.%u.%u " + f2fs_err(sbi, "can't mount with superblock charset: %s-%u.%u.%u " "not supported by the kernel. flags: 0x%x.", - encoding_info->name, - unicode_major(encoding_info->version), + encoding_info->name, unicode_major(encoding_info->version), unicode_minor(encoding_info->version), - unicode_rev(encoding_info->version), - encoding_flags); + unicode_rev(encoding_info->version), encoding_flags); return PTR_ERR(encoding); } f2fs_info(sbi, "Using encoding defined by superblock: " "%s-%u.%u.%u with flags 0x%hx", encoding_info->name, unicode_major(encoding_info->version), unicode_minor(encoding_info->version), - unicode_rev(encoding_info->version), - encoding_flags); + unicode_rev(encoding_info->version), encoding_flags); sbi->sb->s_encoding = encoding; sbi->sb->s_encoding_flags = encoding_flags; @@ -4080,10 +3943,8 @@ static void f2fs_tuning_parameters(struct f2fs_sb_info *sbi) /* adjust parameters according to the volume size */ if (MAIN_SEGS(sbi) <= SMALL_VOLUME_SEGMENTS) { if (f2fs_block_unit_discard(sbi)) - SM_I(sbi)->dcc_info->discard_granularity = - MIN_DISCARD_GRANULARITY; - SM_I(sbi)->ipu_policy = BIT(F2FS_IPU_FORCE) | - BIT(F2FS_IPU_HONOR_OPU_WRITE); + SM_I(sbi)->dcc_info->discard_granularity = MIN_DISCARD_GRANULARITY; + SM_I(sbi)->ipu_policy = BIT(F2FS_IPU_FORCE) | BIT(F2FS_IPU_HONOR_OPU_WRITE); } sbi->readdir_ra = true; @@ -4147,8 +4008,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) goto free_sbi; } - err = read_raw_super_block(sbi, &raw_super, &valid_super_block, - &recovery); + err = read_raw_super_block(sbi, &raw_super, &valid_super_block, &recovery); if (err) goto free_sbi; @@ -4159,8 +4019,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) /* precompute checksum seed for metadata */ if (f2fs_sb_has_inode_chksum(sbi)) - sbi->s_chksum_seed = f2fs_chksum(sbi, ~0, raw_super->uuid, - sizeof(raw_super->uuid)); + sbi->s_chksum_seed = f2fs_chksum(sbi, ~0, raw_super->uuid, sizeof(raw_super->uuid)); default_options(sbi); /* parse mount options */ @@ -4174,8 +4033,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) if (err) goto free_options; - sb->s_maxbytes = max_file_blocks(NULL) << - le32_to_cpu(raw_super->log_blocksize); + sb->s_maxbytes = max_file_blocks(NULL) << le32_to_cpu(raw_super->log_blocksize); sb->s_max_links = F2FS_LINK_MAX; err = f2fs_setup_casefold(sbi); @@ -4206,8 +4064,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) sb->s_export_op = &f2fs_export_ops; sb->s_magic = F2FS_SUPER_MAGIC; sb->s_time_gran = 1; - sb->s_flags = (sb->s_flags & ~SB_POSIXACL) | - (test_opt(sbi, POSIX_ACL) ? SB_POSIXACL : 0); + sb->s_flags = (sb->s_flags & ~SB_POSIXACL) | (test_opt(sbi, POSIX_ACL) ? SB_POSIXACL : 0); memcpy(&sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid)); sb->s_iflags |= SB_I_CGROUPWB; @@ -4232,8 +4089,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) goto free_iostat; if (F2FS_IO_ALIGNED(sbi)) { - sbi->write_io_dummy = - mempool_create_page_pool(2 * (F2FS_IO_SIZE(sbi) - 1), 0); + sbi->write_io_dummy = mempool_create_page_pool(2 * (F2FS_IO_SIZE(sbi) - 1), 0); if (!sbi->write_io_dummy) { err = -ENOMEM; goto free_percpu; @@ -4285,13 +4141,11 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) goto free_devices; } - sbi->total_valid_node_count = - le32_to_cpu(sbi->ckpt->valid_node_count); + sbi->total_valid_node_count = le32_to_cpu(sbi->ckpt->valid_node_count); percpu_counter_set(&sbi->total_valid_inode_count, le32_to_cpu(sbi->ckpt->valid_inode_count)); sbi->user_block_count = le64_to_cpu(sbi->ckpt->user_block_count); - sbi->total_valid_block_count = - le64_to_cpu(sbi->ckpt->valid_block_count); + sbi->total_valid_block_count = le64_to_cpu(sbi->ckpt->valid_block_count); sbi->last_valid_block_count = sbi->total_valid_block_count; sbi->reserved_blocks = 0; sbi->current_reserved_blocks = 0; @@ -4310,9 +4164,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) test_opt(sbi, MERGE_CHECKPOINT)) { err = f2fs_start_ckpt_thread(sbi); if (err) { - f2fs_err(sbi, - "Failed to start F2FS issue_checkpoint_thread (%d)", - err); + f2fs_err(sbi, "Failed to start F2FS issue_checkpoint_thread (%d)", err); goto stop_ckpt_thread; } } @@ -4320,14 +4172,12 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) /* setup f2fs internal modules */ err = f2fs_build_segment_manager(sbi); if (err) { - f2fs_err(sbi, "Failed to initialize F2FS segment manager (%d)", - err); + f2fs_err(sbi, "Failed to initialize F2FS segment manager (%d)", err); goto free_sm; } err = f2fs_build_node_manager(sbi); if (err) { - f2fs_err(sbi, "Failed to initialize F2FS node manager (%d)", - err); + f2fs_err(sbi, "Failed to initialize F2FS node manager (%d)", err); goto free_nm; } @@ -4341,8 +4191,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) /* Read accumulated write IO statistics if exists */ seg_i = CURSEG_I(sbi, CURSEG_HOT_NODE); if (__exist_node_summaries(sbi)) - sbi->kbytes_written = - le64_to_cpu(seg_i->journal->info.kbytes_written); + sbi->kbytes_written = le64_to_cpu(seg_i->journal->info.kbytes_written); f2fs_build_gc_manager(sbi); @@ -4365,8 +4214,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) err = PTR_ERR(root); goto free_node_inode; } - if (!S_ISDIR(root->i_mode) || !root->i_blocks || - !root->i_size || !root->i_nlink) { + if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size || !root->i_nlink) { iput(root); err = -EINVAL; goto free_node_inode; @@ -4403,8 +4251,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) goto reset_checkpoint; /* recover fsynced data */ - if (!test_opt(sbi, DISABLE_ROLL_FORWARD) && - !test_opt(sbi, NORECOVERY)) { + if (!test_opt(sbi, DISABLE_ROLL_FORWARD) && !test_opt(sbi, NORECOVERY)) { /* * mount should be failed, when device has readonly mode, and * previous checkpoint was not done by clean system shutdown. @@ -4436,8 +4283,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) if (err != -ENOMEM) skip_recovery = true; need_fsck = true; - f2fs_err(sbi, "Cannot recover all fsync data errno=%d", - err); + f2fs_err(sbi, "Cannot recover all fsync data errno=%d", err); goto free_meta; } } else { @@ -4498,8 +4344,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) f2fs_tuning_parameters(sbi); - f2fs_notice(sbi, "Mounted with checkpoint version = %llx", - cur_cp_version(F2FS_CKPT(sbi))); + f2fs_notice(sbi, "Mounted with checkpoint version = %llx", cur_cp_version(F2FS_CKPT(sbi))); f2fs_update_time(sbi, CP_TIME); f2fs_update_time(sbi, REQ_TIME); clear_sbi_flag(sbi, SBI_CP_DISABLED_QUICK); @@ -4619,8 +4464,7 @@ static void kill_f2fs_super(struct super_block *sb) truncate_inode_pages_final(COMPRESS_MAPPING(sbi)); #endif - if (is_sbi_flag_set(sbi, SBI_IS_DIRTY) || - !is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG)) { + if (is_sbi_flag_set(sbi, SBI_IS_DIRTY) || !is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG)) { struct cp_control cpc = { .reason = CP_UMOUNT, }; @@ -4644,9 +4488,8 @@ MODULE_ALIAS_FS("f2fs"); static int __init init_inodecache(void) { - f2fs_inode_cachep = kmem_cache_create("f2fs_inode_cache", - sizeof(struct f2fs_inode_info), 0, - SLAB_RECLAIM_ACCOUNT|SLAB_ACCOUNT, NULL); + f2fs_inode_cachep = kmem_cache_create("f2fs_inode_cache", sizeof(struct f2fs_inode_info), 0, + SLAB_RECLAIM_ACCOUNT | SLAB_ACCOUNT, NULL); return f2fs_inode_cachep ? 0 : -ENOMEM; } @@ -4665,8 +4508,7 @@ static int __init init_f2fs_fs(void) int err; if (PAGE_SIZE != F2FS_BLKSIZE) { - printk("F2FS not supported on PAGE_SIZE(%lu) != %d\n", - PAGE_SIZE, F2FS_BLKSIZE); + pr_err("not supported on PAGE_SIZE(%lu) != %d\n", PAGE_SIZE, F2FS_BLKSIZE); return -EINVAL; } @@ -4789,4 +4631,3 @@ MODULE_AUTHOR("Samsung Electronics's Praesto Team"); MODULE_DESCRIPTION("Flash Friendly File System"); MODULE_LICENSE("GPL"); MODULE_SOFTDEP("pre: crc32"); - From patchwork Sat Jan 21 05:12:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 46776 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp583565wrn; Fri, 20 Jan 2023 21:35:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXvrKJ/EiIQt2GQ5QAEq5QREERPZnM2gilZWgHtvZ195mpzhJe6+LNatHx6BrEEmc1oMHzBA X-Received: by 2002:a17:907:c29c:b0:84d:2171:d79 with SMTP id tk28-20020a170907c29c00b0084d21710d79mr18001650ejc.54.1674279327028; Fri, 20 Jan 2023 21:35:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674279327; cv=pass; d=google.com; s=arc-20160816; b=K76J4U/hsS1ahCmmKBPME3jUt0M8rTTw/pa4e2xhxuZS94hNzWIp6tpNTu4yOVB71W Hk7hz+kLs1hSpq/uf5Xs65CzKYRyQ2qqHuBbDEqDqBzZ2nIYKx2vS7VQRLHrw+xeKfb8 H8rbQpDSZxlFQLTY5hiW3vxWXjaIiYsC7Q2pW2K2cq/z1tbn5GdCHNGpSELu0JWd13kD +QYm6xr5WDmTtJ/ZKBCbHONIH6elwyVvM1mwsqSh3UJwu1kRiFcmrxxEYPd28CQqv9xh TwLxgVK8DhspKc02yGDYvbCqr6bU1LQJ5w9brIAWUNDS0237jqE60bbjn2WZcIFVaO2u 69tQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KbOLfp+C61OwahvHurX+eHEtuLLG7WtQ2vGbdLyITn0=; b=BCv9bkWwXrM3tLMNMM5/2/AyRqTbE5hsnnJypNNSqz2+1fwmBS5n4xpp1/lvTQJRTY L/MFuqvU0PQZSi6Q7CIW+pPrLwzFPk4dLC+18fsWDgBH9lvNHFGwr4eCiGJWBucMJeEc o6Clns1O+lqInYCuojBXXNO6AgsU2SWetQZrPiN13h3IK5nRR2efNNDenU15oCsjb2uz 4QszwzeUWctslj1+FdECEp9qFMlf6P9Dk7dAgv1oNQhv8KdFAET9IansT0K9KmWNsX4e o5SUJo8Ep7Iio7stq7brlnxewwgHNd4jwF7NSiDgu8nos+MmQ6oIuZkhE+qsxiXngguw xfcw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b="FXgC26/V"; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn26-20020a1709070d1a00b0086e09d5ce51si25858667ejc.871.2023.01.20.21.35.03; Fri, 20 Jan 2023 21:35:27 -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=@vivo.com header.s=selector2 header.b="FXgC26/V"; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229643AbjAUFM2 (ORCPT + 99 others); Sat, 21 Jan 2023 00:12:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjAUFMZ (ORCPT ); Sat, 21 Jan 2023 00:12:25 -0500 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2134.outbound.protection.outlook.com [40.107.117.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06E5A73145 for ; Fri, 20 Jan 2023 21:12:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f0Tw9QmIkcQIVBOf/zOfo1d13SVoWegd9DHQSqrTknBh47QitSlEzEByvIC7/JRdFqFFaoHMKmT62j2hLzLzV14sPeuNHgQsZSMiYKOR4M9KGg0RoBde5qZPjCwIUXmrVb9UlBnMpfnwLFjrUsFRoAFl2pz38X8IZRtgMY8nE5lFqvwtDSPr3fz8UvLvtGfNs0F1CnyIvHjfWvKcIBht0JxLYzJvjWWkWK4Rf/Sf9BKzRIW/n66U9EvhFVpTBk0Vv+5jY+hrCZePAtj4P6XTB2ZpR4kxYWn3RZS+xdFg3EpDLzbCMifcCdrnLf8V6a/irB0C655ZGomIkbHyRHgzBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KbOLfp+C61OwahvHurX+eHEtuLLG7WtQ2vGbdLyITn0=; b=ZEXxmvQdzK/Xirh42gDS0eMLFKGlOXxM96JPONE8LQm/ILAXk1/4hW05ZlIMwnLYCDuLi/VjanDwfDOZom4MJBSxpiyRn7MCj7VqHsCmzXPdV7TAUOqnD1wNI3WY6E2mg9dYo6ZlzXohiD9y/10cSgXbF8356XxNrYCrZOz9N0BCDLrqZQP6YStXzJzpOlhIUptTtqjS8kXMt/+2rpHBR0ddFkdSjGzGczNEp7/I3AM1aPtGxcCC9gH4DwLWbXQTTdXMs0SnhS861Ey6AN5tVg695jeMVI4DZ0Ak+u1WxvcFC/gyyQMC7GPtEbhXRVI3S6GqHfGvVdaeePwSollglA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KbOLfp+C61OwahvHurX+eHEtuLLG7WtQ2vGbdLyITn0=; b=FXgC26/V8tZShp3IXmaXv8CsjA48kNb2FRj+g8RJALa83Ynrs5bAmRtSJXbv27rIu7GJ8rcEkqSeHiYxNg9ALrNXsmu34fBXCQECy1xq3dbQvkVv9nlmhA2Zs1qIPSBL02l7x4UnYOoo6WJUWgIg2xpUceJ1C2SwjOlxJs0RBM07JMdggvTfM/66j6iEtlfjMGx/Eyfdq40JVumAgEqW8yafsTfdxt61k1QSk5j2DWyATgwCBNeSoZfAeatTJJzKxUIck6Af8cmhvY2NeGo6rcx2fV6OyfZkvIgFMqi1Y+6D0vUi0bvSANQhOdaDU1pxfor7yG+uHsuBLiDncb52oQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by TYZPR06MB3885.apcprd06.prod.outlook.com (2603:1096:400:6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.9; Sat, 21 Jan 2023 05:12:20 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::3e52:d08c:ecf4:d572]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::3e52:d08c:ecf4:d572%5]) with mapi id 15.20.6002.012; Sat, 21 Jan 2023 05:12:20 +0000 From: Yangtao Li To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH v2 2/5] f2fs: fix to set ipu policy Date: Sat, 21 Jan 2023 13:12:01 +0800 Message-Id: <20230121051204.81251-2-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230121051204.81251-1-frank.li@vivo.com> References: <20230121051204.81251-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0008.apcprd01.prod.exchangelabs.com (2603:1096:4:191::10) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYZPR06MB3885:EE_ X-MS-Office365-Filtering-Correlation-Id: 155d1182-325f-4214-7c95-08dafb6e12c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: X6z5n/mXLGz/xdmqk2ndjrfNJmG0ZReENk0YfttpA55KtR/43yZlf4C87qJmkPt7VQ2z41p56ILJECT6VI0pJH20hfr+HWsZ6osZvrb7a7fXGbJs4k6uZxKZ8lxqWmv1f9c0/SOBmSusGyrJa/usS/HaLovwzwW3PIfEVXLRCSsdtx1IR008q7xVnqSXoZa6WUxb6hTwwx8yV4TjqXsZ2U+KHnYR3NIsj8oEaO37w6GUGsf6dAfxItEGOBk1+ULcO3wjANe1TyerUBOd1cjhl44PrYCzwO8+Muhv+S1iwTVn2oIE3xZkqYPWGuSrgaWhG3n+TOGA5WbFTOrFk0uROEyi4HkvVVlCEWZNas6r0jucUnSs1RnWSAVWeKZA6nraBGlRR6nncDP3SPsGQSkrnh+UkfuVAjUoXWc4GIc5SSnxlMeK1Jqu0W7UGGdFhpy/6WCylvZIstoS0Ah041f3aTtY2cOYazMME3CIZ8L9KnuvBfsYDyV6zmLKBqs7L3PZ5a/lrhUdyrBwCDglNIiwrhW2xEf2Hth41zBkuN+fsiudIm0e+6oDG/JLlMrflxOAcC6cJM23BS0AwofxA1761PWUGSNfaezbwMYdn7fL4aKO6p5Qn/30ILB6rddXxYcGeRTzlhvUmyGvJh3ggkiPKwZFcpZ9PiMB6ccb1qncEmkKLlYiMte7tSe8QOitHkFiVaP3ljtio487Nemxkvzwbg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(39850400004)(136003)(346002)(376002)(366004)(451199015)(38350700002)(38100700002)(86362001)(6666004)(5660300002)(8936002)(2906002)(66556008)(66476007)(8676002)(4326008)(66946007)(41300700001)(1076003)(2616005)(6506007)(6512007)(186003)(26005)(83380400001)(316002)(107886003)(52116002)(478600001)(6486002)(36756003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VowNYdePBquFFFJ9Pcb7v+Buq6D9ZVbBeFU2F9SkDzfflR3nfUNxs6uTOBhQWeobkH4ZdMzF2V09GN+6Yphsu6quCvYrv2OUJam+PD53zWmV6dPjmeoYJmGlC74qHoekhqV5bIAY6WVnb3QGBcnybKZJRPxidZxv5IKMCGDZwaFcpMScU3+QYOS4C4J2egEr2leUS2Rd20aEM/0OXAdCveKsUqdqLQVdFtVFPPnjDMHDgdP/TxxdMZ3bR7/aXZyeBfn/pwPqZ6eB5FsThtMEqS/y0QPX+bT4Z9CmEljX23u3EsmXZ2c5MklLohV7DcEouMdZPnpBTSCzvO19ojKcVhmcdju4q+0on+HtVdSAA9q6RmDgRRebd+ww9aEaXJV3k7PRoSZjLDYu0Xaubd9eDkg8f82nIbHslFR8OLPWRtqKVzPJgBrwE/n17tX250DCHXX+QNdZbLD+/JziM7eQfDe7HLMwQnb1MF4At/ifiHsyMP+9OPR4s/IEhiiOpK8Z7VREVLXHEFS3fjF5VRaQuUtqC+VopbXOsvw611f59qYjUALVhB/ckRc3E4m0WQ+Ff8GVKGs4tYIKT9/TMrOlACZZ3sEboVrE/jyja/XlGqiqrlkfdvOUErpNIo1xi3wcASiVkGTsnDPUmjU3q2k6qTunuCUsaTaEX+fylMVa0zsBXrHpK+IdSmWanSwD4KEGjfoOAMXY0NUF5zzKKbm15+a9jgwPyFhy7+imqw/hBJRQnffgJ2hA9oCA8g/CQaayPwSJGVd0TcHOJLQITtaassgD52bAPkzolB/w2p4bUtcWIQVR60Ta2wLCtnQqJWgXswo4vqX0H3VfJGqKG+RD1gpQMnQ90qKhtuvrQsJ7qbwHj0UPlWYcyPLejplolVZv/TAKwhdF7FoIHkrh0EXoVUytlhBZLY8YhDrHWS1QhWMyzCOZjeDhM3xHqv/vUXTiDhMKfipagX4P8Ki/YObFgd4Ldi7Yw8j4Q/eMP2Pz2nT6sm46B/o2VTm4kV4Q+l7Td0t8cEf9ddvwxHQNwsnR/w1KEc2Iqy6xrUPurrHfX72QCme92Bdsd5/RueaWVtIjtwYweLpfxwLnqDjpy2rNIVvAlxL4WD9u5DR+ftmavRTotFRxlZj3NPpJbRXPWEfl1zCs8pOHWG2WpWCiYXbfoVVn+HOHLqJFSmXt9in/gr8Ke6Ya863cBRvdJJJlcTlFsthwVnCGuf4Bz/Uot/YQan4AbNgl7ajEARq8NUd6IGxL+PCYjsWUmH9StHFyyhQOhqXV1wTZpZmjVNYEbZlOK6Zq/xBYzdZuGklpOy3VTIINsl2HK5FjUgP737LI9YWkuXD9CDFty4nX1R/LpZUvhaDkgiO/Ogq8GrRSkZNprArxgf4pf0NAW64CkGolXpsXXXI9R19wJnNXF9HFmqx8yTsxwKNZpNBfbcB7nc6R60oVyRNuSD9XSgnGmTgTwO9uykcTLsF1W38sXEOsSAazQ4kL7xhVmmx7wP42etJkxaqPByPWbUBp9xB6djTY4g80wST1Pea9mwwcKRYCCQ8VillY35iW8/hyLrhC6pdO3Uyl3cnkFdrr5nWU8d8VySlV X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 155d1182-325f-4214-7c95-08dafb6e12c5 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2023 05:12:20.8127 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zjGOgd53t3Td65pvlkGmWKrAPXnd28E2zODZtI0DpHMbIfjAUf5OV/E8A5DtwI7y2aJH3oqM2U01cJ142pQvPg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB3885 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED 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?1755609119698428115?= X-GMAIL-MSGID: =?utf-8?q?1755609119698428115?= For LFS mode, it should update outplace and no need inplace update. When using LFS mode for small-volume devices, IPU will not be used, and the OPU writing method is actually used, but F2FS_IPU_FORCE can be read from the ipu_policy node, which is different from the actual situation. And after remount, ipu should be disabled when convert to lfs mode, let's fix it. Fixes: 84b89e5d943d ("f2fs: add auto tuning for small devices") Signed-off-by: Yangtao Li --- v2: -restore old_ipu_policy for fail case in remount fs/f2fs/segment.h | 2 ++ fs/f2fs/super.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index ad6a9c19f46a..704d27ad682d 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -670,6 +670,8 @@ static inline int utilization(struct f2fs_sb_info *sbi) #define SMALL_VOLUME_SEGMENTS (16 * 512) /* 16GB */ +#define F2FS_IPU_DISABLE 0 + enum { F2FS_IPU_FORCE, F2FS_IPU_SSR, diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 0cedb693db58..1d2796863f8c 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2156,6 +2156,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) struct f2fs_sb_info *sbi = F2FS_SB(sb); struct f2fs_mount_info org_mount_opt; unsigned long old_sb_flags; + unsigned int old_ipu_policy; int err; bool need_restart_gc = false, need_stop_gc = false; bool need_restart_ckpt = false, need_stop_ckpt = false; @@ -2179,6 +2180,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) */ org_mount_opt = sbi->mount_opt; old_sb_flags = sb->s_flags; + old_ipu_policy = SM_I(sbi)->ipu_policy; #ifdef CONFIG_QUOTA org_mount_opt.s_jquota_fmt = F2FS_OPTION(sbi).s_jquota_fmt; @@ -2212,6 +2214,9 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) if (err) goto restore_opts; + if (F2FS_OPTION(sbi).fs_mode == FS_MODE_LFS) + SM_I(sbi)->ipu_policy = F2FS_IPU_DISABLE; + /* * Previous and new state of filesystem is RO, * so skip checking GC and FLUSH_MERGE conditions. @@ -2417,6 +2422,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) F2FS_OPTION(sbi).s_qf_names[i] = org_mount_opt.s_qf_names[i]; } #endif + SM_I(sbi)->ipu_policy = old_ipu_policy; sbi->mount_opt = org_mount_opt; sb->s_flags = old_sb_flags; return err; @@ -3944,7 +3950,8 @@ static void f2fs_tuning_parameters(struct f2fs_sb_info *sbi) if (MAIN_SEGS(sbi) <= SMALL_VOLUME_SEGMENTS) { if (f2fs_block_unit_discard(sbi)) SM_I(sbi)->dcc_info->discard_granularity = MIN_DISCARD_GRANULARITY; - SM_I(sbi)->ipu_policy = BIT(F2FS_IPU_FORCE) | BIT(F2FS_IPU_HONOR_OPU_WRITE); + if (F2FS_OPTION(sbi).fs_mode != FS_MODE_LFS) + SM_I(sbi)->ipu_policy = BIT(F2FS_IPU_FORCE) | BIT(F2FS_IPU_HONOR_OPU_WRITE); } sbi->readdir_ra = true; From patchwork Sat Jan 21 05:12:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 46779 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp587363wrn; Fri, 20 Jan 2023 21:50:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXt0Rkf6CfYYF39rDuSDQZfhkKgyc7qfK0ylKDoMY90x95F0FTC6wik8dlpAgj1sG27+SFxs X-Received: by 2002:a17:902:bd8d:b0:192:8cd1:5e79 with SMTP id q13-20020a170902bd8d00b001928cd15e79mr41443252pls.41.1674280250759; Fri, 20 Jan 2023 21:50:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674280250; cv=pass; d=google.com; s=arc-20160816; b=v15nB2zmDYl0oRx+83kHxtUvrV8IEAIyoh7Awom33iLfpyfOCfEz+Fk9czsQsQ2Af3 coBkiJP5EyausKwMJg6ugRcze34FOX4e1Uoxu8aAkbymyt5hyw8PUBTzcb7SA+9JEXg8 nCH9U7kmmjr0zaiq23QBQ9MpygJIluZj1ik+FYQnIS9tHTjiqz6yrsoe0iTvTdpCfKAM jLl/40jf0eAVG7Px54aKOEg11N6PS57qXzoPFoq2Grjk1M5g9ZFiWbtrAW4kcAhve3vI 7PJTw6dBgARu63PHfkny2JzUPDJ8PGDOv+MG6hf+YuvlKBV9/LwdD1rvmDNzzsoQ6Kmh qFNg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=20mJGHcAaflykKc9Cso8rSKoQFvflxJOxP/wZgB0Hr0=; b=osxFNLxoGsY23IkxWmQzSPb1Wwccs7mP2m9Zx5+cX/XcJ69PFdngnF+Bho12hAQ+56 mnNTGBOCUsAJwlNzS5eE2jp/yYE728Lc2xmXrmG32+iLF1yPMnAWJ+uanebiFEVoayRj taf+c5cVnDLDCZftfws9UoLYgZ6kmCb5qTtUqYR1/znRpS6mnsCZzG+amWO8KojQEgBm NR1m6yE6+P9aEJvwycXUGWdmTWkS+WRR4BXCoiBY1pguejZEQA+vg7WrdxVXUeDicI63 O9F0tONYdDc+upTbojv4qaksBfNkUrH0s8CethhTEUXXzVelN3teeKlRWDRjU/3avsQb z/+w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=CBwV7XVb; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iz17-20020a170902ef9100b0018049a28eabsi29750512plb.617.2023.01.20.21.50.38; Fri, 20 Jan 2023 21:50:50 -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=@vivo.com header.s=selector2 header.b=CBwV7XVb; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229746AbjAUFMf (ORCPT + 99 others); Sat, 21 Jan 2023 00:12:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229715AbjAUFMa (ORCPT ); Sat, 21 Jan 2023 00:12:30 -0500 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2134.outbound.protection.outlook.com [40.107.117.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D9E873152 for ; Fri, 20 Jan 2023 21:12:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dOe/QxjMi3U54+yhGU2aLGRCz7Ousk10gxwbwRL0PVaCmHGhsXBOYKmhDOb6XSgem/nmLijnBmhhMjiwGxDLV7oOJGbwZJpGFzOdDqZtIfyrzAIicv5vd9DtPZlrur3FfrzBRQg8XnzIw4uhxorExq33/rNjKMhgPiIKoHyivWzSTIDyz6mv4kOHi/GbLIZWBKNcpRn156fkC6Ids9Fxwt5E9yag0lpIFjD2fO+gt7AVmOw8nnAgclvIVT4p3Gax+j88lYKoOMFl1mJKohnsXTEFz+lPNKGKXLw20FgpzQ/xiCwp5pDaHjYeNn0gQ/0nK3yN7NsIubqqYbqen3zUIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=20mJGHcAaflykKc9Cso8rSKoQFvflxJOxP/wZgB0Hr0=; b=BZF1fyKwRH1jHmcyecTUJseAnIJ+VEMazWcvOKvLZamVOXhBgVhgLBpyU/4bLNq4KftkktY3Eg+w4K/baIXw73eWV4I9gzzk1nXcSY758QXbl23Gx5fAxw4FJ50GzfuZO12GEVrP7NQmMkm+HUfDB8DcjIO7wr5bAoXtVhADKsP5luTVOjv8AbvbYOmztXuoFU3nbyk8aPpD7VWQIFfFrvEsAO5AKEkxrYIHC4bCfCUJA6TI9qioDSLdyhIcjReOIIakGrnp1CxnBT4eZp49o5TbTc6NVZsTHxuU0Rzrb4a5nKKDx9i4QtUVdgSV2bwZIJ3OoA34thmi9J1q13pmWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=20mJGHcAaflykKc9Cso8rSKoQFvflxJOxP/wZgB0Hr0=; b=CBwV7XVb3KMzNdnJH+qwOyqFZk3/Gt1txo/z6QlEGu1QYVy19NlssP3v9FW82a3saQJOtojrXsEMrUSk4R8MkZCwwq+pZOmVg0RJ1fxsLUjtQ0lehTrMIYAYzko6y+ddHQy2Kf2tORB7a5yudcALUG2VUZkVlNLUarh6dPefbKmqCvzvlWDkDFV7AyGiQRqfB0JDA0sXvgeN0ghLBO4tzZX+ugh8VLxMr1zBWvSBo8hSYSlSu/5am8Ue0+9b5wrY2Iv/kM42wGTAiSFF+5NMm/+3TXJx5iJI/lHjgzf71jFgVl4c9ZwKExAvuq6jx0GbXMOKr03wbosS4e4h9q3Tgw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by TYZPR06MB3885.apcprd06.prod.outlook.com (2603:1096:400:6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.9; Sat, 21 Jan 2023 05:12:22 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::3e52:d08c:ecf4:d572]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::3e52:d08c:ecf4:d572%5]) with mapi id 15.20.6002.012; Sat, 21 Jan 2023 05:12:22 +0000 From: Yangtao Li To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH v2 3/5] f2fs: add sanity check for ipu_policy Date: Sat, 21 Jan 2023 13:12:02 +0800 Message-Id: <20230121051204.81251-3-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230121051204.81251-1-frank.li@vivo.com> References: <20230121051204.81251-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0008.apcprd01.prod.exchangelabs.com (2603:1096:4:191::10) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYZPR06MB3885:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f8ef59a-3920-46b8-e4f9-08dafb6e1409 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gYp96CzRx0yV6mMnxyeJLIFL4vComMyRF/DGpfuEQqzosLu05SXthFIoIv4wv6jHh49CbY0OR0usonSAkkm0QS5ixx6SGe0sn/NqpuifysykGpb5lgiy7wqmoR0GF+OsuAusKBevGxQSrEzpg/Cs7TTdfv2X2kkEtomN7GIQW97QhpGNcMOoFcgebdt01Jdn+28Js25bu8xiTyBfA11fvrMoScngETNPTkUkIrw6wM89B+NblL9Dy0tnLb3msW1UXnjhx0rJUqjGT19KOmtke1meT5Gsw7gjf7n4RF7RtKncR9khEj82WQ8x7JDfa5E4dE2oxiupD/JCrtxntk6zr8llApGCpXKF27S3JNB5ZXcb2g2NpYrOF5d5P+zAnRNtojw7ZaCK6nq1Y9yPgAWPCfAXno1md1lIkGvtVjbK1zo2CjMRgAuP59qpeEmbGdDTsmrpXCPSyUXroQxnkSbnYM4Q1a4swjT7yRi/0zeG7qmML3o4yXplb9rYSDsOqgMW5nvTY7fkOh/L4LHB9umssjMnYrDVRRTO7Oy+O3H6m1Wp8bj82Gg+Q1ehpxr9HApN1rGzEWsBr11+yMamk+ghi1Jiac/P0k/RJiIqt7vT4BQracDv4RVLx+izJ64Uh0/PGaMvqp79I9qQw4VgUTZl9X6txBFLwx0xhPXKoALZK7P7nsdvVus8gcrRwYPt+l1y X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(39850400004)(136003)(346002)(376002)(366004)(451199015)(38350700002)(38100700002)(86362001)(6666004)(5660300002)(8936002)(2906002)(66556008)(66476007)(8676002)(4326008)(66946007)(41300700001)(1076003)(2616005)(6506007)(6512007)(186003)(26005)(83380400001)(316002)(107886003)(52116002)(478600001)(6486002)(36756003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2S2yCjDdkwfGEmmBWeDvhyDpCRVW3+oP5wIQkAj0HAudrHoL4BYxFVNt2KaxSjPgNK4r2slZdA2f/IPnmLfxeBT/tk5e/pgXXN6Nu7twu+MBRVk9HPd29Cby6dYaB17zZ1ONBse7m7KWkURlO6aYHGk3cl1YWvWy8DAQwed/xwXwAKpNwtMUfhbyUHQhi3HsGdbjkVmQE6nIseaR/VXNDM33cqlgwk2qq9310GlFdzg7JLEdYiLLr3E3EDrTI3jq90p9lpkF5wX9ZT6eUPKzyHwIpq0MuWw7Vi6+HJn9wFg2/QwRQXR/5NMIa2X5Rhskow6uN0HXzVM/r0bS3NRWkGQffn8mDRwioEmYb0z7HQCchxDI2CmlcyFYKnQZcncwX/25RiXZ2x5o6TeFqwXVb5MkLh5X2r99eHtMnekaVQWXmWkOTY/fvwrTFxZsWMsdHUQjZUDwfOCU/0Xc2SgvNE1Fb+rp7Wj4EUwbX9/37tdXqXLZiH7PE/T0MURP3dmfgoldzQ1vVaF4KlqwXf9wX20Js0P1NxIP/fidipTcZytEER/ZPRIOshuLaHGIvuuFfCNoioMg2WyGeyZUzawJr0GVmVTYOsLqhgRmKsZjn/S82PquYlswCavNgDkUeytdTZJGnOHeOh+vne/ht97jO2rbmpDlDdG8il6HvZcfalKU/6T2r44W5G4uSj1F88PZEpeZav96QNDJKxGpY/hKGK8kw3SQ8w2fDX4N0IWWhi7uTW1InU9MH3lopSS/u4nBRU0uu39GipL9Y9Xd8enW5e9fzN4v6saSgYrUpxFnQtBnCaLRFkZv9AWpoCyQVkPMMksvP992qkq17YkkH6YkhVpFHAlf8NWA8EDrx+qAhX63e5wig0rR3KqqgVmsBtiyHra09s3b+vJJjJrq2A2cLa7MIvQBtu4OUPgm+8xSKA9Az5isuY5hl9A8D6kp/KWvrwrIsEnB7mEfDwSKjy9xm4WllphYRSpRPeI/zK6CP5uKICeFFymQpjifV++MgRozma073JRB/rvEne2rzBUHZLLQ7HZGI1S/S18WIAKQ1PPuxmAzjZSTRnadEYgESyT4F2tYJYU/8biz1LrY4QD6hKw4m1BW45clu8OXFMbzV3P98teTa2PuA4IqMSrhzxa56Y1ylHBiz4Cp6HfXLHG9wVrYF8KiPj2TuQ+FRJ5lfcs2hIcof4Vi2M/iCzgyte+gYwzC1Ew0eLcpSPdXgnzAMi8x8i5adjikXdHIuqT547zi8fa9E16l3PyHEmBT0x6fljxytx2kvpgulPfP5XD4cS1xWni2uoceJcX9cDMfEn6tXVZ/8bZ2RRb/a5BZzoPFOvDzUbNO6qWz/FCnl6/JrZz4pAHnVpns/atIPSSxGKQrVP18LthmhN6Oz3h8s8eXaWpJzNsG+PvwmCgEijJDMTT1LgDuI38rk3AZUrqoxZa2m00oMQcz1PhMStQ+3iXdx1s0gutEJSXdMNEAgf36tY6gAEyzvy3aYNOj4nOI8mA7X2IYdpbi5eWJ4BvkKojam/tMvPNQnEy3SI/NdsGRRFx+1l7oj1BF8yaFqWNlxDwGqeSvvybUhZ/jmbxIyQAW X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f8ef59a-3920-46b8-e4f9-08dafb6e1409 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2023 05:12:22.8450 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8Zu9hAQoNwwOdznphn82wsURi/PE6Sbnh1iHj/Zx0SxgSzLiCxE2fbMkhkl5qyWRc3hzM7q/RL4HyB0u8QVzRA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB3885 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED 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?1755610088037663501?= X-GMAIL-MSGID: =?utf-8?q?1755610088037663501?= Disallow the value set beyond the range, and disallow to change the value in lfs mode. BTW, convert open code to use BIT(). Signed-off-by: Yangtao Li --- fs/f2fs/segment.h | 1 + fs/f2fs/sysfs.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 704d27ad682d..2cbc24f64a5f 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -681,6 +681,7 @@ enum { F2FS_IPU_ASYNC, F2FS_IPU_NOCACHE, F2FS_IPU_HONOR_OPU_WRITE, + F2FS_IPU_MAX, }; #define F2FS_IPU_POLICY(name) \ diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index bdc761f36310..576e6416ffb9 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -452,7 +452,7 @@ static ssize_t __sbi_store(struct f2fs_attr *a, if (ret < 0) return ret; #ifdef CONFIG_F2FS_FAULT_INJECTION - if (a->struct_type == FAULT_INFO_TYPE && t >= (1 << FAULT_MAX)) + if (a->struct_type == FAULT_INFO_TYPE && t >= BIT(FAULT_MAX)) return -EINVAL; if (a->struct_type == FAULT_INFO_RATE && t >= UINT_MAX) return -EINVAL; @@ -706,6 +706,15 @@ static ssize_t __sbi_store(struct f2fs_attr *a, return count; } + if (!strcmp(a->attr.name, "ipu_policy")) { + if (F2FS_OPTION(sbi).fs_mode == FS_MODE_LFS) + return -EINVAL; + if (t >= BIT(F2FS_IPU_MAX)) + return -EINVAL; + SM_I(sbi)->ipu_policy = (unsigned int)t; + return count; + } + *ui = (unsigned int)t; return count; From patchwork Sat Jan 21 05:12:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 46777 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp584201wrn; Fri, 20 Jan 2023 21:38:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXsS1XbM83vuE1d9nkILTT/BHN3WKQ0W2YfhKx1ukRejKMewXacRWukPDuGvxPERVSeZAU+7 X-Received: by 2002:a17:90b:38c7:b0:22b:b25a:d0a0 with SMTP id nn7-20020a17090b38c700b0022bb25ad0a0mr4544041pjb.15.1674279488604; Fri, 20 Jan 2023 21:38:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674279488; cv=pass; d=google.com; s=arc-20160816; b=U9ax95HIpO0EywRKkHVFvoT0oWTctL8MW1P96TgAutzNk5K7NoXQpaatyOUH+J99gJ VLj2518YDoM1kFfS2Bd3V2D6P1m4K1SGGZSMpw0D8ENU6qMbGQQH+yaf71S6QraU52In DJawZcM1jESsi5EfZg0mDghisdfrHb6RZL3LE8Xd+ejN2DyfqfqJ+bDccgdJTvXfadZh w6k+W26IJl+yN5qnqrEp2UaKdI72eqixlohCvaOX9WaFeqJV2+Q3JtcBfEJQOW6rdrwx MiGN1Vlx6c55bMW3rvnDzvHIsHULuAWs0qhy/+DTxSbVxv//3T3Ain1lbYcaUo/WiXTz f1lw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7QlNOhb/vZmUKtW3U4P55tgvX0xlXx7iG2CVOS5BINs=; b=PohUAuofOeRzS3C+EharRjrwAFR+4tq48Z3EuoB1Ukh8BFG7w7QvvtenT7X2KObiCG BkA9I15DVeeip0tnba5kl+WJzwu+SHmOMsqEUpYvor8A8aVsd8nPu3sSsb82ygH783Q4 zxJEKaSEkGFBN4VOOOD+sYNi9fAX5UPm2vnx1/XF5lDPK/pi+yA6aCPo0uC0xBSC4LEl RDRGlgtXWvTQJCD4kg1JNgh49vGmkYYf6epI9K8rVZ065zARQSrLhEQzs7VqdrAwSZbC RY9cMTJQs+PyRCrwIBCEbsiQtdmFIxQTCfZoOo19WMqMqMAeC0BRfsxpUEb+ngxFG6ec MRaw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=ek62lkCh; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fw23-20020a17090b129700b0022699821cddsi4673323pjb.30.2023.01.20.21.37.55; Fri, 20 Jan 2023 21:38:08 -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=@vivo.com header.s=selector2 header.b=ek62lkCh; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229757AbjAUFMi (ORCPT + 99 others); Sat, 21 Jan 2023 00:12:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjAUFMb (ORCPT ); Sat, 21 Jan 2023 00:12:31 -0500 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2134.outbound.protection.outlook.com [40.107.117.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 729AB73145 for ; Fri, 20 Jan 2023 21:12:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ub1qAgIfOpoXscYD1QQo76IABuXtiK0R8gAtjcB3qIYejCCL8tYe3YRnULcez8UIWPU6vbpXi5PXdDzl8bGm/FUIQPXzoGxqyqeeOiYdfp2pW/PRIKEE+e96DSN6/zWwFUyduuytzHQQZHVlQ8TC6e2aRv8ya1nHLc2msi7Kz6MMMfpC9sWhH2QjBXXFVB3wud9szLUKGeyzq1hvNAfeN4H81q81u4HHQuZCoApeQwfgjbtCn4TPQ9xBghplGRZ9G62o1ewpnNSQsz2VyCLTZ9MvwCoCE9wvcBEfpz9yymJD4O7/LwZcNt/M//6Dc/r/i/jxxGqtNYVqY8I56TzYiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7QlNOhb/vZmUKtW3U4P55tgvX0xlXx7iG2CVOS5BINs=; b=evXNVNDzvfEvwVDNKVd5J2FofBLkFpNMG0mC2CIzUPdu98329+05GTmGq8ldCy0GSxVRj8O+x9O/0bmBNAJ0U7mJyYHTbQeiDmMtRM8S4Xkzrou4k1x9TF4GH3Dk3pHhDK3fhAMzOAClJbjITr4h3zun5Yfx9y2IQtvsrsMuFj7uZJM3eLFDrIl/8IbTkrIUlDPwI2MyRLkn1y5tv+4DZ43Xd0LwhmrzJF1mKdAd/NJ5U0y3lOlOTtTVrpOFhl+czZotgTfgblWkdf4zJBJ+2IM7baSILlCmPIQQqk+PAbdFuHuGGj67Z/KCHXIzBDt1WpUrcOkZdHddQe0I6fg0Dw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7QlNOhb/vZmUKtW3U4P55tgvX0xlXx7iG2CVOS5BINs=; b=ek62lkChsNTqV3ZHXmrmhZ6YdqJkqr/2H6DNnGzHSgjrahqqCH1c5UtaR1hQJeG9PZYebgV/FDlNsdE3s0P2Mfhs2Rah4JkQ6BUtyUHd9S2touDM3w4JU+TyUcr92SYCQ3LUDTvcGhT00YbS0eOGcMRQxH8kdfCq8Gihuo9eizuDDBuHdGw6KTr+ughUnQ/ieXvG2gE0aiRWO3tHl5w8ZBvu+Z7+c/gD7ksCZAmvxflyr+7Qnm3iekYgRLaILdnNw3VQtgZZXMphcvT/5zdbAxtOsYgMhajenWqTefP5MSNBrhD+7E6k6u/SHCKhD1rzxG2r1ZnJfNE04/ryzlY51w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by TYZPR06MB3885.apcprd06.prod.outlook.com (2603:1096:400:6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.9; Sat, 21 Jan 2023 05:12:24 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::3e52:d08c:ecf4:d572]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::3e52:d08c:ecf4:d572%5]) with mapi id 15.20.6002.012; Sat, 21 Jan 2023 05:12:24 +0000 From: Yangtao Li To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH v2 4/5] f2fs: introduce ipu_mode sysfs node Date: Sat, 21 Jan 2023 13:12:03 +0800 Message-Id: <20230121051204.81251-4-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230121051204.81251-1-frank.li@vivo.com> References: <20230121051204.81251-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0008.apcprd01.prod.exchangelabs.com (2603:1096:4:191::10) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYZPR06MB3885:EE_ X-MS-Office365-Filtering-Correlation-Id: 14d3cdba-a721-4d2d-5a0e-08dafb6e1531 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4ZEnPrBsUMrLyJR6zajh61C1G5cOdeyvmCrzUiieHidjHFev0sd1k7f8Cj9ElzlKpLhkMEoLXXrd3k89oD3uYIaL0Wc63l40y8UTFNMHqbb2e/V/aQcXi4c9lNnFnLaNtnmpKim3OzIrqSi+1Pr5VSnGHygwZKbFbdgPI2RyOOnNOA70RbULOx8l+xR6X0xSKHCCIgvhqHC/za2DmP6X+e60eq3Jp4e6QDew6vzoxeZXSzAia7QR4jAA1u8u2QmCc2Tx83w4YUcC+RmRhefoCIb1a9nbm4FPfo6pd05bV6I4nUap18fCKzwcM5hlR6TFLjOUvYrMgN0JxsZrS4UH/7Th7wkuNqA7t913cU5CwyE7iSG8fnwRZbqJSK6whTpPwyj8MqR1BmDDLSrI7NNfoAmUFAzqvb1TupZtdzVzJHN2ZzDzid4O7PgJVDpRqFQocRfUjYOAgddbTpIEYyHNp+CqvVVqRxfwbnVJm/c3OIk2K+QqgiTXon6Ad9RnQt1xxZtOAsJch7sI+rQxhoyc4r8pi8mCMEAhgu5/gzDJqkmnAsRbsh2uJMQCc0aBmOq8tE9FnX9qhUxQmpnP/z/k8SyZL0zkmJJO0ui3CJWWSta135+6S/S+smJ7Ge+bZ6TsbVv/v8llIArWzBRnQZ0Fhk9owbIyrlRQE95HUyKlidMj/pFQnzEI3TF8oUataCXXw3/NRoLbjYX3OeMqILDoTg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(39850400004)(136003)(346002)(376002)(366004)(451199015)(38350700002)(38100700002)(86362001)(6666004)(5660300002)(8936002)(2906002)(66556008)(66476007)(8676002)(4326008)(66946007)(41300700001)(1076003)(2616005)(6506007)(6512007)(186003)(26005)(83380400001)(19627235002)(316002)(107886003)(52116002)(478600001)(6486002)(36756003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lxvugdCBnbopGCgsu+l2VKEJR6sPbIFpbIoS7ygx6P904pthxVuTLztXOVXjjAzzLzxDaLzUT4DiX8+Sxya9BskOWWHuwxQfXehx82YZLO/iaTMwvY5ruQIWHAb3+pUSC1Fkquh8vim/t59ADNtBpvgQFWBhw02HprNdjUDPSiZ3X50UUz1qepmzKnOKUYoLCgVMVm+PynyxWyZNWCps7CH9k7PD8pxaM4Ip91IdYpmbOAOTD7rfItz8xY+kGeui8BFI4fnyetUoTlFbciRzsLfYWWElTRI9f6wUBslrJzwUUo4zS+C2dSDc4FhT66RhnetLkxgJ7/0SDxswuYp9LhIdUJIxADCyB4qVayMOy039m+qovPXGNkmuuKYskWghSpi8cleo/YnOoFkLodpjnDn8yB2F9w/4WnG3ccX6eRLv3SHFqlB+O4G9x7hGtaZR0uhj2oN3+PY+ieWpXCdzzp+tO9/y3Qz7XbZEn/HyeGJ7s+pOm0cpV5lfIVwstmz9J/fda2jrpSH6d1xaev0KSIKG0zjWq/vEWtTg19ZKCurkaUnnqyAYJW7hKoxiP2yOjvGgRUrUoAUC/BqvJRP19Wvlu9q6tQO+LV4Nkn7g/cToIwOEKHwTaEpw8hVNb53+adiJtIgPC66a5Iib07CxUw+gNiq1VBfLpH9xe4WkImFYv9eFLHeuD08psAvEEoX6q7JJFtChaBnCLV8KKjiYS70Md+WtJhSQCfSfxijVrnQTvk0zA+7QJyIAcKl1B8W3dBPDYpc3E9VpaUUaS/EgCFw/lOJ4Jli3qhbV6MWfxFIyYrx9hR66rrD2rm40p1CKjiFm0ztCekvyApVefaJOqNXtN1CVSlcKQsqCzW1EDUWvNQoH/XV7RQd4a2DE/G6fHFjXSOiGl5vtgBgVJJZhrnacdCvX2tM8JVyyhZdae8v0eT2OGV5POoeu7E55mnYhl3/U3/Kf3+KJxXDSglozwjXs0QxzoVVZj+/yRXRgqAonk0/NdafqpJtLtBQGYIsd/wQyikUaIpj1r/mGYZeIY9Tk1KwBAU8V2Fd9o5RV4YSBzblnmiAEc71T0F3rc+PL4udxAm+T7c6JTpht5CsEBZJPnFv/FF6WD2D+4kC9kfBFXrB6IcPL/05FMppsbLLxze+qfF6pPzR1BR2V3dFLeaGSxVXOJRExWAP/UekXff9f7UjXfPWZ+xbaKhSWvNWpxx7iepy6HOxvYIVYuQfREJfMIx4HwY6XUL8w8YFlSw1G3JstBNHxQHCT2s6oKchkhnsjjizgTYw9s8E1gx151gRCwGUovp8e85OJnR6WJzDs8fSFzlk0667zBb+5obNTPgP5QL4sS+7sRvVlDFyeCFMJ6SpuLpv7WhzdX27YkMeBTAaJMjwlDCkN9fZmSMefu/fpLanr0pkTySATyz+XXvTpfD0uwd4BKiOkSbzinsmRwLgGT9RmE4ZFkFGau8oK8WCrYqxY2S4l8wwv1NCo7i5V2C/juB+BCk6+XuNcybQSvND6bVhp6nThJfeXgUQh4rb4M0F1mUD1q5AejuZh50Laxwj1cs9XrfVSey0crqsBu+x+oeF3eJzbMrIQNhTd X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14d3cdba-a721-4d2d-5a0e-08dafb6e1531 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2023 05:12:24.8594 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wWao6zwkOyVyj/t6gP7HFHoP01QyPseeDM3pnbNw8/rvJc61z2BTF8ENkkhIwILNM8e98IfOoR56Z1MOhsI8eg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB3885 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED 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?1755609289391525621?= X-GMAIL-MSGID: =?utf-8?q?1755609289391525621?= Add a ipu_mode sysfs node to show the current ipu policy as a string. Since we use ipu_policy as a bitmap, and the bitmap API parameter is unsigned long type data, let's change ipu_policy to unsigned long type. Signed-off-by: Yangtao Li --- v2: -remove type conversion in sbi_store() -convert old_ipu_policy to unsigned long Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++++++ fs/f2fs/f2fs.h | 4 ++-- fs/f2fs/segment.h | 1 + fs/f2fs/super.c | 3 +-- fs/f2fs/sysfs.c | 28 ++++++++++++++++++++++++- 5 files changed, 37 insertions(+), 5 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs index 0f17adc80488..64b15a28fe30 100644 --- a/Documentation/ABI/testing/sysfs-fs-f2fs +++ b/Documentation/ABI/testing/sysfs-fs-f2fs @@ -722,3 +722,9 @@ What: /sys/fs/f2fs//last_age_weight Date: January 2023 Contact: "Ping Xiong" Description: When DATA SEPARATION is on, it controls the weight of last data block age. + +What: /sys/fs/f2fs//ipu_mode +Date: January 2023 +Contact: "Yangtao Li" +Description: Show the current ipu policy as a string. + This is a read-only entry. diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 9edad9ccc2cd..b221a3bdb3fe 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1071,7 +1071,7 @@ struct f2fs_sm_info { struct list_head sit_entry_set; /* sit entry set list */ - unsigned int ipu_policy; /* in-place-update policy */ + unsigned long ipu_policy; /* in-place-update policy */ unsigned int min_ipu_util; /* in-place-update threshold */ unsigned int min_fsync_blocks; /* threshold for fsync */ unsigned int min_seq_blocks; /* threshold for sequential blocks */ @@ -1323,7 +1323,7 @@ enum { MAX_TIME, }; -/* Note that you need to keep synchronization with this gc_mode_names array */ +/* Modification on enum should be synchronized with gc_mode_names array */ enum { GC_NORMAL, GC_IDLE_CB, diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 2cbc24f64a5f..7d98ba537241 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -672,6 +672,7 @@ static inline int utilization(struct f2fs_sb_info *sbi) #define F2FS_IPU_DISABLE 0 +/* Modification on enum should be synchronized with ipu_mode_names array */ enum { F2FS_IPU_FORCE, F2FS_IPU_SSR, diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 1d2796863f8c..ed4a0a721116 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2155,8 +2155,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) { struct f2fs_sb_info *sbi = F2FS_SB(sb); struct f2fs_mount_info org_mount_opt; - unsigned long old_sb_flags; - unsigned int old_ipu_policy; + unsigned long old_sb_flags, old_ipu_policy; int err; bool need_restart_gc = false, need_stop_gc = false; bool need_restart_ckpt = false, need_stop_ckpt = false; diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index 576e6416ffb9..15e9921dcb01 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -51,6 +51,17 @@ static const char *gc_mode_names[MAX_GC_MODE] = { "GC_URGENT_MID" }; +static const char *ipu_mode_names[F2FS_IPU_MAX] = { + "FORCE", + "SSR", + "UTIL", + "SSR_UTIL", + "FSYNC", + "ASYNC", + "NOCACHE", + "HONOR_OPU_WRITE", +}; + struct f2fs_attr { struct attribute attr; ssize_t (*show)(struct f2fs_attr *a, struct f2fs_sb_info *sbi, char *buf); @@ -149,6 +160,19 @@ static ssize_t gc_mode_show(struct f2fs_attr *a, return sysfs_emit(buf, "%s\n", gc_mode_names[sbi->gc_mode]); } +static ssize_t ipu_mode_show(struct f2fs_attr *a, + struct f2fs_sb_info *sbi, char *buf) +{ + int len = 0, i = 0; + + if (SM_I(sbi)->ipu_policy == F2FS_IPU_DISABLE) + return sysfs_emit(buf, "DISABLE\n"); + + for_each_set_bit(i, &SM_I(sbi)->ipu_policy, F2FS_IPU_MAX) + len += scnprintf(buf + len, PAGE_SIZE - len, "%s\n", ipu_mode_names[i]); + return len; +} + static ssize_t features_show(struct f2fs_attr *a, struct f2fs_sb_info *sbi, char *buf) { @@ -711,7 +735,7 @@ static ssize_t __sbi_store(struct f2fs_attr *a, return -EINVAL; if (t >= BIT(F2FS_IPU_MAX)) return -EINVAL; - SM_I(sbi)->ipu_policy = (unsigned int)t; + SM_I(sbi)->ipu_policy = t; return count; } @@ -907,6 +931,7 @@ F2FS_GENERAL_RO_ATTR(mounted_time_sec); F2FS_GENERAL_RO_ATTR(main_blkaddr); F2FS_GENERAL_RO_ATTR(pending_discard); F2FS_GENERAL_RO_ATTR(gc_mode); +F2FS_GENERAL_RO_ATTR(ipu_mode); #ifdef CONFIG_F2FS_STAT_FS F2FS_STAT_ATTR(STAT_INFO, f2fs_stat_info, cp_foreground_calls, cp_count); F2FS_STAT_ATTR(STAT_INFO, f2fs_stat_info, cp_background_calls, bg_cp_count); @@ -997,6 +1022,7 @@ static struct attribute *f2fs_attrs[] = { ATTR_LIST(max_ordered_discard), ATTR_LIST(pending_discard), ATTR_LIST(gc_mode), + ATTR_LIST(ipu_mode), ATTR_LIST(ipu_policy), ATTR_LIST(min_ipu_util), ATTR_LIST(min_fsync_blocks), From patchwork Sat Jan 21 05:12:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 46778 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp586429wrn; Fri, 20 Jan 2023 21:47:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXuFb0hzGNNe60SC/Wl/ommhIb9RVMh9Osi5BxNy2RMnpBTnZsQ0Ca4EPVJNndtltsH8cRvO X-Received: by 2002:a05:6a20:9c8b:b0:b8:bc13:c838 with SMTP id mj11-20020a056a209c8b00b000b8bc13c838mr18086754pzb.53.1674280034023; Fri, 20 Jan 2023 21:47:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674280034; cv=pass; d=google.com; s=arc-20160816; b=kbGYIne1/3LKFR+MyghTcZunLRsqGo8sbMtE8uEGfGIJoeCi/0ysMiKxc5xA0ZIpjs 3R0wrDtNp14vwLRIRVnZZs7risf2VRoRSBK6pyAejekcIPNTuc9NiD/aOtOKnQD6wAVn zTUdje75mp96cTDqFRaemmNCkcxE2NflMmE+/pWFUf/a+jeL9eo8IG0/Qh0e7pmUQTTg 4dP1mF2RNCvrfB0Y4985JmsQKsShpAFzNYFga6mHkI6MkbpaNWRBsMywU2nmXkwuGGDs bvylgBfdmi+2OQ6FSBDxfVVgDNsc436VhjQacWV9TyQUJ6H9vYo+ZYO1r/wedlh9o71K EECw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Re6VwMN0RWL3pDrBsb3XEkXWS2NBdN/1YA9ZEpvi8F4=; b=p5DvSabJU6sL9rg+XPPUhNY0dzHSTX7yY1CE64TYLtftpDgPdev+kVfjVVYXYrpSft ud0bE2RFEUx1uxiHklwkxsBH9T4GHAyz7lLQBG9wBhqUyuWySds7/Ww+R8bBtVqCJkcu logQ83hqanB/HJlZpIL2+94uPaJVb3Co1Cn9afao6aOzOW6pR9O2J64W/9igsD2uQatl vALaanSuYvoweeckej+vrlXSvEorhw4tgavZbi5hteluDZqU648smTPpOr8XfaWt4hl5 7DK0fkJ3hOIIocFcN7Wxf2aPt1azBq/NRuLWq/pVzJUIZD7BQ76sT3hsdKOFrQ0CTqir CU0g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b="Nh/J7AAq"; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e34-20020a630f22000000b00477c62b9498si46087682pgl.212.2023.01.20.21.46.59; Fri, 20 Jan 2023 21:47:13 -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=@vivo.com header.s=selector2 header.b="Nh/J7AAq"; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229764AbjAUFMn (ORCPT + 99 others); Sat, 21 Jan 2023 00:12:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229735AbjAUFMd (ORCPT ); Sat, 21 Jan 2023 00:12:33 -0500 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2134.outbound.protection.outlook.com [40.107.117.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CABF973147 for ; Fri, 20 Jan 2023 21:12:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H9qJnZq3uXl7I7/gMFaWqFfqyKP9o7R8PZdv/vU9+3xOJ+helXXtartZAhawFp3XgIbAR3NuZX9NIb5a4iRqyOw0uOPuziQMnLkvOJuFIiX6VRrzf2WTj/Gv9mUtkk9cQCv58niJkrx7GtBJVwlUc55rqoVQesrx72ITNb5ZD6FZrCouS5ZgMtiqBdUCYI+Er9lTE12zYpFJ5mU7U+Gd8G6g09FDuITBD9UcrCUnwuUv5DWgKhgh7TQjFjsgX0o8s+asmC2vDHHhXXgh1ShNyVX1qVwAK4mqD3nfzvlGR9xzQe8yjXzSn9ci8fNr+rhwEeeJvdhDX+bCJ8vbRwA8OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Re6VwMN0RWL3pDrBsb3XEkXWS2NBdN/1YA9ZEpvi8F4=; b=nIJF3U59k/xCI6/iOrtz7PexWO4RB1Zxysayn+M09FIZhYb5H40C1DQSXiaFKnlvkD+eOqYLd6FsiJ+Z6A/6Oeo/lb6ihfxzC11WLiFYu6dy5L43OFZYUO69CgrFmsAGNZwDYt9yy/uZ0vkXxj4ICStmX5TRQZubFB3RC3JP2XU9Y1ziHyRmHnsZuClzX5J/T8OOhxmQwqcmVr4G5WssLXJauVpl/S9WMZGEZkDK2IuliYCL/O+iZD0HdhXVEw+tsbKZ7R8UIx5pNOAReeToF5zbmIBsOVJLzeIAeL3CeNh8XFgCDyqJ1OeJ3mmOw8sG3TyZKbAwRrbBK+1BDWusEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Re6VwMN0RWL3pDrBsb3XEkXWS2NBdN/1YA9ZEpvi8F4=; b=Nh/J7AAqOCbUEFLbKxZiq9zOqMJkLBy+NQxM8P4orOA8eX3FnovYep2DoduTkXa5A37VeWE6hzT9PrUBuiA3uDH/hTU9eJN2cpX8NPmQU7EnhEfnNI+JsBngLnIzZ2w2gSa4PxUS324xy1gvWubagnhaYdXa6ZmD9Y+vZ3irSRXjkrgx2ZlPWlNM7a8uTxiOUQDACpd1LhSbolvI5AF0PEviANmWBdRagEr4ODZf8QEIQz8DKVbiBLCMgMCsknvUMms/FaL8ZmtWAY6FTHX/Up9h4cKsJE2a0lH1dKbSndYyu2JA+a/XyO9ECOPmtFJcC/daEzjq8tixYB2CjQB+IQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by TYZPR06MB3885.apcprd06.prod.outlook.com (2603:1096:400:6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.9; Sat, 21 Jan 2023 05:12:27 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::3e52:d08c:ecf4:d572]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::3e52:d08c:ecf4:d572%5]) with mapi id 15.20.6002.012; Sat, 21 Jan 2023 05:12:26 +0000 From: Yangtao Li To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH v2 5/5] f2fs: move ipu_policy definitions to uapi header file Date: Sat, 21 Jan 2023 13:12:04 +0800 Message-Id: <20230121051204.81251-5-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230121051204.81251-1-frank.li@vivo.com> References: <20230121051204.81251-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0008.apcprd01.prod.exchangelabs.com (2603:1096:4:191::10) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYZPR06MB3885:EE_ X-MS-Office365-Filtering-Correlation-Id: e9648a97-96cd-4a1a-674a-08dafb6e1667 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J+FnAFwArb4bhfMuhuHPR/LXRT4gifBuuen5MLolEUWCdyCesS6JCHULlgl0980LR9VeG7H0BaqzIHD4pqxUkKdNQeduBpHEGczG3y+eXdfdTIKPU7Lw2BXHv5q82F/rUikAtypP3ydMu762tJLwpA6+WcWa5BEXOuJjoNETLN5Ju9/sSU4TDlKhqE3p+QolngUd1gNycUXOsVVwKtaquBlkFEkNc0X2AQl4/BUZMZ4uNrMN7LVJ2ItjZopwY9mY3coR2zF7bLR3Gnr1Uz36Sp4LdWM7uL0ny5BUllhKKnOOt5xhhR+SnZrN9wQE+9xkIUy/DfoAn4wADOfsbvFzBKG8n7KtT7z1shGdThFNMPmco1JtqfKfJN/QUkcQR5R/wT4J0JZlHG9/T6htXloJ4lRymhOU3CuL/GxmNwuV6lt4BOq0hKXZ6+XKs3Wo03kWIxi1LxHRa2CFJWh7yucLFjpgpyfWr6iBWQNI9Eh2QgA+Nh4mVcIlGxzEhZsZ4QxUopU8AXJzRlOq1mBDJ+1zNu895ObngKusq1HCTKoNB3PCjpbEOb43NXxuooW0W8onbXD2EYYx28OUP1ez3idvEOfvslzf+h+mA3Uk8OltC7UQIK3zJOtCRUcqu1wr87LgNJG066KAU+9WqYHptVvff50XnbofOX1l69v0AhNjFsyvwjjDVTQjzdQXioIjGu7fb926yh8UYgCfyEMfaRePxg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(39850400004)(136003)(346002)(376002)(366004)(451199015)(38350700002)(38100700002)(86362001)(6666004)(5660300002)(8936002)(2906002)(66556008)(66476007)(8676002)(4326008)(66946007)(41300700001)(1076003)(2616005)(6506007)(6512007)(186003)(26005)(83380400001)(19627235002)(316002)(107886003)(52116002)(478600001)(6486002)(36756003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Gg8CNCMA3NVwhgCdIPm02X5921yVn7a3Rxr4fKy5USlACx7fW/whF3oF9jso/aOBirSss/YHjFjATEoRY+cNeNPhF8lPtFjp4Hz60hlPFgThbAuSaG2rnNutFU0b8rHhIv0yBbQXVDlq6guFtX3vXceUc2YBTGYbAZk2fgLIGjGU6Uot2NWeb0QaiJKrs7Us4pVz/AkyFCKzN8UEx2yqFXPOshxfnj4HkOqjdR1Ev0uTOj7zuU7Lpq0wR7OCqDjFeoaRwnyHELeZeI18eAzNsXkn8ALBWSGHqIoD0Xet4Hs8k42Tj+PPEwCLqlYTzAerbSkXHdb6p3xtILpR+1kWtMIGDmuRgvCeaMFyGpZ2qHsnpRekgpsTkjf6ydhB1ConZI1QzmsE/9VF56aL1bvgGKjrD0d5Z3mAnTReAYvwaI/Jqd/GRbRPER/NaKq+k5fLPMVDVnWwW8E0YzD8yzReA7oUQey2+qsDWTEmDkSUlx0LphhcEbIvvJu5cZMWaAMfHuQLkF9xBnijyQ+Gv4DJj6W3SASKK3sjNiNi18YH/pn+WPYt9ZDYZC5+Xp2c6TXoDc7TZwoJplA2NnhnzKpfuA7F1wGfG3pdhVnd7Y4vD/ACi0XtuwPj/yISK9o+3+N8hFvIDiuVYzSl0t4mje/tZn9LRlL97DPkZbo6k67LYcCXaG7WDV9Gl4wmscTsBkbEDbrkPRXRYH4Hq6WMNZ0pJHDPYl9pc84asWEhDbmnkksIHUHPGs1/rYYmEhZiPfxzLTdnVL/N8Z41tFttuo8uSQhIAzKRPub5IwSMpW4eRIVoSumxgdH9G6+8NKRTSo0ftpx3PXMhPYkpV0XorSnVq4Dw4hBrcH2flMKELYUS+tK3xKgePyr5+UiTrFLr/us9UFpRu1HbN9nIDSI/8/9IZ0VwN5cPmuYyJ8m62hz1kuh+n2czfm7PR0ojfIz0aFrmPrIhUOc+IPQ7Z+vPiDhKZQEpfvb4+R4BpcwAP/kiMMX/o1NxfSB0kioRCiiTWycR34NJlgFyWFQqFIhrjV9VrQZsQHWp9rxCazcgTrdQjlxCc10EhE7GPZDRn7q7YTrmIuOKBP599MMoKXR3deW+kI3LRjF7toC+fxxr44tcX1PuNU4EmGVYXwEZEhqjM9joO+KBnGmxohdY4FwWk0aVVwuXFqyOaUvSczIVoCmnzFKxp0btMOfCWsAllo9jm/BH5xreaLghvN4OIWeXAnxHTlaIvsc1nN2oWOHk7CEo4UnWC4k1KXOWNCyc1pYvNoefnH5lQXebd/W2u3iLbyeYicfTN1jkcO2kZJmapxglmPxpH8FMFWRqjqdFStcFIieCnJeScWMy3CHBcqvRAk1nr+6R4A5WN726prUCwM5N4ZxoczNeElNTfTxIaWi7jnIA4bMEDYAOTK9+6o0wuEASDHE8QoUr2RHMCOg4js2zUYREaG/r6fMASMYHniwSAb5MyKVmAOc6g8nvd9pC0OdamaELpQHMtsGKPRM1YUnGfcbfzoNu2Bs+bbqAS1N7L4Wu1h3iTdKsCKTWGKZmNx6rGvP0QZpiafRuOZp07vJjNiKUtfNA1xAaZNnKrHETc0tE X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e9648a97-96cd-4a1a-674a-08dafb6e1667 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2023 05:12:26.8758 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rlIcwEE8kLzmIMNKzYYrufq+VWv9guG/KklvnPTMxulPrMtdOrZuCEP7BgaZ4NWhfkEKik0SgzteoUk9eO+eSQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB3885 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED 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?1755609861030298813?= X-GMAIL-MSGID: =?utf-8?q?1755609861030298813?= User can control f2fs ipu policy through /sys/fs/f2fs//ipu_policy, export related definitions and introduce new macro to make it more convenient for users to use. Signed-off-by: Yangtao Li --- v2: -convert to SET_F2FS_IPU_DISABLE Documentation/ABI/testing/sysfs-fs-f2fs | 25 ++++++------ fs/f2fs/segment.c | 2 +- fs/f2fs/segment.h | 37 ++--------------- fs/f2fs/super.c | 4 +- fs/f2fs/sysfs.c | 2 +- include/uapi/linux/f2fs.h | 54 +++++++++++++++++++++++++ 6 files changed, 74 insertions(+), 50 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs index 64b15a28fe30..d05ad2bc56d1 100644 --- a/Documentation/ABI/testing/sysfs-fs-f2fs +++ b/Documentation/ABI/testing/sysfs-fs-f2fs @@ -49,18 +49,19 @@ Contact: "Jaegeuk Kim" Description: Controls the in-place-update policy. updates in f2fs. User can set: - ==== ================= - 0x01 F2FS_IPU_FORCE - 0x02 F2FS_IPU_SSR - 0x04 F2FS_IPU_UTIL - 0x08 F2FS_IPU_SSR_UTIL - 0x10 F2FS_IPU_FSYNC - 0x20 F2FS_IPU_ASYNC - 0x40 F2FS_IPU_NOCACHE - 0x80 F2FS_IPU_HONOR_OPU_WRITE - ==== ================= - - Refer segment.h for details. + ==== ============================ + 0x00 SET_F2FS_IPU_DISABLE + 0x01 SET_F2FS_IPU_FORCE + 0x02 SET_F2FS_IPU_SSR + 0x04 SET_F2FS_IPU_UTIL + 0x08 SET_F2FS_IPU_SSR_UTIL + 0x10 SET_F2FS_IPU_FSYNC + 0x20 SET_F2FS_IPU_ASYNC + 0x40 SET_F2FS_IPU_NOCACHE + 0x80 SET_F2FS_IPU_HONOR_OPU_WRITE + ==== ============================ + + Refer include/uapi/linux/f2fs.h for details. What: /sys/fs/f2fs//min_ipu_util Date: November 2013 diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index a007f5084e84..c56f5a80d3a6 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -5138,7 +5138,7 @@ int f2fs_build_segment_manager(struct f2fs_sb_info *sbi) sm_info->rec_prefree_segments = DEF_MAX_RECLAIM_PREFREE_SEGMENTS; if (!f2fs_lfs_mode(sbi)) - sm_info->ipu_policy = BIT(F2FS_IPU_FSYNC); + sm_info->ipu_policy = SET_F2FS_IPU_FSYNC; sm_info->min_ipu_util = DEF_MIN_IPU_UTIL; sm_info->min_fsync_blocks = DEF_MIN_FSYNC_BLOCKS; sm_info->min_seq_blocks = sbi->blocks_per_seg; diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 7d98ba537241..c064ddffe91b 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -7,6 +7,7 @@ */ #include #include +#include /* constant macro */ #define NULL_SEGNO ((unsigned int)(~0)) @@ -646,51 +647,19 @@ static inline int utilization(struct f2fs_sb_info *sbi) sbi->user_block_count); } -/* - * Sometimes f2fs may be better to drop out-of-place update policy. - * And, users can control the policy through sysfs entries. - * There are five policies with triggering conditions as follows. - * F2FS_IPU_FORCE - all the time, - * F2FS_IPU_SSR - if SSR mode is activated, - * F2FS_IPU_UTIL - if FS utilization is over threashold, - * F2FS_IPU_SSR_UTIL - if SSR mode is activated and FS utilization is over - * threashold, - * F2FS_IPU_FSYNC - activated in fsync path only for high performance flash - * storages. IPU will be triggered only if the # of dirty - * pages over min_fsync_blocks. (=default option) - * F2FS_IPU_ASYNC - do IPU given by asynchronous write requests. - * F2FS_IPU_NOCACHE - disable IPU bio cache. - * F2FS_IPU_HONOR_OPU_WRITE - use OPU write prior to IPU write if inode has - * FI_OPU_WRITE flag. - * F2FS_IPU_DISABLE - disable IPU. (=default option in LFS mode) - */ #define DEF_MIN_IPU_UTIL 70 #define DEF_MIN_FSYNC_BLOCKS 8 #define DEF_MIN_HOT_BLOCKS 16 #define SMALL_VOLUME_SEGMENTS (16 * 512) /* 16GB */ -#define F2FS_IPU_DISABLE 0 - -/* Modification on enum should be synchronized with ipu_mode_names array */ -enum { - F2FS_IPU_FORCE, - F2FS_IPU_SSR, - F2FS_IPU_UTIL, - F2FS_IPU_SSR_UTIL, - F2FS_IPU_FSYNC, - F2FS_IPU_ASYNC, - F2FS_IPU_NOCACHE, - F2FS_IPU_HONOR_OPU_WRITE, - F2FS_IPU_MAX, -}; - #define F2FS_IPU_POLICY(name) \ static inline int IS_##name(struct f2fs_sb_info *sbi) \ { \ - return SM_I(sbi)->ipu_policy & BIT(name); \ + return TEST_##name(SM_I(sbi)->ipu_policy); \ } +F2FS_IPU_POLICY(F2FS_IPU_DISABLE); F2FS_IPU_POLICY(F2FS_IPU_FORCE); F2FS_IPU_POLICY(F2FS_IPU_SSR); F2FS_IPU_POLICY(F2FS_IPU_UTIL); diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index ed4a0a721116..236f82675ba0 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2214,7 +2214,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) goto restore_opts; if (F2FS_OPTION(sbi).fs_mode == FS_MODE_LFS) - SM_I(sbi)->ipu_policy = F2FS_IPU_DISABLE; + SM_I(sbi)->ipu_policy = SET_F2FS_IPU_DISABLE; /* * Previous and new state of filesystem is RO, @@ -3950,7 +3950,7 @@ static void f2fs_tuning_parameters(struct f2fs_sb_info *sbi) if (f2fs_block_unit_discard(sbi)) SM_I(sbi)->dcc_info->discard_granularity = MIN_DISCARD_GRANULARITY; if (F2FS_OPTION(sbi).fs_mode != FS_MODE_LFS) - SM_I(sbi)->ipu_policy = BIT(F2FS_IPU_FORCE) | BIT(F2FS_IPU_HONOR_OPU_WRITE); + SM_I(sbi)->ipu_policy = SET_F2FS_IPU_FORCE | SET_F2FS_IPU_HONOR_OPU_WRITE; } sbi->readdir_ra = true; diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index 15e9921dcb01..285a1e78fc03 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -165,7 +165,7 @@ static ssize_t ipu_mode_show(struct f2fs_attr *a, { int len = 0, i = 0; - if (SM_I(sbi)->ipu_policy == F2FS_IPU_DISABLE) + if (IS_F2FS_IPU_DISABLE(sbi)) return sysfs_emit(buf, "DISABLE\n"); for_each_set_bit(i, &SM_I(sbi)->ipu_policy, F2FS_IPU_MAX) diff --git a/include/uapi/linux/f2fs.h b/include/uapi/linux/f2fs.h index 955d440be104..0ca19d1c9acf 100644 --- a/include/uapi/linux/f2fs.h +++ b/include/uapi/linux/f2fs.h @@ -5,6 +5,60 @@ #include #include +/* + * For /sys/fs/f2fs//ipu_policy entry + * + * Sometimes f2fs may be better to drop out-of-place update policy. + * And, users can control the policy through sysfs entries. + * There are five policies with triggering conditions as follows. + * F2FS_IPU_FORCE - all the time, + * F2FS_IPU_SSR - if SSR mode is activated, + * F2FS_IPU_UTIL - if FS utilization is over threashold, + * F2FS_IPU_SSR_UTIL - if SSR mode is activated and FS utilization is over + * threashold, + * F2FS_IPU_FSYNC - activated in fsync path only for high performance flash + * storages. IPU will be triggered only if the # of dirty + * pages over min_fsync_blocks. (=default option) + * F2FS_IPU_ASYNC - do IPU given by asynchronous write requests. + * F2FS_IPU_NOCACHE - disable IPU bio cache. + * F2FS_IPU_HONOR_OPU_WRITE - use OPU write prior to IPU write if inode has + * FI_OPU_WRITE flag. + * F2FS_IPU_DISABLE - disable IPU. (=default option in LFS mode) + */ +#define F2FS_IPU_DISABLE 0 +/* Modification on enum should be synchronized with ipu_mode_names array */ +enum { + F2FS_IPU_FORCE, + F2FS_IPU_SSR, + F2FS_IPU_UTIL, + F2FS_IPU_SSR_UTIL, + F2FS_IPU_FSYNC, + F2FS_IPU_ASYNC, + F2FS_IPU_NOCACHE, + F2FS_IPU_HONOR_OPU_WRITE, + F2FS_IPU_MAX, +}; + +#define SET_F2FS_IPU_DISABLE F2FS_IPU_DISABLE +#define SET_F2FS_IPU_FORCE BIT(F2FS_IPU_FORCE) +#define SET_F2FS_IPU_SSR BIT(F2FS_IPU_SSR) +#define SET_F2FS_IPU_UTIL BIT(F2FS_IPU_UTIL) +#define SET_F2FS_IPU_SSR_UTIL BIT(F2FS_IPU_SSR_UTIL) +#define SET_F2FS_IPU_FSYNC BIT(F2FS_IPU_FSYNC) +#define SET_F2FS_IPU_ASYNC BIT(F2FS_IPU_ASYNC) +#define SET_F2FS_IPU_NOCACHE BIT(F2FS_IPU_NOCACHE) +#define SET_F2FS_IPU_HONOR_OPU_WRITE BIT(F2FS_IPU_HONOR_OPU_WRITE) + +#define TEST_F2FS_IPU_DISABLE(val) ((val) == F2FS_IPU_DISABLE) +#define TEST_F2FS_IPU_FORCE(val) ((val) & BIT(F2FS_IPU_FORCE)) +#define TEST_F2FS_IPU_SSR(val) ((val) & BIT(F2FS_IPU_SSR)) +#define TEST_F2FS_IPU_UTIL(val) ((val) & BIT(F2FS_IPU_UTIL)) +#define TEST_F2FS_IPU_SSR_UTIL(val) ((val) & BIT(F2FS_IPU_SSR_UTIL)) +#define TEST_F2FS_IPU_FSYNC(val) ((val) & BIT(F2FS_IPU_FSYNC)) +#define TEST_F2FS_IPU_ASYNC(val) ((val) & BIT(F2FS_IPU_ASYNC)) +#define TEST_F2FS_IPU_NOCACHE(val) ((val) & BIT(F2FS_IPU_NOCACHE)) +#define TEST_F2FS_IPU_HONOR_OPU_WRITE(val) ((val) & BIT(F2FS_IPU_HONOR_OPU_WRITE)) + /* * f2fs-specific ioctl commands */