Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1588246lql; Wed, 13 Mar 2024 02:24:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUBXTeVAtrbOCnjqwtntijrJYRP4LeFD/vuwHpyTUFeynz+bTBtgIwgUqmwgPLahIhzTmZ1dPnoWl147eeYWYbzLS0aJelJ+plcHMTgzg== X-Google-Smtp-Source: AGHT+IHoZwgeAmN6l2d+jF6/r2Rt1cLLGMX62WXMBKesh3vWhX/xXaJG4qUuJQ3CY1TWnWVnkZGZ X-Received: by 2002:ad4:470a:0:b0:690:ad27:bc77 with SMTP id qb10-20020ad4470a000000b00690ad27bc77mr2852421qvb.28.1710321845212; Wed, 13 Mar 2024 02:24:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710321845; cv=pass; d=google.com; s=arc-20160816; b=CeGvU0m18pHw/06l3gNUMaQvyWbOQOPO8z9WIvIXlpDv9Kben6WQdlGzbN8hKMfnmM Keh4STirpotZx+66VNu3hwMc/jSn/hSZBCvSxnvOaLHFvn1fOiw8iewrBTY0G+S9EYm0 Y9DWK2cgglbDEISn0kXossLLgfMFOqZmFqiPgzZwkxmjUkSuBNXJLjRuFd6DQBkiRRvd WRCPLAs5cIw+yWPAqHnbao7nBJLMJ3IcVKN9rOhWamqZji2ZBUL2k3/m0NLN8tlq0j03 NbmVdMP5WjhiPmLY7zaLledfdI9WQBkpdmxqvhBrgT94ZSlMKuaMf8/42xLT/dHL2dGT gi0w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject; bh=Hs7DyznGYGR+VA3sLVl0WNGLcoWZssYRbKsietSbQMQ=; fh=uqEzQys8QS9sJ9xSO/NQchXnPvlt5MiDaufk1Ea68jc=; b=GKESOu4ck6P52bRF02Sem5YnTF0UEvhbnmKkM6/iF8c5EDRaYeaIv1URCe/45GZDX2 dylroDxG3qXXUMxJq2qEwQ2DX1FKuIu/etrH5H1M/gntH82DBlgFDSEa9cXuUMaZcLIU jCRwqskBFX+bPufx4Ao09Gx6Gw165b3yGSXVpC7u2EunMqoawNsoOxEA7LQiRVgyJDcU AacSnEEf4pMcqa6k9W2LGsmcf5K/yEkuDszflvt7JkJVFmFNbF8nfuY13B0wAzw32Cw9 vcKfv1F6+VAqM+kr/LmmIPXXHe9Sn3Q6QGXatnlPHwJ1RN7YcGqeEZT09i1w/3by4Tk/ 9sTQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-101273-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101273-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 4-20020a0562140cc400b0068fc83c08a3si6266477qvx.356.2024.03.13.02.24.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 02:24:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101273-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-101273-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101273-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B2A331C21C64 for ; Wed, 13 Mar 2024 09:24:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC1D520B2E; Wed, 13 Mar 2024 09:23:52 +0000 (UTC) Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4212A17580; Wed, 13 Mar 2024 09:23:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710321832; cv=none; b=TGAp13ECqg9HE7jDiWLYbfFfgBxR4G9G7KwMSuZpjFzK4IxSL4JDJ7Y+gmOyAgZUFMCfKWToAsOFilIL9VtWR4Hvm6iw9bhQKM1hoSIxV2MbvAshJBOjLdjMk0pAAmdhZvSb7I0nKqKGReKT1FYtkxB5I+V0JaUX2CKFD/GGxHs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710321832; c=relaxed/simple; bh=DUWA95OUQZ4tb1g6/fDurLWTmlYD9hTjPojdeFcqTrI=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=V+uxRjb9QHAFDMd+WiLd7OOTGpOLyA09a7wD/7qQ12zcpN0xOpMFIZVJ8XqFFCycGa2IVO+vJM9+IBhGJ6AsvbBblnvc/clZTs5ItbnYyil/Jq4ulHZTyuIbDiL8be9DSzkFsp++rqyZC+ZoMASsN7c6X4CfydvAvm7EIWrEWFE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4TvlS50Vrfz4f3pHc; Wed, 13 Mar 2024 17:23:33 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id C108F1A019F; Wed, 13 Mar 2024 17:23:40 +0800 (CST) Received: from [10.174.176.34] (unknown [10.174.176.34]) by APP1 (Coremail) with SMTP id cCh0CgAn9g6acPFlcbg_Gw--.27770S3; Wed, 13 Mar 2024 17:23:40 +0800 (CST) Subject: Re: [PATCH 4/4] iomap: cleanup iomap_write_iter() To: "Darrick J. Wong" , Christoph Hellwig Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, brauner@kernel.org, david@fromorbit.com, tytso@mit.edu, jack@suse.cz, yi.zhang@huawei.com, chengzhihao1@huawei.com, yukuai3@huawei.com References: <20240311122255.2637311-1-yi.zhang@huaweicloud.com> <20240311122255.2637311-5-yi.zhang@huaweicloud.com> <20240311160739.GV1927156@frogsfrogsfrogs> <20240312162729.GD1927156@frogsfrogsfrogs> From: Zhang Yi Message-ID: <72683844-f2df-9773-bfb8-7dc2bff76272@huaweicloud.com> Date: Wed, 13 Mar 2024 17:23:38 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240312162729.GD1927156@frogsfrogsfrogs> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CM-TRANSID:cCh0CgAn9g6acPFlcbg_Gw--.27770S3 X-Coremail-Antispam: 1UD129KBjvJXoW7try3GFWkurW3GF15KFW3Jrb_yoW8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rote: > On Tue, Mar 12, 2024 at 05:24:00AM -0700, Christoph Hellwig wrote: >> On Mon, Mar 11, 2024 at 09:07:39AM -0700, Darrick J. Wong wrote: >>> If at some point iomap_write_end actually starts returning partial write >>> completions (e.g. you wrote 250 bytes, but for some reason the pagecache >>> only acknowledges 100 bytes were written) then this code no longer >>> reverts the iter or truncates posteof pagecache correctly... >> >> I don't think it makes sense to return a partial write from >> iomap_write_end. But to make that clear it really should not return >> a byte count by a boolean. I've been wanting to make that cleanup >> for a while, but it would reach all the way into buffer.c. > > For now, can we change the return types of iomap_write_end_inline and > __iomap_write_end? Then iomap can WARN_ON if the block_write_end return > value isn't 0 or copied: > > bool ret; > > if (srcmap->type == IOMAP_INLINE) { > ret = iomap_write_end_inline(iter, folio, pos, copied); > } else if (srcmap->flags & IOMAP_F_BUFFER_HEAD) { > size_t bh_written; > > bh_written = block_write_end(NULL, iter->inode->i_mapping, > pos, len, copied, &folio->page, NULL); > > WARN_ON(bh_written != copied && bh_written != 0); > ret = bh_written == copied; > } else { > ret = __iomap_write_end(iter->inode, pos, len, copied, folio); > } > > ... > > return ret; > > Some day later we can circle back to bufferheads, or maybe they'll die > before we get to it. ;) > It looks great to me for now, we can revise iomap first. Thanks, Yi.