From patchwork Fri Jun 9 13:15:55 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: 105639 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp958155vqr; Fri, 9 Jun 2023 06:45:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6L6B+HZWggip6Qw4Q4uCMexyWp5g/Ip8RPe9uTiVEjLKmq+Yyf1wil3xZ5vEuHdUVjbwA1 X-Received: by 2002:a05:6a00:cc3:b0:654:9d3a:f96f with SMTP id b3-20020a056a000cc300b006549d3af96fmr1522635pfv.4.1686318307855; Fri, 09 Jun 2023 06:45:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686318307; cv=pass; d=google.com; s=arc-20160816; b=EMld75kobVteaJRyXZ4FTRmvFGR7zOn68UuFhZSS8ZNb6r2YrnkvHdRsDn0pyeGIvU BRFn7APUYonUck9Fl3dKGEKvE35zUpfBUvD/gm0QHZY0yf7lLw39B8A3LHYU/8XqQVsU iub0cvy5pPuXs+I9x+wf+UF8fzDdDo94g+Y+XvmsvPAYKfvOtYXsYJHZC3ZolvhmheZH dOCZFV7f+V03AF2DXfAFZbj99ytvXC4mtdK0orztDalI0weHDjb8EEkX/1KOTi9FRuk4 xHVo2SjFD8TEoyKdA7nbBMoBhCW8zqKf1zDjZhHswGAIxIfgsSH/VzI6B0DV/FgWQY7f hRgg== 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=umCehp1ddvPRZ1k35Zb8VMKOFF6IlmsBoeOINWWsH5Q=; b=KZdGH8uNkCyU5XlBU7a6hz+yHtkxEWyrzyOvDR9TKJFGRYnxtjLr/fP9/nXvbGB0w3 Hqq7iE4jDT/4qe2xllohlunxXChYbaVjL0JponEQ3VM/JtenL++EvTNIcTKx4/HGkKhN 3Kq368vyLq6ZmZK70lIGPtm3OgKQduhmJ09NZtZJFGb9iU6cB/s4b0DlVHLVNNfnCkyY sRghH5cHQoyi6cKthxOs8U0uTLCF+QTkkJycKZrY5CfIT7P2lyINtBdluH4MwWmZL1TB 8HTZMB1oGcgkDawisX5hPkRQIaigaVVggW5hUMDYaZrizGDFIpTLdTvI+JVmeALcDfha k8Uw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=e5nyZFZR; 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 u197-20020a6379ce000000b00535bf852410si2602255pgc.313.2023.06.09.06.44.50; Fri, 09 Jun 2023 06:45:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=e5nyZFZR; 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 S241367AbjFINQV (ORCPT + 99 others); Fri, 9 Jun 2023 09:16:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241298AbjFINQQ (ORCPT ); Fri, 9 Jun 2023 09:16:16 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2124.outbound.protection.outlook.com [40.107.255.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD4DE30CD for ; Fri, 9 Jun 2023 06:16:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tu7QYnoxXQ3MuLl+OyCcxNmjVebhnd9ZPT+n19LbWq1w3BFR4Iwcd8ij4kKSl4mNZ3TszX6oVY5v22nVmEqzdXzR4YsyReJ9MpRdiWwwVujfoLG5kYf89SszzjN4RRZlWKcN0DVQuAEV4FR32p90D1wjvNZpVG03SE/kYUu3F638U+viY2msc5REjk2Iv5vo+ps5lcKsj61399Bhua65vEKnpL009S+JnG1+njW+VNOr9bcRAsET7JvxAatU7QDlsbuLIifog+XQ4S2GpP3KgVilCUgRAnYETW42JT7sFSYrkQ53IFbARjaKWs89CqMyUYiRnsf+BHcvyeSsf0GCig== 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=umCehp1ddvPRZ1k35Zb8VMKOFF6IlmsBoeOINWWsH5Q=; b=H/rqX8XRRR+L2ra7jAG/kHbzHmTZNSOgyPEJ+2ehl4Yt2iqWK+eHF4awngPLIUoFaguficyH3KrXFxs11XQrQtBGnJCicIHjMFNqM8iNUxfUeyT95g+Fwb0K0x674WdtcptcfgBYIGfPzMyFhXNwtFj9f2fxoHfDb2BovRU8ihRd8aFPnNPtP4pQkztxrMsKmw8/ziqd3iMQye2uSJLXfke/cyC8+vGruthW4I9PLTCzuf1RcBQk6edfAUCokN2mr3CF3bace+g3DbFio4byi5RN7sUyKxgfRvfYt43sdKllFfaWd0H2mIg+n6A0rO6WPuVSutQ3uFEa3MXVdVPwog== 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=umCehp1ddvPRZ1k35Zb8VMKOFF6IlmsBoeOINWWsH5Q=; b=e5nyZFZRyWXEQGOXEXuHrcsz9VIRhCphDYsfihU9rm/dHIci9M0+k2Jm6V8gdEqlX8Lbx2uzLWKEYw8+TnYDWY61PfxL8RJhixU3DF4lRFSwy/UZzsPI5eHstxMXGzgo30jd/Xnpoz+0rliv5oopXNKpYrwlaVHLlpN+jNFN2PmZ2ubKEkRmlFCy9dbMm24ZfXXJxmxBjn2H3oNlmN2S39GKT4X/anNqzO3cBBJaeV0CjXquVP7anBn38jMzzDplEn4hEQGdV+5Zo5YMTmGEeRmUhzBKZ6r/vAzouqLqJXP+Moc0GaoVikAJWtskjcKWRC0LqCnla/w8kBq7IpT34A== 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 TYZPR06MB4029.apcprd06.prod.outlook.com (2603:1096:400:23::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Fri, 9 Jun 2023 13:16:09 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::76d6:4828:7e80:2965]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::76d6:4828:7e80:2965%3]) with mapi id 15.20.6455.039; Fri, 9 Jun 2023 13:16:09 +0000 From: Yangtao Li To: Jaegeuk Kim , Chao Yu Cc: Yangtao Li , Qi Han , linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH] f2fs: compress: don't force buffered io when in COMPR_MODE_USER mode Date: Fri, 9 Jun 2023 21:15:55 +0800 Message-Id: <20230609131555.56651-1-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 X-ClientProxiedBy: SI2P153CA0001.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::7) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYZPR06MB4029:EE_ X-MS-Office365-Filtering-Correlation-Id: e577d4d9-47ea-46df-0481-08db68ebafe2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gg5xYU57LgSLRAac+HIJ6osrjScqTFNILLIUVsjID6bFSygcCKxnv2WMM7Dh0nSBcfY7Ak8GEmDNs5QsfLLg8Gun85E24q611Q3M9IRYUgJQ1NAu65lgmPJVnmY+kUQy/o1921BH1z1sBO3QwFaSIgrh+6xYRI+DWTt8y5BZsGL8Ffk6cvYkWc4PmEuE+qTGvQPXtafeedCzfr17CyDR2hbuNjnhwbo0CzEsG+ftJVN1to/drXvQOxY743NkUS9SQlTprO5tHVgpIA+bBd+EWCVmHoYZdpzypLlOSXyqV45R7+4JLpO83vIgQ2LCb5QmiUg5IUmMqZ4T1O+M6Ff4filRuu4kynLQrJ4UK9O6NpcTd6H3fpVnsw0bqcurQTxYaRTtVv1CuzTuRRf7+1mv3ldoLBgVA3dA0w6fu8gM1mBOM6bcaWxfhKuxZ1UtKQoQ9XJi0IAj2tqDkSkiT4j0EWO6S1wPmlmbHy9DeC8exojy6uBs/RV5UUDUGRAbDu8gL9HvNRf1Pncse7cDavutF7RoSiDoQoY+LSXTzYWKVRbCZ1FmMCD4IQNooWzMjRp3wuU1NsK4t7BVj3eAFir/8Wetg3CeVlJTrk2LgFgNOkS+r8U72l5Du1OlkCfez44Q 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:(13230028)(4636009)(346002)(376002)(366004)(136003)(39850400004)(396003)(451199021)(6512007)(1076003)(38100700002)(6506007)(2616005)(41300700001)(38350700002)(6666004)(6486002)(52116002)(186003)(26005)(83380400001)(478600001)(54906003)(110136005)(66556008)(66476007)(66946007)(316002)(5660300002)(4326008)(2906002)(8676002)(40140700001)(86362001)(8936002)(36756003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QFFhz9WzN5PP9OLEU6kaZ8stx7GFFNOEQZNP8J9+GuR1Pnj6EMz0sjCh2vJzV9u0bQltj2O3lP2AUpCywcuVuHJ8icwDoWAZD03asWZPcXjZy5LY9mkTdnazzL3HH3rFiCEPGN2u0ead8dGfEUWDb4xBPueB6n0Rl6lOrLxlInUSaZTDnm+Of1B1/JWiPelzEH9pHxMi2nJy4JmRygtq53MT/pUhe1EDNkyzzI20nd/O9yd9qlJY/hi60XZpkOMIeo42ZnCKClauLOxYqfi+7BSR9ERmtjn/37fMQay2HVlA0befMbylFNisGhjQ/cJDW7UqsnD4GrXaJTRacllhOH7gyFSSQd/t6iEhzvFCfrHzdTm5d3IRhLjiaoZuoYxZbT41scLJPBsl1nIhz2FifKfTaCJFeGtX+a9N0u5U3bYwui5TcIDryVy1ggsCTQEQU8+gAvkf8A0oN9L3yZSnuMWwxoAeh9HHYSuKDvYyMD7nn0+0ikRtybJTtZCUgjksJ1Ptyt4I4khzWNITnrw09TYSrlJGs5y2am/kdWicAdQ0jHwPWOtuFfxMwKNubj/U33WXP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46df-0481-08db68ebafe2 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2023 13:16:08.3521 (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: azduNq+TZL/jYh00dSniVpAwrqS3qpsLVjXOSx08fl+7M629adGlxsY/1lv5+XjTmuV/P3DLP6TI1hVMCHlo7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB4029 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,T_SCC_BODY_TEXT_LINE, 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?1768232905868793850?= X-GMAIL-MSGID: =?utf-8?q?1768232905868793850?= It is observed that when in user compression mode (compress_extension=*), even though the file is not compressed, the file is still forced to use buffer io, which makes the AndroBench sequential read and write drop significantly. In fact, when the file is not compressed, we don't need to force it to buffer io. | w/o patch | w/ patch | seq read (MB/s) | 1320.068 | 3696.154 | seq write (MB/s) | 617.996 | 2978.478 | Fixes: 4c8ff7095bef ("f2fs: support data compression") Signed-off-by: Qi Han Signed-off-by: Yangtao Li --- fs/f2fs/f2fs.h | 14 ++++++++++++++ fs/f2fs/file.c | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 1efcfd9e5a99..7f5472525310 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3168,6 +3168,20 @@ static inline int f2fs_compressed_file(struct inode *inode) is_inode_flag_set(inode, FI_COMPRESSED_FILE); } +static inline bool f2fs_is_compressed_file(struct inode *inode) +{ + int compress_mode = F2FS_OPTION(F2FS_I_SB(inode)).compress_mode; + + if (compress_mode == COMPR_MODE_FS) + return f2fs_compressed_file(inode); + else if (atomic_read(&F2FS_I(inode)->i_compr_blocks) || + is_inode_flag_set(inode, FI_COMPRESS_RELEASED) || + is_inode_flag_set(inode, FI_ENABLE_COMPRESS)) + return true; + + return false; +} + static inline bool f2fs_need_compress_data(struct inode *inode) { int compress_mode = F2FS_OPTION(F2FS_I_SB(inode)).compress_mode; diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 74ecc9e20619..0698129b2165 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -821,7 +821,7 @@ static bool f2fs_force_buffered_io(struct inode *inode, int rw) return true; if (fsverity_active(inode)) return true; - if (f2fs_compressed_file(inode)) + if (f2fs_is_compressed_file(inode)) return true; /* disallow direct IO if any of devices has unaligned blksize */