Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp3836433rwe; Mon, 17 Apr 2023 04:25:34 -0700 (PDT) X-Google-Smtp-Source: AKy350ZGuYfUXy9K0QFBjWjOrum606U8FOQuJ2ygd1W81/jT8La/6+Iis0uBb33keH1Z1ESasIaq X-Received: by 2002:a05:6a00:8c6:b0:638:13ab:b0a9 with SMTP id s6-20020a056a0008c600b0063813abb0a9mr22141020pfu.24.1681730734154; Mon, 17 Apr 2023 04:25:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681730734; cv=none; d=google.com; s=arc-20160816; b=FBxbtJjpm8yxBjrZUx2X2VeqW1xtRRMFBDtO5bImlj5ukzdNuJ239hHPOIwlLEgO9y DhD6JrtSKniRfkmm7oekoi8B7gHNbRDpHaCOnT/jQc8KxGrb8a233CqTjzxHZcW49iwz jruDWfqHAMUuQkICWMSWOalHZIxtZxOBb2kgZl87bBNDAlBQzMobYeCu3Mv/werrbeSO 0w5D514GpkO70eHGhhFPe2B6axsxGlhu+KW7QbHShwO1/V4GHxXA1EsHbASsn0PEvDYY K9mHXVznAMZj4k06wXSJFM9FcrXUog8y83iaJZd6CmR6cELXpiOiRhphf7zr00JzRJKq rmnw== 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:dkim-signature :dkim-signature; bh=3F04YQpv1Md30jtqy0Oglxh4z17ZP+EH21Z95JtSL38=; b=FWdQKff9GZS4eLp4l+AXcJXBhxIeKSdFI1BQ+aCTG1/qJOeRGXLpnO8wbIKydimZWx fIBJZaQetaEh2NyKN7/YgQ2HDX07Wsn/FaVr+pf3cx9wHxr00oQgEPssUJaADT+ebagf HlgJriJqK3uuQGuzRR02eDkCLg1hmE1BMRfGwa+IinMAMHVEVAWnqfUe5rDkCuPjscgm v8bYGHzLb9drLo3UXbVZKaWv2yRI17980y9PzUaE6cmqOQTWizdHGQ5+isDHRQ+rc2Vk F4e9/nERm/fG1XqF6CEm9rfr2EPHLgZjrcwaEXghX3ZjdUvJl+n/NXNliDBy0uz52epD WsHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=u+dgpkII; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w30-20020aa79a1e000000b0063b8cd70801si3157209pfj.264.2023.04.17.04.25.18; Mon, 17 Apr 2023 04:25:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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=@suse.cz header.s=susede2_rsa header.b=u+dgpkII; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230173AbjDQLWM (ORCPT + 99 others); Mon, 17 Apr 2023 07:22:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229740AbjDQLWL (ORCPT ); Mon, 17 Apr 2023 07:22:11 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE67198; Mon, 17 Apr 2023 04:21:20 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0D15A210EB; Mon, 17 Apr 2023 11:20:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1681730407; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3F04YQpv1Md30jtqy0Oglxh4z17ZP+EH21Z95JtSL38=; b=u+dgpkIIfIUozJvgMax+zkuKkyoK4ujNbrhrELb9q3qz+pb1d6KAhEgnYR/r/d7suNGNVV Lj4wJuDn2Vl1Znh+SK25532X4r8BWXlesoe18ZbEc/vXj6aoEMS7vti6h2ffuH+nQzXAKw EIbiDYJQ01+Si9R8oYapaHSRwt6RGcs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1681730407; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3F04YQpv1Md30jtqy0Oglxh4z17ZP+EH21Z95JtSL38=; b=tRRMTDRXDRVFOglApyqyELMikZiUn+3m3X+RtYQaVuF4xL4wjqRQ6eIeTrIxw64tXVS5Jq aq/qILreugaGANDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F396E13319; Mon, 17 Apr 2023 11:20:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cTBdO2YrPWRQIwAAMHmgww (envelope-from ); Mon, 17 Apr 2023 11:20:06 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 879B8A0744; Mon, 17 Apr 2023 13:20:06 +0200 (CEST) Date: Mon, 17 Apr 2023 13:20:06 +0200 From: Jan Kara To: "Ritesh Harjani (IBM)" Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, Jan Kara , Christoph Hellwig , "Darrick J . Wong" , Ojaswin Mujoo , Disha Goel , Christoph Hellwig Subject: Re: [PATCHv5 5/9] ext2: Move direct-io to use iomap Message-ID: <20230417112006.3bzzitsxy67jpviq@quack3> References: <20553b1a61760dc6a7451e3b4fc9ba76653e6eb0.1681639164.git.ritesh.list@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20553b1a61760dc6a7451e3b4fc9ba76653e6eb0.1681639164.git.ritesh.list@gmail.com> X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE 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-ext4@vger.kernel.org On Sun 16-04-23 15:38:40, Ritesh Harjani (IBM) wrote: > This patch converts ext2 direct-io path to iomap interface. > - This also takes care of DIO_SKIP_HOLES part in which we return -ENOTBLK > from ext2_iomap_begin(), in case if the write is done on a hole. > - This fallbacks to buffered-io in case of DIO_SKIP_HOLES or in case of > a partial write or if any error is detected in ext2_iomap_end(). > We try to return -ENOTBLK in such cases. > - For any unaligned or extending DIO writes, we pass > IOMAP_DIO_FORCE_WAIT flag to ensure synchronous writes. > - For extending writes we set IOMAP_F_DIRTY in ext2_iomap_begin because > otherwise with dsync writes on devices that support FUA, generic_write_sync > won't be called and we might miss inode metadata updates. > - Since ext2 already now uses _nolock vartiant of sync write. Hence > there is no inode lock problem with iomap in this patch. > - ext2_iomap_ops are now being shared by DIO, DAX & fiemap path > > Tested-by: Disha Goel > Reviewed-by: Christoph Hellwig > Signed-off-by: Ritesh Harjani (IBM) One comment below: > @@ -844,6 +868,13 @@ static int > ext2_iomap_end(struct inode *inode, loff_t offset, loff_t length, > ssize_t written, unsigned flags, struct iomap *iomap) > { > + /* > + * Switch to buffered-io in case of any error. > + * Blocks allocated can be used by the buffered-io path. > + */ > + if ((flags & IOMAP_DIRECT) && (flags & IOMAP_WRITE) && written == 0) > + return -ENOTBLK; > + > if (iomap->type == IOMAP_MAPPED && > written < length && > (flags & IOMAP_WRITE)) Is this really needed? What for? Honza -- Jan Kara SUSE Labs, CR