From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 E71A2379EF0 for ; Sat, 30 May 2026 22:20:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780179609; cv=none; b=WhlQ2r850X/cakXwf7eiic8Dt3DbYk4/D+/rN2yqFzaoH/A4hW5+eEld3yy4qVYPGmn7wepBM4jG0Lhd1eiq+ydH8jtXynLlcEpwDQ7+vr8EblvNQX35dUFIZ9K+2JD9q5wMk5N+RfHKo/L1PEPdNFRLnF1IlR1EaTNpzqsH7bM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780179609; c=relaxed/simple; bh=4TSPlN5o+JecYW1sd+ZzXQj8yAEreCv2H17czKFowr4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=rPnnM1JvR9Vj/O3SsHp4yjr7sJuRZb6yWfn9kj7b5YPesSo+AxZuqdohKzFnGDZCzPBxKMIt3yspj0slHJixXD3/w61LzAyiSyysl/sphXnWMgPHIb5KVtQwfeB0D4t823lYCQaOoJi5qC2Eg2xPhAmWDwS2fM+YfIWkaq16F/c= 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=oBGLyviT; arc=none smtp.client-ip=209.85.128.47 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="oBGLyviT" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4909e3fa4b2so16623645e9.0 for ; Sat, 30 May 2026 15:20:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780179606; x=1780784406; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=0Lsn3u4lBncf/2naAXkema/EpB2mW522r7UH8V++Vow=; b=oBGLyviTDtrrcoAMvYKo6bwpCL97ZKQHEdWZvjOGGdId1LaaVAfsH4TyeKwtXwcw/K uizDoK+wFtZ0hr5Xp6T3NX5MIUMeGm0lqRLqDPtsx43Fxwvf6k1oUEEDJd9QcXttc5sF c6PNbsC14QDGPfPfakPodXDsrGz334sxquMX+9C0tij+D3cQX6UO8pb6oTuBZtSAAGnU FprxaXyhjyGR+I0oy1VoiHqOE7dlRKkKjudj9pQ8cme+1lIDqFpc3+IW4Dij2uUCge21 wgjnS6GKkxUMhj2owln54WUxHkPMYAdfKjxzQAdbXkGIMJwvU2buv9wq9TKhI038penz 7N9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780179606; x=1780784406; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0Lsn3u4lBncf/2naAXkema/EpB2mW522r7UH8V++Vow=; b=Kf8mcbIR74WvJzYXdFXJfzD582+cAjyVeGI6UVbL4aaTO/Q0JqufjztecvpBUtqsoL fwfDcZ7wZsVPXFVjx9oCmgnKw0TNu4BpPeAlhNNAIWsAuHPIE6C+EQdEe+Y68w3wUDB2 rcs6Zxea+kFRBmLp/WupujoUcoZdDzsGqbpOlNZVVmN7TWCGqs/qemfV3ZZ36Tuikqxo DX/l1mMD4i1CmswOZROI0g+z1c0Q9wdX78ouZpzav9hPj+PIAWnFaaweo7eImF119izX 653Xjj5p5ct29rxO/cPgiynj4T2fOoNRlBebMzhAOglYBb80jDi1AlViwACS3stoDJHJ 0arg== X-Forwarded-Encrypted: i=1; AFNElJ8UUQgndkEHqdeCQSaiKXZ18w0isQuK32EWqktCRtV7BSongqEwTswjwvsHfVEXGQOTfsi8K04Sjk3iqSk=@vger.kernel.org X-Gm-Message-State: AOJu0YzSa2g54+FArVKHeaNuHx1pPZHHYLRIcWNa2ZXUsV+3Ybg3fy4M LuKW4QG/kjBzcbMI41wCZRB1NG7u1FZ2iO6RT/Xokx/UDA1Ys6aTrS8u+n4rA0Di X-Gm-Gg: Acq92OGL5m7+4pvoT2Iv3gQAEpaDR/n5xJjHOGCaBHqOlLRiLJGMAjSwZ3hAWPYOfvD dsmOuBlRZuvOYzWb/IsVIWGOaeTLhWbiAG8mgLKfzSWC4zW4gB9hngTe9nCC0D6THFmT67/Pe/5 iAm3JEw+c0MVkPGA46HUgEmFc2K5WjRnSppyeSIK/0piIzyyitgb6QUhgz6iNklZ0fhhJpfKtDa JRO4IShP6AVKCo2MRKDclt41WZYFqwItdRfksC2mUuvGWDqE1QomVW5mHtTX4XIAOTHLvBirHqK tMQlQLgfK+DDa30MPJGAY0vE1YIwCNsnIlL6SRbfSDLAVUyEimJHSCK/+ECjs4PgIiiIjTtQCtf SG0qKs4FPt/WBfrb+8m8n6kx1T0ii3i4Ombdnc4PpIGm34I2PtOBLPwI1IOlSU3cKXq0gEFz81F KvdLRThQ1Tp6etKVm5oLnoZSvL4CADc8p/PYAhhdeGOcPqi+5OYY7D X-Received: by 2002:a05:600c:190b:b0:48f:f64c:c2fe with SMTP id 5b1f17b1804b1-490a298f29amr87406325e9.22.1780179606187; Sat, 30 May 2026 15:20:06 -0700 (PDT) Received: from puck (234.243.199.146.dyn.plus.net. [146.199.243.234]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45ef354cd7csm13443784f8f.18.2026.05.30.15.20.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 May 2026 15:20:05 -0700 (PDT) From: Dylan Yudaken To: trondmy@kernel.org, anna@kernel.org, linux-nfs@vger.kernel.org Cc: axboe@kernel.dk, io-uring@vger.kernel.org, linux-kernel@vger.kernel.org, Dylan Yudaken Subject: [PATCH 0/2] nfs: support FMODE_NOWAIT on O_DIRECT reads Date: Sat, 30 May 2026 23:19:45 +0100 Message-ID: <20260530221947.49518-1-dyudaken@gmail.com> X-Mailer: git-send-email 2.50.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit I had noticed that io_uring always punts O_DIRECT NFS reads to a background thread since the file does not advertise FMODE_NOWAIT. I am not very familiar with the NFS codebase, but looking around suggests a simple change to nfs_start_io_direct is all that is required to properly support this functionality. On the request issue side, it seems everything in NFS is actually run in the background (post this lock change), and the completion codepaths all look to have no similar locking semantics. I unfortunately do not have the means to test the performance improvement, since even without this change my local network is the bottleneck here. However I do suspect that there are people that would want this fix ([1]). Applying a similar patch on that GitHub issue did give performance gains. To convince myself this works at all I did trace io_uring events through with and without the patch. Using a test app ([2]) to issue O_DIRECT io_uring reads calls io_uring_queue_async_work without this patch, while with it the call is skipped and the completion is queued into io_uring directly from nfs_direct_read_completion. Patch 1 here adds an unused nfs_start_io_direct_nowait which patch 2 uses in order to safely advertise FMODE_NOWAIT. [1]: https://github.com/axboe/liburing/issues/1499 [2]: https://github.com/DylanZA/liburing/commit/264c06f1939dfd6b6bc4c967ada5960c4f4f2db3 Dylan Yudaken (2): nfs: add nowait version of nfs_start_io_direct nfs: expose FMODE_NOWAIT for O_DIRECT read files fs/nfs/direct.c | 5 ++++- fs/nfs/file.c | 13 ++++++++++++- fs/nfs/internal.h | 1 + fs/nfs/io.c | 38 ++++++++++++++++++++++++++++++++++++-- 4 files changed, 53 insertions(+), 4 deletions(-) base-commit: 670b77dfebe7257adc0defbc48a4c43cfdf6c8f6 -- 2.50.1