Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp730934ybp; Wed, 9 Oct 2019 03:22:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxTZwodj4f7usDNuMSl+3d7m9cdg41YG2FEe3mlFRS2lnFVa+DseObqHXmo4wb9xHsT6Olw X-Received: by 2002:a05:6402:886:: with SMTP id e6mr2253425edy.152.1570616574057; Wed, 09 Oct 2019 03:22:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570616574; cv=none; d=google.com; s=arc-20160816; b=s8Raq5ZZcaVF4wNJrmL0h1OhFvuC1Rhyj5cW3FieKlZF3Pa2Q70Hm56ripvBPka+Ni CUdqu41ny+WUxqDTzlXZ9TN9bowCwWP94MigiAKmZhOZ3UFEmMABcQHfU0JKQ09VvUg7 WxU+bxuPLHl3x/IzP+LfmMbjZMkFzSzUVjR3Z/Acg3PoagUIJAeCw5C14yU0vD6y1MKt st8dgpqHmI4TTFx/OPaJfNm7tbUZ+BqtcTXIpFYebIpJa9oJC0jTCMUXN9aa3itvb1ce Rbx9jO7drcQ8ETDOpflliBA4F6Rg0SUR+oZUtHnwPfCTmjpGF2+xZHmkZp+EfVSj3Ptg cARg== 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:dkim-signature; bh=oIq9HQZybaT5LehXQ1gvS/VSaj5oLWiEUpcMmo+ewr0=; b=DWnJtpWvPZQGYwC69OMbTLcNH3zZ0kNVjzN/qgDaF4wNfLHEk60BHQItcXj8E6SfgF CO7cpAzuaBuaK9h3f/qH/RB6iwva3yvrJxX0fJCUqOiENupKfmXVSygyOivlSaUgX7iC YMt4NyWmQcHaiM2gol9xMxFuqWZ4uSinYxM7tckz0KHZRfWQS7MYIQy/dC6nyDhb19KH 0ZT8As4ZRhBPMiCDhMGWR/ssudoZzTx6EzVjmWOftg/nY/7dd/Wwbilgbao+Lk4xi2eY vTG85KNLS6kE8oCynqCB1ZU4sCwEmVelmw0vmqVFQ4TLhK8XOcrWiZqQ7wwyfZOpIPiP hlxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mbobrowski-org.20150623.gappssmtp.com header.s=20150623 header.b=t3LR45cp; 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 v13si893439ejx.304.2019.10.09.03.22.30; Wed, 09 Oct 2019 03:22:54 -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; dkim=pass header.i=@mbobrowski-org.20150623.gappssmtp.com header.s=20150623 header.b=t3LR45cp; 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 S1730069AbfJIKS6 (ORCPT + 99 others); Wed, 9 Oct 2019 06:18:58 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:39897 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729457AbfJIKS6 (ORCPT ); Wed, 9 Oct 2019 06:18:58 -0400 Received: by mail-pf1-f195.google.com with SMTP id v4so1329553pff.6 for ; Wed, 09 Oct 2019 03:18:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mbobrowski-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=oIq9HQZybaT5LehXQ1gvS/VSaj5oLWiEUpcMmo+ewr0=; b=t3LR45cpQr9PWFRAeblcjOXZBnUalUgBZaWvg19Jnd1Xnbi41tiTReJLZKojg5eCwX nVTY9L95yzQvECrDUL5br95AHxrEk4wfE4JjqJpdWLr4IidpHTJ28klWZRpiX03K0qSF kscq5bP9qS/sKD+kWNwvO/2USWAR61MQRYFwnq4BSIOr0gx+FSfbTavDRo4QqG3+XkCO gkxz+FD366lThYcbtsyjOcLd2oypHSafKAO8/TpRfSibDqd85ga1omYj4CqjJ8R5vtsa wKFpYA+6hXdri5AIj54ER5qkS2avvveUnEucgPx6cDFkcOhjqgRaHDkI3KGGtch9Tyjy I8eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=oIq9HQZybaT5LehXQ1gvS/VSaj5oLWiEUpcMmo+ewr0=; b=q8+r47bmXQyNHpdAZYP9Cu/+1DRhqWWhpkDpmqVEvNknXvrOM4QccXGKJeYixdJ/cr gHfp1p/pDM2KR062IWUw+fldhphST5ziS40t+uqL5UAoXhNVthkS/mWZHWFcgMxMSVwX ll193OxBVWBkRp3cwAq0BN2Hm6TkgZadxwIiXCaSab4T/OS7Lq4pbqdgEUIl8axkV471 TQTXj0EBoLgbfT5of90RXiSdj3BkxOSPZuNc38qFA7k27pnjTUOfZOcoXeIqxK7U2/pH 3bN7m+0oy1IMxoLDis1c4kRGHmdBoPeGRyKg1ubzWqTkthp3xJ3h2L0mVoi8MeosCMo+ 5uBw== X-Gm-Message-State: APjAAAXMyggn1XyyXpKbXY/RaHhZBx868kPe1BVoi61ROoIYiaXzBFpc 63sJvAPBpQTEiN0TbVSrI3IM X-Received: by 2002:a65:640a:: with SMTP id a10mr3382479pgv.270.1570616337111; Wed, 09 Oct 2019 03:18:57 -0700 (PDT) Received: from poseidon.bobrowski.net ([114.78.226.167]) by smtp.gmail.com with ESMTPSA id h14sm1808500pfo.15.2019.10.09.03.18.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2019 03:18:56 -0700 (PDT) Date: Wed, 9 Oct 2019 21:18:50 +1100 From: Matthew Bobrowski To: Jan Kara Cc: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, hch@infradead.org, david@fromorbit.com, darrick.wong@oracle.com Subject: Re: [PATCH v4 5/8] ext4: move inode extension/truncate code out from ->iomap_end() callback Message-ID: <20191009101848.GG2125@poseidon.bobrowski.net> References: <20191008112512.GH5078@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191008112512.GH5078@quack2.suse.cz> 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 Tue, Oct 08, 2019 at 01:25:12PM +0200, Jan Kara wrote: > On Thu 03-10-19 21:34:18, Matthew Bobrowski wrote: > Looks good to me. Fell free to add: > > Reviewed-by: Jan Kara Thanks Jan! > Just small nits below: > > > +static int ext4_handle_inode_extension(struct inode *inode, loff_t offset, > > + ssize_t written, size_t count) > > +{ > > + int ret = 0; > > I think both the function and callsites may be slightly simpler if you let > the function return 'written' or error (not 0 or error). But I'll leave > that decision upto you. Hm, don't we actually need to return 0 for success cases so that iomap_dio_complete() behaves correctly i.e. increments iocb->ki_pos, etc? > > + handle_t *handle; > > + bool truncate = false; > > + u8 blkbits = inode->i_blkbits; > > + ext4_lblk_t written_blk, end_blk; > > + > > + /* > > + * Note that EXT4_I(inode)->i_disksize can get extended up to > > + * inode->i_size while the IO was running due to writeback of > > + * delalloc blocks. But the code in ext4_iomap_alloc() is careful > > + * to use zeroed / unwritten extents if this is possible and thus > > + * we won't leave uninitialized blocks in a file even if we didn't > > + * succeed in writing as much as we planned. > > + */ > > Whitespace damaged here... I'll fix this. ----