From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97D01CCA489 for ; Wed, 8 Jun 2022 06:50:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232335AbiFHGpE (ORCPT ); Wed, 8 Jun 2022 02:45:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241217AbiFHGTp (ORCPT ); Wed, 8 Jun 2022 02:19:45 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AC6EC32 for ; Tue, 7 Jun 2022 23:16:21 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 5D8B467373; Wed, 8 Jun 2022 08:16:18 +0200 (CEST) Date: Wed, 8 Jun 2022 08:16:18 +0200 From: Christoph Hellwig To: Al Viro Cc: Christoph Hellwig , linux-fsdevel@vger.kernel.org, Jens Axboe , Matthew Wilcox Subject: Re: [PATCH 2/9] btrfs_direct_write(): cleaner way to handle generic_write_sync() suppression Message-ID: <20220608061618.GA7532@lst.de> References: <20220607044217.GB7887@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Tue, Jun 07, 2022 at 04:06:53PM +0000, Al Viro wrote: > > Also the FUA check below needs to check IOMAP_DIO_NOSYNC as > > well. > > Does it? AFAICS, we don't really care about REQ_FUA on any requests - what > btrfs hack tries to avoid is stepping into > if (ret > 0 && (dio->flags & IOMAP_DIO_NEED_SYNC)) > ret = generic_write_sync(iocb, ret); > with generic_write_sync() called by btrfs_do_write_iter() after it has > dropped the lock held through btrfs_direct_write(). Do we want to > suppress REQ_FUA on the requests generated by __iomap_dio_rw() in > that case (DSYNC, !SYNC)? Confused... Yes. FUA is an used an an optimization so that we can avid the generic_write_sync or similar call if a O_DSYNC write doesn't need any metadata update. If the caller already does the generic_write_sync equivalent we don't also need FUA. It is not actually harmful in that it gives worse results, but it will kill performance.