Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp1997703lfo; Sat, 28 May 2022 13:12:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymJPOW9lX/7TxFI5BZBoD5s1FhklhsMfxHu+SniY6NjCLSv6KVWGbLBt9AIvxzwUBRwNQ3 X-Received: by 2002:a17:902:f685:b0:161:8df3:7f50 with SMTP id l5-20020a170902f68500b001618df37f50mr47906340plg.106.1653768740860; Sat, 28 May 2022 13:12:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653768740; cv=none; d=google.com; s=arc-20160816; b=chuQZ7XTGWjgcPbFLQnjb2R9aryhHPevuvqlZHfm4EXcvAVnysf54rAyM5uoLjJ/y5 gpImC4FD9eZi/KvwrdN1CPkkt5RRqetwQiC07rJKnbnIzTnESuvOwS1SEeMsKfubzEDL CETw8KrsrQBt0BFjuoSFZ29xwuTU51kvgdR2DkfXKCD1rNqWNB9CjhAHPhHeyGw2Zzpy 9y9xNu7yJMyv26Y3W9uaurwxx3asVJkEgJmzOQrcTQEaX7wimriJ7PLZ4k4FwvxbkJx7 Mwwp3yeD0cShwJWBiQzd9wdN3ZRrm7v9gdtnPrJay7qrP10kSO9EY4PMWPTYCZagA166 xohg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=L/pK0vXgnUIQvH3s5nZwayIWumnFrRGavhp4dU2/4pg=; b=fefMUceD98y6a5i7f22KdC8BGMITrCqrclTXKXvR0QjV4VvsqHVvcGw+rkO1ua9bP0 ZD6lhF5SrhCdUl5QrEZprQhpoGpu34ahfjOebYG5Iw4qVqk3A3H4C6Ibvg6Y3ZHLYaN7 C52EoFrUtNikf59k9tWqPKXAMmIlWwbkVgtn+AkEbjTo4AJY31YeVEHapCbjlWqvjTrz tDUofIgQNNUhLLRm9aIADA8MSmS7QPfw1Gq2lCINxXUFr2h4V40qnPmNOUiVBYVQT0EZ 8WEPeKCWocPHrOKRgEgTh6gSnBZzxmZRBTvyqsCADQnUqHJ0BDgZl5DjEbf11w21AYCF sGJg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id ot1-20020a17090b3b4100b001d1c84b8ea2si8139354pjb.156.2022.05.28.13.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 13:12:20 -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; 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B5DFF13B8CD; Sat, 28 May 2022 12:24:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355799AbiE1FMo (ORCPT + 99 others); Sat, 28 May 2022 01:12:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230025AbiE1FMm (ORCPT ); Sat, 28 May 2022 01:12:42 -0400 Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E27CCB41CF; Fri, 27 May 2022 22:12:41 -0700 (PDT) Received: from dread.disaster.area (pa49-181-2-147.pa.nsw.optusnet.com.au [49.181.2.147]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id EE07A10C8B4E; Sat, 28 May 2022 15:12:40 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1nuokg-00HIOO-Pz; Sat, 28 May 2022 15:12:38 +1000 Date: Sat, 28 May 2022 15:12:38 +1000 From: Dave Chinner To: Jaegeuk Kim Cc: Eric Biggers , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-xfs@vger.kernel.org Subject: Re: [PATCH] f2fs: add sysfs entry to avoid FUA Message-ID: <20220528051238.GX1098723@dread.disaster.area> References: <20220527205955.3251982-1-jaegeuk@kernel.org> <20220527235509.GW1098723@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.4 cv=e9dl9Yl/ c=1 sm=1 tr=0 ts=6291af49 a=ivVLWpVy4j68lT4lJFbQgw==:117 a=ivVLWpVy4j68lT4lJFbQgw==:17 a=kj9zAlcOel0A:10 a=oZkIemNP1mAA:10 a=VwQbUJbxAAAA:8 a=7-415B0cAAAA:8 a=8RavHqeXKao-3GyEar0A:9 a=CjuIK1q_8ugA:10 a=igBNqPyMv6gA:10 a=AjGcO6oz07-iQ99wixmX:22 a=biEYGPWJfzWAr4FL6Ov7:22 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Fri, May 27, 2022 at 05:26:32PM -0700, Jaegeuk Kim wrote: > On 05/28, Dave Chinner wrote: > > On Fri, May 27, 2022 at 09:33:55PM +0000, Eric Biggers wrote: > > > [+Cc linux-block for FUA, and linux-xfs for iomap] > > > > linux-fsdevel should really be used for iomap stuff... > > > > > > > > On Fri, May 27, 2022 at 01:59:55PM -0700, Jaegeuk Kim wrote: > > > > 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 > > > > > > Should the driver even be saying that it has FUA support in this case? If the > > > driver didn't claim FUA support, that would also solve this problem. > > > > Agreed, this is a hardware problem that need to addressed with a > > driver quirk to stop it advertising FUA support. The high level > > fs/iomap code should always issue FUA writes where possible and > > the lower layers tell the block layer whether to issue the FUA as > > a FUA or write+cache flush pair. > > I was thinking to turn off FUA in driver side quickly tho, one concern > was the bandwidth vs. latency. What if the device can support FUA having > short latency while giving low bandwidth? Seriously, how is a user supposed to know this sort of thing about the hardware they are using? They don't, and to expect them to not only know about the existing of a weird sysfs knob, let alone how it applies to their hardware and their workload is totally unreasonable. If the hardware has non-deterministic FUA write performance, or requires very careful switch over between cache flushes and FUA to get the most out of the hardware, then that's not something we can tune or optimise for - that's just broken hardware and the drive should quirk the brokeness away so nobody has to care about it. Tell the hardware manufacturer to fix their hardware, don't try to hack around it in software and then expect the user to know how to tune for that broken hardware. > In that case, we still have > a room to utilize FUA for small-sized writes such as filesystem metadata > writes, but avoid DIO w/ FUA for sequential write stream. Strawman. We don't use FUA for normal DIO writes - they only get used for O_DSYNC writes, in which case we either use FUA if the device supports it, or we do a normal write followed by a cache flush. If there are metadata updates that the O_DSYNC needs to also flush, we don't use FUA by let the fileystem issue a cache flush in the most optimal possible after the write completes. Either way, using O_DSYNC DIO writes for streaming, sequential data is a really poor choice for an application to make. Normal DIO writes followed by fdatasync() to flush the metadata and caches once will be much faster and far more efficient than a metadata and cache flush after every single data write, FUA or not. -Dave. -- Dave Chinner david@fromorbit.com