Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2406709ioo; Sat, 28 May 2022 12:37:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKeU8FtQX08xfpdi2KBORGLjE4XbNtDxjRAbuvBgA29rH7sfkIc31rUT3qbd/DslmIu2Ki X-Received: by 2002:a17:90a:af8a:b0:1df:9f11:dbc7 with SMTP id w10-20020a17090aaf8a00b001df9f11dbc7mr14731414pjq.233.1653766655099; Sat, 28 May 2022 12:37:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653766655; cv=none; d=google.com; s=arc-20160816; b=AidAdbmw5CsriFFLFfYzbNdpWhtk61KcPAoaKm227Rnr2SY9JsMlU1dyEzyRjhaxQi TtHXPUb0iQ7HQ/Pon8797r2pfDjR6+yPd7a2YaVZyiX1S9POYcryg/Mkd2JZm6T6JdFm 6psAjvlrTVU3CBp4Jii8cPD3I20M4C+Ob3ypjOzxoVPdj+vIu0PoUUtFhb8amHontV11 DQDxMq1hi2Oj7MfIkJa51fjHgkO+cJyTX/ehLHCvfC2E0INF0f/Cvi/LjYnAPO5WJFRu 9wQIJ0+na2f9boCd+rG/4+oraZcqANw6z2eOVZe/J8oidTRoRuq36f/MKJYex4xRh6xU AS5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=CRtsOhUzK+QPvz8tD7DDQWOiRL0GGjLeyermSKfv5dA=; b=Sd6WFZEZF++UnwOr62K/+7QVh0YW6EJn7gCRbzFg4gG9oEnYOglRe2dJHQyj7TQeGw wVzLZRW0SyTJPvVGk35hHaBS3bxBiGG4I6Of5UjVxi4FKjZncpHcR0QLFrlmOgSM2pgF 0bYgBJwXKskUDKYqGbM0f2ICOMSpu8IZaVE0CXWFL22uP38qbN+FPADIQ+EcGUwbojP7 hi0FSc/VKFLDM2hk7q/gXgJUVhRrp2X/2IeDNjFJzNOyxQMyua1REr6b3rWH/Pb1l5KT NfY01dPpUVsVsRJ4JBMrS/r5lIj2955/EZYq4EoWmZ7PMCTYgVYDN7yYur4MtOfiUcKt irhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KqdOYSY2; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id jb4-20020a170903258400b0015ea7c9454bsi9188459plb.572.2022.05.28.12.37.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 12:37:35 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KqdOYSY2; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3A5BC5BE7C; Sat, 28 May 2022 12:02:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353736AbiE0VAC (ORCPT + 99 others); Fri, 27 May 2022 17:00:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231933AbiE0VAB (ORCPT ); Fri, 27 May 2022 17:00:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFBE913274A for ; Fri, 27 May 2022 13:59:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 66968B82627 for ; Fri, 27 May 2022 20:59:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18DD9C385A9; Fri, 27 May 2022 20:59:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653685197; bh=MDqqGVbDkvLFjWALykBKBuv+PMCdMSdg2DK72WK9VJU=; h=From:To:Cc:Subject:Date:From; b=KqdOYSY2TbWmubOijgv+Em8VTLv8NDYtL0NxcaC2BZNJzW7AaH4QtFBKfS6H+cQpA UKyB7lyedKOc+n1pZ/Bk8sJMYIwCk0PrvJ02HSkZlDHO1Dmr5H9F5fsMBriq5uT950 Hvx+O3vRkcPY2EDi7FPwQngizZU0xN8fB5y7UWgbXd8Xu1v2JV0CqifC4v1gD7zfAf T5VFuXwz1y0xTWlHBAQpDP5GRdt1zIFHgCjXRdToOa6vG48SDXSJ/1uLJ0VDSSrJRj FJglCYHIOo0g0FE1eHWMgXVh4BFa8yo7SgU8walhm8V0T24QyaSVWKUv6DNn5Cmm7B 0ThTJDNT/OgAQ== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim Subject: [PATCH] f2fs: add sysfs entry to avoid FUA Date: Fri, 27 May 2022 13:59:55 -0700 Message-Id: <20220527205955.3251982-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.36.1.124.g0e6072fb45-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some UFS storage gives slower performance on FUA than write+cache_flush. Let's give a way to manage it. Signed-off-by: Jaegeuk Kim --- Documentation/ABI/testing/sysfs-fs-f2fs | 7 +++++++ fs/f2fs/data.c | 2 ++ fs/f2fs/f2fs.h | 1 + fs/f2fs/sysfs.c | 2 ++ 4 files changed, 12 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs index 9b583dd0298b..cd96b09d7182 100644 --- a/Documentation/ABI/testing/sysfs-fs-f2fs +++ b/Documentation/ABI/testing/sysfs-fs-f2fs @@ -434,6 +434,7 @@ Date: April 2020 Contact: "Daeho Jeong" Description: Give a way to change iostat_period time. 3secs by default. The new iostat trace gives stats gap given the period. + What: /sys/fs/f2fs//max_io_bytes Date: December 2020 Contact: "Jaegeuk Kim" @@ -442,6 +443,12 @@ Description: This gives a control to limit the bio size in f2fs. whereas, if it has a certain bytes value, f2fs won't submit a bio larger than that size. +What: /sys/fs/f2fs//no_fua_dio +Date: May 2022 +Contact: "Jaegeuk Kim" +Description: This gives a signal to iomap, which should not use FUA for + direct IOs. Default: 0. + What: /sys/fs/f2fs//stat/sb_status Date: December 2020 Contact: "Chao Yu" diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index f5f2b7233982..23486486eab2 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -4153,6 +4153,8 @@ static int f2fs_iomap_begin(struct inode *inode, loff_t offset, loff_t length, if ((inode->i_state & I_DIRTY_DATASYNC) || offset + length > i_size_read(inode)) iomap->flags |= IOMAP_F_DIRTY; + if (F2FS_I_SB(inode)->no_fua_dio) + iomap->flags |= IOMAP_F_DIRTY; return 0; } diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index e10838879538..c2400ea0080b 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1671,6 +1671,7 @@ struct f2fs_sb_info { int dir_level; /* directory level */ int readdir_ra; /* readahead inode in readdir */ u64 max_io_bytes; /* max io bytes to merge IOs */ + int no_fua_dio; /* avoid FUA in DIO */ block_t user_block_count; /* # of user blocks */ block_t total_valid_block_count; /* # of valid blocks */ diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index 4c50aedd5144..24d628ca92cc 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -771,6 +771,7 @@ F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, iostat_period_ms, iostat_period_ms); #endif F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, readdir_ra, readdir_ra); F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, max_io_bytes, max_io_bytes); +F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, no_fua_dio, no_fua_dio); F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_pin_file_thresh, gc_pin_file_threshold); F2FS_RW_ATTR(F2FS_SBI, f2fs_super_block, extension_list, extension_list); #ifdef CONFIG_F2FS_FAULT_INJECTION @@ -890,6 +891,7 @@ static struct attribute *f2fs_attrs[] = { #endif ATTR_LIST(readdir_ra), ATTR_LIST(max_io_bytes), + ATTR_LIST(no_fua_dio), ATTR_LIST(gc_pin_file_thresh), ATTR_LIST(extension_list), #ifdef CONFIG_F2FS_FAULT_INJECTION -- 2.36.1.124.g0e6072fb45-goog