From patchwork Thu Jul 4 00:40:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liuh X-Patchwork-Id: 13723099 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 2009523AD; Thu, 4 Jul 2024 00:55:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720054527; cv=none; b=Ufmbalm2FkBmL735sqdFdQUCUCnwLlr9hdQKunHlkc92mVavIeDkq4XT5/ozc5d2s5R1GjhuvSDtm6FRZVwqobkBwnCxM1f2g0EsZ/BXuA4Qopq3Tn8JFoBSkEeiNpy8VbDzby/KbFOU9XwX3OcP/XTNlNQNS1u02tjE7wAqq0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720054527; c=relaxed/simple; bh=axQyEzblYvbHETJ0gbmBRA+rd+VfcEu1m3BvOP9jEHI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=SgCsofL7ZK5uFajvTGBAvvNy5ihNTz3UAgumYTRRh0t0wXFwEgTGOzmitiZvWaruCvv1dM2fqkRd7Hz2/JMKReLURBq6Q9yDc8f7c1kf55b91jntjTmKP0GQIyndDReL7umTXcUNqQVsPGdoh1j+D9RWpP1gLW8NwAwDZ6/Wl+k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: db2219da399d11ef93f4611109254879-20240704 X-CID-CACHE: Type:Local,Time:202407040836+08,HitQuantity:1 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.38,REQID:609fb93d-499c-441d-bd66-d59e0adbce4c,IP:0,U RL:0,TC:0,Content:0,EDM:-30,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-30 X-CID-META: VersionHash:82c5f88,CLOUDID:d57457d2ed1d8ecb447419be162a7b40,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:2,IP:nil,URL:0, File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:N O,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: db2219da399d11ef93f4611109254879-20240704 Received: from node4.com.cn [(10.44.16.170)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1909068126; Thu, 04 Jul 2024 08:39:22 +0800 Received: from node4.com.cn (localhost [127.0.0.1]) by node4.com.cn (NSMail) with SMTP id E46EB16002082; Thu, 4 Jul 2024 08:39:21 +0800 (CST) X-ns-mid: postfix-6685EF39-6795893 Received: from localhost.localdomain (unknown [172.29.156.133]) by node4.com.cn (NSMail) with ESMTPA id 649E916002082; Thu, 4 Jul 2024 00:39:21 +0000 (UTC) From: liuh To: trondmy@kernel.org, anna@kernel.org Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, liuh Subject: [PATCH] NFS: AIO doesn't require revert iterator Date: Thu, 4 Jul 2024 08:40:02 +0800 Message-ID: <20240704004002.5787-1-liuhuan01@kylinos.cn> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 For AIO, nfs_direct_wait return -EIOCBQUEUED would be expected. Revert iter is redundant. Signed-off-by: liuh --- fs/nfs/direct.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 90079ca13..1483f1965 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -469,7 +469,8 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter, requested -= result; iocb->ki_pos += result; } - iov_iter_revert(iter, requested); + if (is_sync_kiocb(iocb)) + iov_iter_revert(iter, requested); } else { result = requested; } @@ -1028,7 +1029,8 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter, /* XXX: should check the generic_write_sync retval */ generic_write_sync(iocb, result); } - iov_iter_revert(iter, requested); + if (is_sync_kiocb(iocb)) + iov_iter_revert(iter, requested); } else { result = requested; }