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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2A0DC433EF for ; Thu, 23 Jun 2022 20:32:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8DE768E018F; Thu, 23 Jun 2022 16:32:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 88E538E0187; Thu, 23 Jun 2022 16:32:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 77DA38E018F; Thu, 23 Jun 2022 16:32:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 6A1188E0187 for ; Thu, 23 Jun 2022 16:32:12 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 4170660501 for ; Thu, 23 Jun 2022 20:32:12 +0000 (UTC) X-FDA: 79610647704.20.890B4B3 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf18.hostedemail.com (Postfix) with ESMTP id D26E41C0094 for ; Thu, 23 Jun 2022 20:32:11 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C2D39B8253E; Thu, 23 Jun 2022 20:32:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C1DFC341C0; Thu, 23 Jun 2022 20:32:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656016329; bh=Clr2VKSEJiMP39AvV+ufw35sqUO2mGVCAlbFyCZMF84=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cAV4S2Ey/Bb99XrMESIg7GqUjLxCEVunSVQ/EpY7iMGhE5pLQ8qqdsGpH/Y0GXk9Q MrlG8X8VYEp1GVmihq6kQGdPl/Xj6nClTXc1fTLzM/UcDH1KmujuDcXqsKwQQ6NShD f8/T6A00hHgGAk0phcB+iS3IBbRsc36iMjTV9ILXpFooO8P3+Gkk4yENJC62pfpane fN33EjeOjA2NOloy6gxYHk2Emsa6tBsYU0cD8lXAuXHibAK2KjJAiR9NN45kFrIVSD AnoxC7QgA34ouBbdbi1zR3qWiU8XOvlc42YVkUy7w5bjtHEgVmJ8NohNxK/9EVANOY NPl3mCNbxillw== Date: Thu, 23 Jun 2022 13:32:08 -0700 From: "Darrick J. Wong" To: Stefan Roesch Cc: io-uring@vger.kernel.org, kernel-team@fb.com, linux-mm@kvack.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, david@fromorbit.com, jack@suse.cz, hch@infradead.org, axboe@kernel.dk, willy@infradead.org Subject: Re: [RESEND PATCH v9 06/14] iomap: Return -EAGAIN from iomap_write_iter() Message-ID: References: <20220623175157.1715274-1-shr@fb.com> <20220623175157.1715274-7-shr@fb.com> <1f121d1e-8a50-5152-d984-c9299ced1491@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1f121d1e-8a50-5152-d984-c9299ced1491@fb.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656016332; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=SY5ei62iwQFHOuY2WGY7b2pZj2y0ErQVF4rX6URFf28=; b=gg04OdCandJAJwbeAoYbSGtLciHA00xjhOF8NSBu0fPt0+3NcqyYIf9y3bcCmc7ieItKZx dIkCoz2A459xuhjcNahYiC3ga54bfjYkY83D8Ai5++R59EQjNfU2zXMy2V7wFrUGZMtUsd H984OOoqLdoqHrG7ozG6jTnEfoFx7iM= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=cAV4S2Ey; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf18.hostedemail.com: domain of djwong@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=djwong@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656016332; a=rsa-sha256; cv=none; b=VLEu/V+qEmH9/1s8oRly0zxEMuoFfkIj7Ey5HhKJrvKNDHoErl/LWaRDX1vqu7Shr1WOS/ GqTR1OSwVWKQgiLy56Z4RqKC8kolT1zV5H3qynSt2a4OV/nOQBjLQoRo0ABysIgGNSloqh MNwrnPlT7ehp+HEBY177taunDec94Yc= X-Rspamd-Queue-Id: D26E41C0094 Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=cAV4S2Ey; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf18.hostedemail.com: domain of djwong@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=djwong@kernel.org X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 4wri63umtoxmhbds97qbi3ks4bue4wyi X-HE-Tag: 1656016331-619468 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000257, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Jun 23, 2022 at 01:23:02PM -0700, Stefan Roesch wrote: > > > On 6/23/22 1:18 PM, Darrick J. Wong wrote: > > On Thu, Jun 23, 2022 at 10:51:49AM -0700, Stefan Roesch wrote: > >> If iomap_write_iter() encounters -EAGAIN, return -EAGAIN to the caller. > >> > >> Signed-off-by: Stefan Roesch > >> --- > >> fs/iomap/buffered-io.c | 8 +++++++- > >> 1 file changed, 7 insertions(+), 1 deletion(-) > >> > >> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c > >> index 83cf093fcb92..f2e36240079f 100644 > >> --- a/fs/iomap/buffered-io.c > >> +++ b/fs/iomap/buffered-io.c > >> @@ -830,7 +830,13 @@ static loff_t iomap_write_iter(struct iomap_iter *iter, struct iov_iter *i) > >> length -= status; > >> } while (iov_iter_count(i) && length); > >> > >> - return written ? written : status; > >> + if (status == -EAGAIN) { > >> + iov_iter_revert(i, written); > >> + return -EAGAIN; > >> + } > >> + if (written) > >> + return written; > >> + return status; > > > > Any particular reason for decomposing the ternary into this? It still > > looks correct, but it doesn't seem totally necessary... > > > > Do you prefer this version? > > + if (status == -EAGAIN) { > + iov_iter_revert(i, written); > + return -EAGAIN; > + } > return written ? written : status; Yes, because it /does/ make it a lot more obvious that the only change is intercepting EAGAIN to rewind the iov_iter. :) --D > > > > Reviewed-by: Darrick J. Wong > > > > --D > > > >> } > >> > >> ssize_t > >> -- > >> 2.30.2 > >>