From patchwork Mon Jun 24 14:03:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liuhzy X-Patchwork-Id: 13709551 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C75220330; Mon, 24 Jun 2024 14:03:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719237829; cv=none; b=Qhk/FgrtPSKn6aYMt1v0d7EktdTcX7Wk8kRe3qJiu8WHsd8PAhgiM/vtNBx+vHqHN/OfFvBvocFjLy2r0dP4OLqqbIDazEa58HahihuckDFjeymd8eE8IW8t/iHGF3mgMsJmlCu87yci2Ub5+mbf4q0KMwJCixpxQruGmKqc2l8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719237829; c=relaxed/simple; bh=cw6zbc293MdZHDKZhsU4MwSfLSAyulD6cdKbVuCr9ic=; h=MIME-Version:From:Date:Message-ID:Subject:To:Cc:Content-Type; b=teqw4kCB8pIjZK/GhYjMo246at6rHCbuHI/GzTTKq3umer29MHBS+Br+fPd0ZpvtknrWa8kXvq+XHjiurBVdY+EHfzJfzms69GdDrLsq87TbiQ1bU4xZiEnhAi3JyS0GFgoWd08pi/wbBegIcsceaypLySO/h2tH/XZvTG+dwKQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZLECuc31; arc=none smtp.client-ip=209.85.222.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZLECuc31" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-79767180a15so257141985a.1; Mon, 24 Jun 2024 07:03:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719237827; x=1719842627; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=tRXqOoKCMQtByqtH5Ot9WPtr7SGsctCRaNE8KRf/9oM=; b=ZLECuc31budP5cOx1iPyAiM3acbPXvmjDSW/JvnwRCmEirrXCTHApLTeBAEWPEzNKy MI1kU0r7dy2oq1pP8mBITxSzkx65V6K+2CblcelzcoVD5vkAet/M/nQf8r9WLwNwUW0+ NvhDpYcfGa94h8NjOtnTNAGLdW9k7pm4a7/y8kwLh8HH2Og2dgB2oNNVYzj1ZiBKhISm Z9PuiMM7QDVB+YCWbIce8te8f/fxSbCBj4VVS8lcTNVJ8mfS6hTr+6fyLjeUGh4D6TVi ukyDFlEJCZBvWXDWJoPMWur5TrzIiCK/lwqQf7YcRYOyO/Gcfh33vX1rfE2UZgMVRlSU rInw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719237827; x=1719842627; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=tRXqOoKCMQtByqtH5Ot9WPtr7SGsctCRaNE8KRf/9oM=; b=JDQcsF+XdBszGA3djiigt/sWoS2KtKV+9Th2zVzLI6PE3c+pWO8bb6K1VgcdmxLIFy J1MHjIdxiR6hQbADs4LK1Jx6d41CUc77AgvKYUTtCWYJB31nv6m4KNokWl2OYOkp6gHw Y9QL8rih1Y4rFRUP1qAfmjetVnOCCY1aVAf+zK65HS42j7V1Pvrqwe5/yxk6y6sdObau qbI39Er9nFUSBuXVhZwrraCiY+pYHHcuUd1LUKSExvzmVNOaT7BNK9StkpnbqqLDdd+j lizXlrjqA2mKLT9Pl58D/euVGltaLW9fWj6uUUijeJVMPxtJbBl+UqbEW1u94IfWZrEZ kvRg== X-Forwarded-Encrypted: i=1; AJvYcCXQGpszk/3Nj+B7nDRP+7DVwvlagqTInVhzSCKAWOs0MeEYIlwpD5U7y4Qrtw0V/o8tFRMYtBjaJNb/AKLzHXdZXJDrns3v4Q/3Z8rr X-Gm-Message-State: AOJu0YxL9Bro1QR9x4OqbrJPoV5P7hBQZkrs31+XCNh7pJNYcHGHC+gg V/HE1xX2cpf42we8cMjggwtKV+yDz+I9C9GAq5fDh+qT66RnjvlEu8PG1ddllK60BToRbzEpcZJ AJcYIKAJJES5R72LRSlKjHm1rHLw= X-Google-Smtp-Source: AGHT+IEdcoVxO1iJxjpGg3jTYzJTgcSXIua8qNrQ7mS+EU2FQUAErqljhrmqVXaLvoKOQJOgOd5Y6nj9inRAE2YuGVM= X-Received: by 2002:a05:620a:454a:b0:79b:f3a3:9f38 with SMTP id af79cd13be357-79bf3a3a13bmr257427185a.20.1719237826730; Mon, 24 Jun 2024 07:03:46 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: liuhzy Date: Mon, 24 Jun 2024 22:03:42 +0800 Message-ID: Subject: NFS-AIO-doesn-t-require-revert-iterator To: trondmy , anna Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org From 58d1c971b2d42871441e887e3ec4a5a21c83aa95 Mon Sep 17 00:00:00 2001 From: liuh Date: Mon, 24 Jun 2024 17:49:08 +0800 Subject: [PATCH] NFS: AIO doesn't require revert iterator For AIO, nfs_direct_wait return -EIOCBQUEUED would be excepted. 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 bb2f583eb..262769dae 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -471,7 +471,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; } @@ -1030,7 +1031,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; }