Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2236808ybl; Thu, 29 Aug 2019 05:38:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqyPhm3FZcsBVD8TIa6dUyzIPCIXx4nehJBymoN19sN+4qCQe4KQn3PEW07xo5VJeE7VIEZN X-Received: by 2002:a62:1a45:: with SMTP id a66mr11446673pfa.142.1567082332043; Thu, 29 Aug 2019 05:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567082332; cv=none; d=google.com; s=arc-20160816; b=TrJ2x9+pUCZhr87lAWimvpAK3oBUb5vG2EOZnN5BmCZvd3Og57ByqHWlRSCi6GDWAK 3TgPBvdcTTfLiNRKAA/wz3+znm7uX/1UBDW430dUid+vr41NZuYz+GE82+n5AjPEJ//T Obyg/n0nBXMm/eQqTsU8EGh1uNbttp6iCB3vRMIQvJUI0RAJ9PIp9o43Zc2BCx4U1FNC 8AERm0cNUkQigU1DI36qpVQ8/fiDNgJx1tNMHmSBrdEUCqJ92K1hGISbTh7F9agYaUx6 W0+HqN5ueSHMvLQlR4ofdHbS/cWGeU4tCkQSMc39FkpRhy7fDThd2gLv+6gVhS2qe6LR GfZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=oTz0oXA3ycEi+ufFCwBSjHdKC3C7hc5UjQSIvBRtSYc=; b=PLUix08qPn0XG9Kz+gcO/ZZhRokiPzOvgK1dFB4KeVooil1qkAkha18infacLVVdiv XvjRLJQp8+r7Z0IAjCUNeeMmEMkNSQ1dfuxPw3Fz6Fekuo8Btj2aibX3x2X2fXoUxWMt nrPiyPALAh6r+orw0vtmLYeH33bHtYl7pYWyg+hm1ptDdnV679mACCRb4HPxRlLAuIT4 d+vNQ2Da+YK+9OOsd5H81AF/2Ibf/8brm9VF6WBpREqG9yqEm/Oo7n1cd73yu8XxqLyM pfAFtuABOCBTspRMn6h/3H3dmI5j45Ibi4wpIYOBDaRXLA11Jmu93dz0XOtmNZIFwMGF 5z3w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o132si2472712pfg.249.2019.08.29.05.38.30; Thu, 29 Aug 2019 05:38:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726852AbfH2Mi2 (ORCPT + 99 others); Thu, 29 Aug 2019 08:38:28 -0400 Received: from mx2.suse.de ([195.135.220.15]:39984 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725782AbfH2Mi2 (ORCPT ); Thu, 29 Aug 2019 08:38:28 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2F114AC67; Thu, 29 Aug 2019 12:38:27 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 2A8601E3BE6; Thu, 29 Aug 2019 14:38:25 +0200 (CEST) Date: Thu, 29 Aug 2019 14:38:25 +0200 From: Jan Kara To: Matthew Bobrowski Cc: Jan Kara , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, tytso@mit.edu, riteshh@linux.ibm.com Subject: Re: [PATCH 4/5] ext4: introduce direct IO write code path using iomap infrastructure Message-ID: <20190829123825.GB22939@quack2.suse.cz> References: <581c3a2da89991e7ce5862d93dcfb23e1dc8ddc8.1565609891.git.mbobrowski@mbobrowski.org> <20190828202619.GG22343@quack2.suse.cz> <20190829114515.GB2486@poseidon.bobrowski.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190829114515.GB2486@poseidon.bobrowski.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu 29-08-19 21:45:17, Matthew Bobrowski wrote: > > > @@ -3581,10 +3611,10 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length, > > > iomap->type = delalloc ? IOMAP_DELALLOC : IOMAP_HOLE; > > > iomap->addr = IOMAP_NULL_ADDR; > > > } else { > > > - if (map.m_flags & EXT4_MAP_MAPPED) { > > > - iomap->type = IOMAP_MAPPED; > > > - } else if (map.m_flags & EXT4_MAP_UNWRITTEN) { > > > + if (map.m_flags & EXT4_MAP_UNWRITTEN) { > > > iomap->type = IOMAP_UNWRITTEN; > > > + } else if (map.m_flags & EXT4_MAP_MAPPED) { > > > + iomap->type = IOMAP_MAPPED; > > > } else { > > > WARN_ON_ONCE(1); > > > return -EIO; > > > > Possibly this hunk should go into a separate patch (since this is not > > directly related with iomap conversion) with a changelog / comment > > explaining why we need to check EXT4_MAP_UNWRITTEN first. > > But wouldn't doing so break bisection? Seeing as though we needed to > change this statement specifically to accommodate for the weirdness > being returned from ext4_map_blocks()? i.e. map.m_flags being set to > either of the following: > > - (EXT4_MAP_NEW | EXT4_MAP_MAPPED) > or > - (EXT4_MAP_NEW | EXT4_MAP_MAPPED | EXT4_MAP_UNWRITTEN) > > So, if we left the statement in its original form, we'd allocate > unwritten extents but never actually get around to converting them in > ext4_dio_write_end_io() as IOMAP_DIO_UNWRITTEN would never be set? By splitting into a separate patch, I meant that patch would go before this one. Original code in ext4_iomap_begin() never called ext4_map_blocks() with a set of flags that can return with both EXT4_MAP_MAPPED and EXT4_MAP_UNWRITTEN set so that patch would be a no-op but would fix that landmine you tripped over. Honza -- Jan Kara SUSE Labs, CR