From nobody Wed Aug 09 04:03:12 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RLGcd04Hxz4m6Dy; Wed, 9 Aug 2023 04:03:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RLGcc1pd2z3ZZg; Wed, 9 Aug 2023 04:03:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691553792; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6s8C7K5WCP5EFLwjO7r5l7xexjFXeZYN/4WIaqoJmWI=; b=q5DTngnL1FRr2H5lcV23oPdsmTgpIdX0LOD2vwllqmxMs45oojIjuqkl+8iLfybVX3TCIn KFLvmP6x2iZqTSy1MVlUuxU35/RpYUMmfrGYcA8+Q41vpAKCSeYiTBkC6Q0QqYR7dHm7IQ 4UZypD2HD5Tzten5bjAJXN2x+8VhQlvQGXaZWPb5R/KToFp1sPRZkjcfXq0AmlDWN6xar3 Xh5l2FdDIm9QPDLDYOwQcNqBMxW/S9HDyEwJt53TgM+25YCqksnA+ZULoL35dW23LYJ1Lm PlUX5VlWYG3btcgqNuRUGzVUnsL8PszBpcRWnSAVmeXziVHLOx/HmrOasb2GfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691553792; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6s8C7K5WCP5EFLwjO7r5l7xexjFXeZYN/4WIaqoJmWI=; b=KtWyacWZvo9fgWQ5nXE0ZVdltS/HiUJkK7PgANAHmX7AfdTnoVWSJvTzdArMnjmWJjh9mv uvqI0Cs8on3LfCmCw2X6US5P8SfPnfRQksp63/UsMvwWdbB1PPY/EKaQD8+8sBRTwxfNED nFlKMV8N6W6JRfRekXOEsi2yOsPFdqp8JoRZQ/rDuJDk/fhCvnjqnFywQgTYg5CiNmmCY8 V1ER9gmXuxqSNGeZlHDblufG2F1mtckvZyUGKXY2QcRI673pTgXnA7XosEZhk32se2oVUK AhewLnP1++l4/CJSOirbZ2eJYWgMkYWbzFnJPurCTEx+oGfZSV9nf4yqQGOFNQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691553792; a=rsa-sha256; cv=none; b=idW+yB/6qbbzPVexytr9a5NzOSVT7L0JIITuI3KlAzdkxnwR7oUEnwLmcsxyA6+xYUo4AS EFCZMKYVfoXjoLoYSiKMrUhEoo+4NjN7IbF6yU4CcyriVFWr5vMFUeEAZldjUmg8XkLlRz 9kitjUgCP6QZqxK2RouetEaP0rFcmuicNpBSHTm88jbfcW0O8WZ2F8u39nXTnckg9Zk37i rvAn+Ic1Se5W09y01nel4rI++ULLWeuWIThr1FLiBiVi5TzMWHRvVzn3KHUJ8P2HX3isTC EsA1CPupdjoy8OVYKuIbt3lYBufd9fj3trvQH+L66p/EOxJMBB0pWxMLxwTAfA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RLGcc0hYzz11n6; Wed, 9 Aug 2023 04:03:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 37943CYD090256; Wed, 9 Aug 2023 04:03:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37943CO8090253; Wed, 9 Aug 2023 04:03:12 GMT (envelope-from git) Date: Wed, 9 Aug 2023 04:03:12 GMT Message-Id: <202308090403.37943CO8090253@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 0f613ab85e5a - main - tmpfs: add a knob to enable pgcache read for mount List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0f613ab85e5a5274704d179f39fb15163d46e7c4 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0f613ab85e5a5274704d179f39fb15163d46e7c4 commit 0f613ab85e5a5274704d179f39fb15163d46e7c4 Author: Konstantin Belousov AuthorDate: 2023-08-06 01:35:36 +0000 Commit: Konstantin Belousov CommitDate: 2023-08-09 03:54:15 +0000 tmpfs: add a knob to enable pgcache read for mount Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D41334 --- sys/fs/tmpfs/tmpfs.h | 3 +++ sys/fs/tmpfs/tmpfs_subr.c | 3 ++- sys/fs/tmpfs/tmpfs_vfsops.c | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index 126b99acba6b..7e24fd5e1924 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -428,6 +428,9 @@ struct tmpfs_mount { bool tm_nonc; /* Do not update mtime on writes through mmaped areas. */ bool tm_nomtime; + + /* Read from page cache directly. */ + bool tm_pgread; }; #define TMPFS_LOCK(tm) mtx_lock(&(tm)->tm_allnode_lock) #define TMPFS_UNLOCK(tm) mtx_unlock(&(tm)->tm_allnode_lock) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 28834a96ee9a..69a9936ebcde 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -1061,7 +1061,8 @@ loop: VI_LOCK(vp); KASSERT(vp->v_object == NULL, ("Not NULL v_object in tmpfs")); vp->v_object = object; - vn_irflag_set_locked(vp, VIRF_PGREAD | VIRF_TEXT_REF); + vn_irflag_set_locked(vp, (tm->tm_pgread ? VIRF_PGREAD : 0) | + VIRF_TEXT_REF); VI_UNLOCK(vp); VM_OBJECT_WUNLOCK(object); break; diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index 7a88e7deba9d..b04b3c084b3b 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -329,7 +329,7 @@ tmpfs_mount(struct mount *mp) struct tmpfs_mount *tmp; struct tmpfs_node *root; int error; - bool nomtime, nonc; + bool nomtime, nonc, pgread; /* Size counters. */ u_quad_t pages; off_t nodes_max, size_max, maxfilesize, ea_max_size; @@ -412,6 +412,7 @@ tmpfs_mount(struct mount *mp) ea_max_size = 0; nonc = vfs_getopt(mp->mnt_optnew, "nonc", NULL, NULL) == 0; nomtime = vfs_getopt(mp->mnt_optnew, "nomtime", NULL, NULL) == 0; + pgread = vfs_getopt(mp->mnt_optnew, "pgread", NULL, NULL) == 0; /* Do not allow mounts if we do not have enough memory to preserve * the minimum reserved pages. */ @@ -462,6 +463,7 @@ tmpfs_mount(struct mount *mp) tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0; tmp->tm_nonc = nonc; tmp->tm_nomtime = nomtime; + tmp->tm_pgread = pgread; /* Allocate the root node. */ error = tmpfs_alloc_node(mp, tmp, VDIR, root_uid, root_gid,