From patchwork Fri Oct 13 15:56:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13421069 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 83739CDB47E for ; Fri, 13 Oct 2023 15:57:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B7E9F8001D; Fri, 13 Oct 2023 11:57:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AB6328D0015; Fri, 13 Oct 2023 11:57:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8BAFB8001D; Fri, 13 Oct 2023 11:57:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6E9D68D0015 for ; Fri, 13 Oct 2023 11:57:58 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 442581203DD for ; Fri, 13 Oct 2023 15:57:58 +0000 (UTC) X-FDA: 81340894236.10.8E6ED57 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf23.hostedemail.com (Postfix) with ESMTP id 906E8140018 for ; Fri, 13 Oct 2023 15:57:56 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=iPQJGXZw; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf23.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697212676; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=VdTOgUT9KIMzQnxrll+Ln7vU3lh7L6xf921vj9gXc+g=; b=0RamJOxaZsOMaI4NB7puaFYlywmli55dsU5Om6x5dmjVLIHmq14UDKQADmNpvatAdnplZC WM8zmWXegHIsbMV379WC2g2GlJfKYfvNRWpNOgEZ0ENBpcTQB8q4F+MSNoWTFsutQcijmJ fMP+QkC+7z2WOK1YG+uvTdEZW3arlcY= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=iPQJGXZw; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf23.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697212676; a=rsa-sha256; cv=none; b=y0pmsw1X44MxTGhOmu/Bi/NM+Chf5vDyXfRGqb+fY5Ms/jtqJfkzcMuwz7Glm2RqvXAT1W 9SsP6SMDT/+1cAZ8CyqRMci/V20chdnOxkZSxcFXppVHiqw2oR8oRPtE6zZm3ywaK0Csa0 rpEUT0RSRYpZ5LccXq6wf6idaSeFKhQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697212676; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VdTOgUT9KIMzQnxrll+Ln7vU3lh7L6xf921vj9gXc+g=; b=iPQJGXZw89MHOoxIYOm8qN7u8rqe082pmq49U4AkhOvotHIxcaOLCHTd12WZEYdGJm+kdP leuGpRFspcMYwZQHuucV5B7VPBsW1K/4oQpyOhIyIarpqD7IPXk9x7EkxgljS0pYgS/Hyq ysJZYVQAT6+6V3T0o241aHBQ84ZVebY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-690-sPJ3XQAXMnmyAp7uFZgrmw-1; Fri, 13 Oct 2023 11:57:43 -0400 X-MC-Unique: sPJ3XQAXMnmyAp7uFZgrmw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 591821029F45; Fri, 13 Oct 2023 15:57:42 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id B58C2492BD9; Fri, 13 Oct 2023 15:57:39 +0000 (UTC) From: David Howells To: Jeff Layton , Steve French Cc: David Howells , Matthew Wilcox , Marc Dionne , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Dominique Martinet , Ilya Dryomov , Christian Brauner , linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-cachefs@redhat.com Subject: [RFC PATCH 03/53] netfs: Note nonblockingness in the netfs_io_request struct Date: Fri, 13 Oct 2023 16:56:36 +0100 Message-ID: <20231013155727.2217781-4-dhowells@redhat.com> In-Reply-To: <20231013155727.2217781-1-dhowells@redhat.com> References: <20231013155727.2217781-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Rspam-User: X-Stat-Signature: 4kkzkw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IUcgHsrH/Iy/OPLT1NpAoRnSGxee1W6rp5wIKBGBx5WEbW9iktoT6J15CwkA/vnxc/tOwuLuvtk/qRtMhrKPDnCaM51SKw6S7n9gnRAvA7b0F+/C2CH/urXBXQFlFta1NWdHTSmyTyn4A1k7VcoqUPZj8KOPgmVicE3swPT/mvZthGClanPmO6rcH+n44n/S7PVIhftL8qhqySa3kfePHX0KXBLjzijF9JcM4t25GW71VZ24BvIQrUDWPh0zFgUFkkfOPMsoijsW/13+jBuca0XHqbJua92BtrERHnTeJRwf5fcj+TQZn94+nUTcLpSv2c6eYTVyH7Wjurx74A== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Allow O_NONBLOCK to be noted in the netfs_io_request struct. Also add a flag, NETFS_RREQ_BLOCKED to record if we did block. Signed-off-by: David Howells cc: Jeff Layton cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- fs/netfs/objects.c | 2 ++ include/linux/netfs.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/fs/netfs/objects.c b/fs/netfs/objects.c index 85f428fc52e6..e41f9fc9bdd2 100644 --- a/fs/netfs/objects.c +++ b/fs/netfs/objects.c @@ -37,6 +37,8 @@ struct netfs_io_request *netfs_alloc_request(struct address_space *mapping, INIT_LIST_HEAD(&rreq->subrequests); refcount_set(&rreq->ref, 1); __set_bit(NETFS_RREQ_IN_PROGRESS, &rreq->flags); + if (file && file->f_flags & O_NONBLOCK) + __set_bit(NETFS_RREQ_NONBLOCK, &rreq->flags); if (rreq->netfs_ops->init_request) { ret = rreq->netfs_ops->init_request(rreq, file); if (ret < 0) { diff --git a/include/linux/netfs.h b/include/linux/netfs.h index 282511090ead..b92e982ac4a0 100644 --- a/include/linux/netfs.h +++ b/include/linux/netfs.h @@ -205,6 +205,8 @@ struct netfs_io_request { #define NETFS_RREQ_DONT_UNLOCK_FOLIOS 3 /* Don't unlock the folios on completion */ #define NETFS_RREQ_FAILED 4 /* The request failed */ #define NETFS_RREQ_IN_PROGRESS 5 /* Unlocked when the request completes */ +#define NETFS_RREQ_NONBLOCK 6 /* Don't block if possible (O_NONBLOCK) */ +#define NETFS_RREQ_BLOCKED 7 /* We blocked */ const struct netfs_request_ops *netfs_ops; };