From patchwork Mon Jan 8 15:18:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Van Hensbergen X-Patchwork-Id: 13513596 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 AC9F14C610; Mon, 8 Jan 2024 15:18:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gvJFHb9X" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB16DC433D9; Mon, 8 Jan 2024 15:18:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704727109; bh=FzqC8vGfSQKqsymfIdQBKBTvSoDcKJkKyoEMFGNr5Uk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=gvJFHb9Xq0bzJfqeoSEGCf46TqK7pW8iIA3JfYScQ5bMzgQKusktpVugjcf+bnaTL 9d4PGxUgbUzzKz/dBm0AtNmD/mcCkHhr8XISUr3K1V6vpXwRmX0wJiAYoqoLS5oDPS m2XoZFONLVnSemx1zCmy/l4j64iyGF2tZgQKtq5Yb8rTsIx0ZMupXr7aktEP7a/0DB vZo5LOeiJWdthDDXP/lbn6l2rpFb6iPMdZQGDnbDIFE8zM0QzzQQ92CDLdyVxjZ11n QRnduPh4FfEpjnZ7QKHKaGyn6pqBHbItOoixHzdzVGC75Q/staHKB4wKGSQwT2pgnk 3otHs/0DLb0Sg== From: Eric Van Hensbergen Date: Mon, 08 Jan 2024 15:18:17 +0000 Subject: [PATCH v2 1/8] fs/9p: switch vfsmount to use v9fs_get_new_inode Precedence: bulk X-Mailing-List: v9fs@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240108-ericvh-fix-cache-dups-v2-1-a73f8822838c@kernel.org> References: <20240108-ericvh-fix-cache-dups-v2-0-a73f8822838c@kernel.org> In-Reply-To: <20240108-ericvh-fix-cache-dups-v2-0-a73f8822838c@kernel.org> To: Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck Cc: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, Eric Van Hensbergen X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1973; i=ericvh@kernel.org; h=from:subject:message-id; bh=FzqC8vGfSQKqsymfIdQBKBTvSoDcKJkKyoEMFGNr5Uk=; b=owEBbQKS/ZANAwAKAYj/1ftKX/+YAcsmYgBlnBJCcsP0XfYsl1bHEYlKvirxIWNqyGqk06LyC AIHCFd/voeJAjMEAAEKAB0WIQSWlvDRlqWQmKTK0VGI/9X7Sl//mAUCZZwSQgAKCRCI/9X7Sl// mHnAEACDKZbFob0ZtPl7iWvsU3dfgcfLKnTJf/egIgnl7cVoO6PsIpz3hB3X0A4jloQnBDmg6X7 FXJv9lxQc0vk1yhrmhEII/z7DSFWr2bq/h5Y8pxJENWouNmVtGHzq0bdvx5iYs61pepRQsOw3+M oXzKEHqqkziWCWzWmSG4Pmy2FoFkyfWcL9X8eY4URoZmcQUNVqozhgfpOUWOTDZvB6MJyOHlhy1 LxAa4snk7LtnamWSdirXRaYWor/8YKZ4T3uMwdnhsmdr5j4xJTTWIgeSLHn1u7HJR27ieyDeZpV pYTb5cGFq5TnGVlKkPPj5iqksQrvP9wbKQrT3CzftOz6DyYei20l6UOcUp0rCn4WekMV8TSlOS1 xt1xjja5HNf9tw72lJpgz+J0mbkQSACOFV5jmTcngnnHzTKPXc31btAd/yjIrWU5Ct9psZe14vs xIyCTjxmGSkr1tfxAMwdJsbPXxW+LY7QIWkP6f+QsMgzNKV9Vs2716niEve1YQ/mLSHzHONDpVx iKtsQZUZVUwfhtcqCYViPKBi6/Ts4VjqvXKOZu9mHOObMWkBbO0ubkI6Gco0dMex5CXITlbIHDx 8gXwaAz2+ZmpBNFtJ7CX3zJN0BWOnFT5nQz+VhJbxT52cqEEy0Mx3YGmrNjPMxGG7O+5IkJqUBE SFf1uHf5GqeDvVQ== X-Developer-Key: i=ericvh@kernel.org; a=openpgp; fpr=9696F0D196A59098A4CAD15188FFD5FB4A5FFF98 In the process of cleaning up inode number allocation, I noticed several functions which didn't use the standard helper allocators. This patch fixes the allocation in the mount entrypoint. Signed-off-by: Eric Van Hensbergen --- fs/9p/vfs_super.c | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 73db55c050bf..8d14cc0b3916 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c @@ -110,7 +110,6 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, struct inode *inode = NULL; struct dentry *root = NULL; struct v9fs_session_info *v9ses = NULL; - umode_t mode = 0777 | S_ISVTX; struct p9_fid *fid; int retval = 0; @@ -140,7 +139,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, else sb->s_d_op = &v9fs_dentry_operations; - inode = v9fs_get_inode(sb, S_IFDIR | mode, 0); + inode = v9fs_get_new_inode_from_fid(v9ses, fid, sb); if (IS_ERR(inode)) { retval = PTR_ERR(inode); goto release_sb; @@ -152,32 +151,6 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, goto release_sb; } sb->s_root = root; - if (v9fs_proto_dotl(v9ses)) { - struct p9_stat_dotl *st = NULL; - - st = p9_client_getattr_dotl(fid, P9_STATS_BASIC); - if (IS_ERR(st)) { - retval = PTR_ERR(st); - goto release_sb; - } - d_inode(root)->i_ino = v9fs_qid2ino(&st->qid); - v9fs_stat2inode_dotl(st, d_inode(root), 0); - kfree(st); - } else { - struct p9_wstat *st = NULL; - - st = p9_client_stat(fid); - if (IS_ERR(st)) { - retval = PTR_ERR(st); - goto release_sb; - } - - d_inode(root)->i_ino = v9fs_qid2ino(&st->qid); - v9fs_stat2inode(st, d_inode(root), sb, 0); - - p9stat_free(st); - kfree(st); - } retval = v9fs_get_acl(inode, fid); if (retval) goto release_sb; From patchwork Mon Jan 8 15:18:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Van Hensbergen X-Patchwork-Id: 13513597 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B46385027B; Mon, 8 Jan 2024 15:18:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bqXvlbXp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2E90C43391; Mon, 8 Jan 2024 15:18:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704727110; bh=6J7EZJj9VWIpSwcWubGlaBSfbZNbY5oiwi0szyHJl2k=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=bqXvlbXpOCMmgpQ9VcsXqL7T58j6ZPvokybsOFXiGpDplJVyJNnednreBYtb/7qq0 50wURALuXCHxyy0J0023MhMjfg5ovZZ6YeSJ3UBxIYz/RM2g9J+fn83lBULmcQsYrs BcoS3PHSse5AHLvugYHGtp2MonVUNYmCH63IQKduvfk8HxhzpZZOt+QTzoixx54htt P2tuCycgC8NYXRRtOfy0e/aJiDtn9VGoQa/x0p8MWvtWrWduOKILUKYBB5LzwxBi2H mB+D9WsSyedZNrYSVu6tLzFaCiekT3V7Szl3eGWpRgPzRuVbaOLjDg8uX3JEDN06cM u0UUYU/anblRw== From: Eric Van Hensbergen Date: Mon, 08 Jan 2024 15:18:18 +0000 Subject: [PATCH v2 2/8] fs/9p: convert mkdir to use get_new_inode Precedence: bulk X-Mailing-List: v9fs@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240108-ericvh-fix-cache-dups-v2-2-a73f8822838c@kernel.org> References: <20240108-ericvh-fix-cache-dups-v2-0-a73f8822838c@kernel.org> In-Reply-To: <20240108-ericvh-fix-cache-dups-v2-0-a73f8822838c@kernel.org> To: Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck Cc: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, Eric Van Hensbergen X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1893; i=ericvh@kernel.org; h=from:subject:message-id; bh=6J7EZJj9VWIpSwcWubGlaBSfbZNbY5oiwi0szyHJl2k=; b=owEBbQKS/ZANAwAKAYj/1ftKX/+YAcsmYgBlnBJDf3xA25bd6ZNge4qdcB0YfAp+Kxxh4WkRt 9dUbSCCA9SJAjMEAAEKAB0WIQSWlvDRlqWQmKTK0VGI/9X7Sl//mAUCZZwSQwAKCRCI/9X7Sl// mB2fD/0durKg/03hcGzp65W1RgAfi/Gil7/upa753Z62meQO7ZvCpmBHDKidax2iJnjAnieZfhV 9WqnO1EQukimB1YLZW5wsJfNwNTYyWlFEczxMyG4luuRDQSksTuAoKmLqvKMFTB4GHyW1ZfH8Iw b5bUGesYH5SRjlCEJzxSy0cnUJPCd6YaMhEzrxIvRMUTGYirppm8N3sh/U90kkFY7DewxbSxQ4q Kl3X7TCBsZeIKHXSnc8zkivy8dcKVcEA2jhAMkxDNzZNE+G/6Llgs+ySxxJCOs+u6oGSGUviH1h qkW9PZQbEAdi8FCHvare9k8W1hYd20jQsswrpHd+34FE+ahyiqQ9RInl/Ou9Dl7oAgrML7h1fJz KE87trQerbk5Jj71h0K7NNASay7qA/CJaVXs1+vIovyoMpRebm+w42BkmATlonbsno3E/YXSRnk 6fSHZWclok7TvYmZqfj4+fLsdeyj+ExlxDh0ZBUaxM0V1U46wz4sfM4lBUaO96oiOgEenMOiOzf WO1ZaB1V6LayV7luQdzVJ7zLAFUaKuBlASwn2FGXrBrM4TSqYDMe/2QS9VEOUIr1BilGdIwN0TO y2j+gtseEC+GfCLsxtWKLd2ZLyursnInarYSP+whuSxEuDgZDBYuYGsvgmR3FxgN9yGrwH3pMSa Nlco5bxWVzYcFXA== X-Developer-Key: i=ericvh@kernel.org; a=openpgp; fpr=9696F0D196A59098A4CAD15188FFD5FB4A5FFF98 mkdir had different code paths for inode creation, cache used the get_new_inode_from_fid helper, but non-cached used v9fs_get_inode. Collapsed into a single implementation across both as there should be no difference. Signed-off-by: Eric Van Hensbergen --- fs/9p/vfs_inode_dotl.c | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index c7319af2f471..981278d0788e 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -401,32 +401,17 @@ static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap, } /* instantiate inode and assign the unopened fid to the dentry */ - if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) { - inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); - if (IS_ERR(inode)) { - err = PTR_ERR(inode); - p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", - err); - goto error; - } - v9fs_fid_add(dentry, &fid); - v9fs_set_create_acl(inode, fid, dacl, pacl); - d_instantiate(dentry, inode); - err = 0; - } else { - /* - * Not in cached mode. No need to populate - * inode with stat. We need to get an inode - * so that we can set the acl with dentry - */ - inode = v9fs_get_inode(dir->i_sb, mode, 0); - if (IS_ERR(inode)) { - err = PTR_ERR(inode); - goto error; - } - v9fs_set_create_acl(inode, fid, dacl, pacl); - d_instantiate(dentry, inode); + inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); + if (IS_ERR(inode)) { + err = PTR_ERR(inode); + p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", + err); + goto error; } + v9fs_fid_add(dentry, &fid); + v9fs_set_create_acl(inode, fid, dacl, pacl); + d_instantiate(dentry, inode); + err = 0; inc_nlink(dir); v9fs_invalidate_inode_attr(dir); error: From patchwork Mon Jan 8 15:18:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Van Hensbergen X-Patchwork-Id: 13513598 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9D14D4C3BB; Mon, 8 Jan 2024 15:18:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MAzeK0/I" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BACDC433BC; Mon, 8 Jan 2024 15:18:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704727111; bh=zoRQ9dEnIT6klFY52VeEID3QXnuY6rouUe1AVTOWsOw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MAzeK0/ItptvKuUhx8VpztMXWJIukyfaiIMxjYv9hInoCXNU7aRj2q1noF7WCs4cK hgjhgM2W7NfWpirmd4FQ+87uNy6fLmnAv4zR9Bvi8okIuAoWjf8h0G1xBxzkaXIVsG sKLJlGlyd29pdVomVqYdUiCpFEehEuRvisciOIcmmNqwzSrkQiossMjwlOVnmforu8 4UF2AlVhaX6vvmmG5KyjvyANAhkSmW39+55iKYQZCpI2P6fTfs2x6rhsLKyXsDk1G2 vI9p4hG+IvriRtzJxdN4Ssfx5hz/8UMvbm7zobelZLl7BYW2x2Av/wlW9t9A1dk7Pv 28TVlaQCPxTQA== From: Eric Van Hensbergen Date: Mon, 08 Jan 2024 15:18:19 +0000 Subject: [PATCH v2 3/8] fs/9p: remove walk and inode allocation from symlink Precedence: bulk X-Mailing-List: v9fs@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240108-ericvh-fix-cache-dups-v2-3-a73f8822838c@kernel.org> References: <20240108-ericvh-fix-cache-dups-v2-0-a73f8822838c@kernel.org> In-Reply-To: <20240108-ericvh-fix-cache-dups-v2-0-a73f8822838c@kernel.org> To: Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck Cc: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, Eric Van Hensbergen X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2171; i=ericvh@kernel.org; h=from:subject:message-id; bh=zoRQ9dEnIT6klFY52VeEID3QXnuY6rouUe1AVTOWsOw=; b=owEBbQKS/ZANAwAKAYj/1ftKX/+YAcsmYgBlnBJDsRvZD7QYXACISbCPPvvYctu/FCJh8S1EV AOxVjGXNaWJAjMEAAEKAB0WIQSWlvDRlqWQmKTK0VGI/9X7Sl//mAUCZZwSQwAKCRCI/9X7Sl// mBjTD/kBaCqi1EEuQRPk03r56f9Qg/8xvx0dmj57VFaJYOOJofi/FtmCfTTJMd5jtQRP8zkTC9M S2//Nqw+PU7Egsim4KUJu5Wy6mgpVV17bV4TG6vap6D5lz/9S88ZPQhgL8GBj3uNTBUD244jfWY z45cJH8GNR+XSpd1peA3AHPojxVFdWUtCsNlQplKyQeLTNTLWUvCpvuarxA0M2xUr7Jz0NyzvsV iDYvKSzxtyHossRaZ49RtUgni+/qW7ODLWEC6KScNkBliAr3RCfuT5Gyu4mcDXUW4gmZDp3DwGn y4qlYv5OYqKzgeoevAjnJQKp17/kdc3onzvtAzNsyGNgVjYPatVW5IbSeOc0T7Le3Hghn13JfbK 7WKOesFsNKLEcgOl5gBGShc7ClUyOpnqYg9ybCNrxqbZVKyB+3OCfTyuCGxxBCX+uN85M8SSeDt 4GKaZArZ0hXhqYrIzYCwN0bdSNzcX634luBTMmMHUbj9hLXTqbG2fBJDUpmvo8Pp1t8wdlhxCqS wmM8RI2vc+rFofjzXJruIkCS/VPwedPxqiAD//5gwHbEOGgLj8azaZrh6ypfjS66JJkGBTnk0SL 4tFTMckwFKlRWuTIATpYiOs/SO6Wx8rizNur0B7tzMlSxD2KbxcedUxrsgLUdVMyoGs0IXg1BTn X4FSEeeS7ey0ipg== X-Developer-Key: i=ericvh@kernel.org; a=openpgp; fpr=9696F0D196A59098A4CAD15188FFD5FB4A5FFF98 Symlink had a bunch of extra operations which essentially end up discarded. It was walking the fid to the new file and creating an inode for it, but those semantics are part of tsymlink. This did prepopulate the cache, but that also seems potentially unnecessary and frought with peril. Signed-off-by: Eric Van Hensbergen --- fs/9p/vfs_inode_dotl.c | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 981278d0788e..ab52a89367d2 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -690,14 +690,11 @@ v9fs_vfs_symlink_dotl(struct mnt_idmap *idmap, struct inode *dir, kgid_t gid; const unsigned char *name; struct p9_qid qid; - struct inode *inode; struct p9_fid *dfid; struct p9_fid *fid = NULL; - struct v9fs_session_info *v9ses; name = dentry->d_name.name; p9_debug(P9_DEBUG_VFS, "%lu,%s,%s\n", dir->i_ino, name, symname); - v9ses = v9fs_inode2v9ses(dir); dfid = v9fs_parent_fid(dentry); if (IS_ERR(dfid)) { @@ -717,36 +714,6 @@ v9fs_vfs_symlink_dotl(struct mnt_idmap *idmap, struct inode *dir, } v9fs_invalidate_inode_attr(dir); - if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) { - /* Now walk from the parent so we can get an unopened fid. */ - fid = p9_client_walk(dfid, 1, &name, 1); - if (IS_ERR(fid)) { - err = PTR_ERR(fid); - p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", - err); - goto error; - } - - /* instantiate inode and assign the unopened fid to dentry */ - inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); - if (IS_ERR(inode)) { - err = PTR_ERR(inode); - p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", - err); - goto error; - } - v9fs_fid_add(dentry, &fid); - d_instantiate(dentry, inode); - err = 0; - } else { - /* Not in cached mode. No need to populate inode with stat */ - inode = v9fs_get_inode(dir->i_sb, S_IFLNK, 0); - if (IS_ERR(inode)) { - err = PTR_ERR(inode); - goto error; - } - d_instantiate(dentry, inode); - } error: p9_fid_put(fid); From patchwork Mon Jan 8 15:18:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Van Hensbergen X-Patchwork-Id: 13513599 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6781A4C3C9; Mon, 8 Jan 2024 15:18:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aol7eVIA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 573BBC433AB; Mon, 8 Jan 2024 15:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704727111; bh=l92SouosFIYw3ff8gW2JhMxPJjTF6VFrybmBKncrwgQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=aol7eVIAnyTNYboF/ohW1jfHZDTOd9STxJLPiwjIjJEpPo4VinW3ryQKGuVdJE6tM 2gr0q/px+RYehtHqMmXHU75K0Ku4Fjy1lXvQWMyQZNpBQsRXR0Rt8hZd5jXKMNR8cM 7Spb402LZn7tocwTT7e48TmRg72ptEMqAzvS1bV947DwK+PNcw7Ga8bvJUbCH8OU7e MsqE1zEbCvqjIFHuRoUtOORTDfbcBspBKh4SY2x6EEQI62+23FmTOSJ6M5wYl50VgS U7QntVXKqF40hzWyIXEFVcdefAnw38G0DnpYEFeRdvQqyj9FK2ZZVt5Ihfw2fsz8Xj cSOkGW72/jh2A== From: Eric Van Hensbergen Date: Mon, 08 Jan 2024 15:18:20 +0000 Subject: [PATCH v2 4/8] fs/9p: Eliminate redundant non-cache path in mknod Precedence: bulk X-Mailing-List: v9fs@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240108-ericvh-fix-cache-dups-v2-4-a73f8822838c@kernel.org> References: <20240108-ericvh-fix-cache-dups-v2-0-a73f8822838c@kernel.org> In-Reply-To: <20240108-ericvh-fix-cache-dups-v2-0-a73f8822838c@kernel.org> To: Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck Cc: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, Eric Van Hensbergen X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1817; i=ericvh@kernel.org; h=from:subject:message-id; bh=l92SouosFIYw3ff8gW2JhMxPJjTF6VFrybmBKncrwgQ=; b=owEBbQKS/ZANAwAKAYj/1ftKX/+YAcsmYgBlnBJDpbZXDyczF1cb1zBNOFrwcPuSureTfMT7v XZUgTbbY02JAjMEAAEKAB0WIQSWlvDRlqWQmKTK0VGI/9X7Sl//mAUCZZwSQwAKCRCI/9X7Sl// mKI2D/4sZz4CoiiiUdppH9yfbfYSY/u9yUtOsTs9F2fT5Z9ADtCL69wGzIDl/aEcNgH3UYGYDoM I4qmTjN0rUKE+o6qYu1QCt3cQgPMoYXe8716+ja2Pgm0kGxzQG2zXVye1ZZiDT1IdagSmeJVszg ymazH85rjcU9wiDAZWHf5RGEnBv+ZNaqubksmvw8zKlDDlgR3aNAQRORoV6Bx3yKjBYpoXdqOFy /HqwMtcsxnxlh0aU3XX3weV+QM1cpHHvocVqCsODPOJNYdWOqKRwvGLWd9V/YPDThkganKoA+Sz F/e30eU1vljldM5T4iX9kUGQYQGNqVTAqFLtJxUmErl2RbBeSp0NukRwkDeHffQFqmm+u0rUwlx kVSDC5pUllsRuUdtUfRvD0WUfovp+jpUmc0QWbWobrGUNnvxdo7AkXOePVdi6w0F1xfCXdUkW7y 4n3pbzoQxDK/aITQIo9j/2q2JQ5ZzA0ng2VsZQXZUkelo9TwpDVc69Ujhdi1mOjoXKou0VkAu6c lEby/x+9T54f5zWxHw2ws7XUoY/Kmf7E90jKRUC8jJISgZTyR2XIZszeMZIhL8d1EoP8uq13lyv NiWPWj+jF2qmvI3urIruhunul5eor+uTMMgxIXkkGiEs1tWnrve1tjEVuL6tRIYVNExHBUgu+EI 6G3u/3Hy/vASWzA== X-Developer-Key: i=ericvh@kernel.org; a=openpgp; fpr=9696F0D196A59098A4CAD15188FFD5FB4A5FFF98 Like symlink, mknod had a seperate path with different inode allocation -- but this seems unnecessary, so eliminating this path. Signed-off-by: Eric Van Hensbergen --- fs/9p/vfs_inode_dotl.c | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index ab52a89367d2..ddc3cfdcc13b 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -836,33 +836,17 @@ v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir, err); goto error; } - - /* instantiate inode and assign the unopened fid to the dentry */ - if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) { - inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); - if (IS_ERR(inode)) { - err = PTR_ERR(inode); - p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", - err); - goto error; - } - v9fs_set_create_acl(inode, fid, dacl, pacl); - v9fs_fid_add(dentry, &fid); - d_instantiate(dentry, inode); - err = 0; - } else { - /* - * Not in cached mode. No need to populate inode with stat. - * socket syscall returns a fd, so we need instantiate - */ - inode = v9fs_get_inode(dir->i_sb, mode, rdev); - if (IS_ERR(inode)) { - err = PTR_ERR(inode); - goto error; - } - v9fs_set_create_acl(inode, fid, dacl, pacl); - d_instantiate(dentry, inode); + inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); + if (IS_ERR(inode)) { + err = PTR_ERR(inode); + p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", + err); + goto error; } + v9fs_set_create_acl(inode, fid, dacl, pacl); + v9fs_fid_add(dentry, &fid); + d_instantiate(dentry, inode); + err = 0; error: p9_fid_put(fid); v9fs_put_acl(dacl, pacl); From patchwork Mon Jan 8 15:18:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Van Hensbergen X-Patchwork-Id: 13513600 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E2002524A2; Mon, 8 Jan 2024 15:18:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PuQmyRVl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FFDFC4166B; Mon, 8 Jan 2024 15:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704727112; bh=yRE6PYaDBQWCEJAQHlZSqyEFDAFo/1wr7VhpyL1bSEE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PuQmyRVlJoSoS66BS5OQqhtApFrOiQo+Y/7lqQFPVi1KV9C4LwoELM7cncTE3kNHY g8SRiwObOj6/rl6J1bBirQgMmR4fcia6QU8Gfs/GIYUVLyWQOhtUe+gEf8VO5oFht9 MnQzX6XkPB3t1BVvLwsbyLdVjVuES1XvbBhWWbAsiJLpKHbICvnx5bheAeILN+qCw1 XNGWD+n7HDJfbLMteeBd4c0ZgY+qsj2sb0f03ou4OEVGY8FDBTMIigBEVPLDY+YU/M /7eRvvW01raTLIALBDgq9WwXhdrxGAkFcHBFsAZUTO6O5f39uxEvf5qfOiLLbWQ+RL zcHnX8GMnj+UA== From: Eric Van Hensbergen Date: Mon, 08 Jan 2024 15:18:21 +0000 Subject: [PATCH v2 5/8] fs/9p: Eliminate now unused v9fs_get_inode Precedence: bulk X-Mailing-List: v9fs@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240108-ericvh-fix-cache-dups-v2-5-a73f8822838c@kernel.org> References: <20240108-ericvh-fix-cache-dups-v2-0-a73f8822838c@kernel.org> In-Reply-To: <20240108-ericvh-fix-cache-dups-v2-0-a73f8822838c@kernel.org> To: Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck Cc: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, Eric Van Hensbergen X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1950; i=ericvh@kernel.org; h=from:subject:message-id; bh=yRE6PYaDBQWCEJAQHlZSqyEFDAFo/1wr7VhpyL1bSEE=; b=owEBbQKS/ZANAwAKAYj/1ftKX/+YAcsmYgBlnBJDrhR11jQUqruHWzbI87YKtpGC0MDEnVJll 0M1z1c8j8eJAjMEAAEKAB0WIQSWlvDRlqWQmKTK0VGI/9X7Sl//mAUCZZwSQwAKCRCI/9X7Sl// mKLsEACGqbKDEItypwvOa91xtEAwMpftX9Sft+ackDPWm5aDeLA2e64e4SedBvCKYF07vCzafzP MW55RTiAIn10xwajgkPyFT4U7bW1lxzlTotFeep/6ZudYWnyWwk0mXDOSwKKUQFYCRbdtHZ84Fo tI1dualnmv7Sxr0bY65CR7nIkZV2OPYehNUiZrd9Tb6Z3+OhbbaAB9nzR7SaWLsIHTjYp/X6eSL OQm1QcR1pY/UbtTiXKIGUbc4mlhFq0WCYsK/Wk6XSYllNHGU5V57GAHv6/ng/Xuncj3RPJvL8hB eudIE/88U0XQKhfODWshfXiuAAS9kCnec3fNwCWO1yv67KBz3KlRseQyTYCyBmPQ1zRHK26/zH3 KoZqm+Hx9fCmzjGSCxZNHfxU7yDDrni1ba8ZUcZ3kMO6si7hu4RQqYUD5PmPNfGtK8JfQf88HwW 68E6Nx8hdCqmo84sklNjVWW1lGpC+ptcVD9PPq4zQofJ1GNyZY4qDF6gPo3ScRxx9pFnDszmcFb T9ICozIuQA4JRIikMmzY0VN2XemOjYDqAoj9epT5A5J3NKWiaYkS/GlD3I/02qWM7vENYJXJhsG NP2l01qvJJVaIWbzJrqJMSvWuxvkKIDdoNUEhrtXHtueWSclUnkfZeSLlYfnfp3QZhYgQff+2i/ v04TCZ9KLESaJZA== X-Developer-Key: i=ericvh@kernel.org; a=openpgp; fpr=9696F0D196A59098A4CAD15188FFD5FB4A5FFF98 Now with all inode allocation going through get_from_fid functions we can remove v9fs_get_inode and reduce us down to a single inode allocation path. Signed-off-by: Eric Van Hensbergen --- fs/9p/v9fs_vfs.h | 2 -- fs/9p/vfs_inode.c | 29 ----------------------------- 2 files changed, 31 deletions(-) diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h index 731e3d14b67d..ad0310deb6c8 100644 --- a/fs/9p/v9fs_vfs.h +++ b/fs/9p/v9fs_vfs.h @@ -40,8 +40,6 @@ extern struct kmem_cache *v9fs_inode_cache; struct inode *v9fs_alloc_inode(struct super_block *sb); void v9fs_free_inode(struct inode *inode); -struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, - dev_t rdev); int v9fs_init_inode(struct v9fs_session_info *v9ses, struct inode *inode, umode_t mode, dev_t rdev); void v9fs_evict_inode(struct inode *inode); diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index b845ee18a80b..0d06dca353aa 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -333,35 +333,6 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses, } -/** - * v9fs_get_inode - helper function to setup an inode - * @sb: superblock - * @mode: mode to setup inode with - * @rdev: The device numbers to set - */ - -struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t rdev) -{ - int err; - struct inode *inode; - struct v9fs_session_info *v9ses = sb->s_fs_info; - - p9_debug(P9_DEBUG_VFS, "super block: %p mode: %ho\n", sb, mode); - - inode = new_inode(sb); - if (!inode) { - pr_warn("%s (%d): Problem allocating inode\n", - __func__, task_pid_nr(current)); - return ERR_PTR(-ENOMEM); - } - err = v9fs_init_inode(v9ses, inode, mode, rdev); - if (err) { - iput(inode); - return ERR_PTR(err); - } - return inode; -} - /** * v9fs_evict_inode - Remove an inode from the inode cache * @inode: inode to release From patchwork Mon Jan 8 15:18:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Van Hensbergen X-Patchwork-Id: 13513601 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0761E4C3D2; Mon, 8 Jan 2024 15:18:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LScFmDDD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05BFBC433CB; Mon, 8 Jan 2024 15:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704727113; bh=nfwOOOK2pwf/NrR+X2ST2ZNa4AO++I52x4e4LpY2uAM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=LScFmDDDK9PDVBgCOXBgoIaMwsyJDyaQJPHDOPLoYY8MWyrVqzA5FhQpjbOdKCGQh T7VOcGA44rMcBXYfp16hhshu0j3XnBgJJDYTrGyw4vy6aXHZzat++LtbrtbDIN61KW wzx7PodKmuyZ0UWgtAn4b80lgmMHRmEIGwGTe/AnhaKRPZA1MygWOn5KeJjWAJh+IL gaykrOfQOhdfrKpA9YRxg0jO9gZ82h6OlUuFw4Nak+ZWOE3xHT6wHLSWs96NcnfCVj AYIMXhhRpGFJfAGYAR38DxkCaW0sK8p2E4QHuKdl4Wj7jDLiJGigbZTYzkTacaXEYq /SySuNyZ3STtQ== From: Eric Van Hensbergen Date: Mon, 08 Jan 2024 15:18:22 +0000 Subject: [PATCH v2 6/8] fs/9p: rework qid2ino logic Precedence: bulk X-Mailing-List: v9fs@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240108-ericvh-fix-cache-dups-v2-6-a73f8822838c@kernel.org> References: <20240108-ericvh-fix-cache-dups-v2-0-a73f8822838c@kernel.org> In-Reply-To: <20240108-ericvh-fix-cache-dups-v2-0-a73f8822838c@kernel.org> To: Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck Cc: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, Eric Van Hensbergen X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=4755; i=ericvh@kernel.org; h=from:subject:message-id; bh=nfwOOOK2pwf/NrR+X2ST2ZNa4AO++I52x4e4LpY2uAM=; b=owEBbQKS/ZANAwAKAYj/1ftKX/+YAcsmYgBlnBJDzoai4yhzhbvpdV6ENdiD1DeYCU42U0S0V Qo9xlnWdfyJAjMEAAEKAB0WIQSWlvDRlqWQmKTK0VGI/9X7Sl//mAUCZZwSQwAKCRCI/9X7Sl// mGakEACq2rn5Fp6smzLIJWrFYcK3RkMLVwV6gdWby5HIC3jErEU+8k/X2z5rKfi39kJ+S3wXZYh +DVzLz1Fm3RSxKVtS8qIIJN54OHXC37wbhW5jizWK5dK+lR9cPaPY0Od4aGqgnclHXd6wPHCJjZ sgoEnQ43fn4Qr0lA+zNDg3lDezHfcMG705augWQbKZxjVBBpoEeRodj/rQT2wI+XlVumBXsSj/E GqFweeq2GNYVT5wuAfKYM3QGGCYShwQe3esgMullB5Sm1sOVIWOkFbg/u7hLTUq1KQ+V1Iq6s/N 3K5JT9lxJXeJnq4H2vUGpG2DFlJ+WdRdMjst6lELbwy6F2zrIzoTssc9c2+tvVjN5LgUcczl0U7 O32ZWStEFc4Oj9MW+3UMbvvHT7QPrZd3nAz+FC7JwtTu2mSYLbOLnThoYoQJTdTjbA6XUFppUoB s7Z7dd6DIr76FjIm3T0pn5VSpiDY1cEMW17bTIiCbB79lLQ0qkTBycMO5WdLeWC+0fvrzdDf+d4 7tfENvTyAhxi0WAIUHL/TJgI00VC2ks2CEub/ZxHRhSayrO4FkgpIebVjruyX5N+jCNsBmK2vBm NxOmHxNhQEzR2AGH3la9XU1ECEqNZ0yNKd2T8bYMeXb6iu9zDH7Mprh851yrI/9DJ6azSzhO8Gt 2Emq6wGzttXkaOQ== X-Developer-Key: i=ericvh@kernel.org; a=openpgp; fpr=9696F0D196A59098A4CAD15188FFD5FB4A5FFF98 This changes from a function to a macro because we can figure out if we are 32 or 64 bit at compile time. Signed-off-by: Eric Van Hensbergen --- fs/9p/v9fs_vfs.h | 7 ++++++- fs/9p/vfs_dir.c | 4 ++-- fs/9p/vfs_inode.c | 26 ++------------------------ fs/9p/vfs_inode_dotl.c | 6 ++---- 4 files changed, 12 insertions(+), 31 deletions(-) diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h index ad0310deb6c8..507dc1389e07 100644 --- a/fs/9p/v9fs_vfs.h +++ b/fs/9p/v9fs_vfs.h @@ -43,7 +43,12 @@ void v9fs_free_inode(struct inode *inode); int v9fs_init_inode(struct v9fs_session_info *v9ses, struct inode *inode, umode_t mode, dev_t rdev); void v9fs_evict_inode(struct inode *inode); -ino_t v9fs_qid2ino(struct p9_qid *qid); +#if (BITS_PER_LONG == 32) +#define QID2INO(q) ((ino_t) (((q)->path+2) ^ (((q)->path) >> 32))) +#else +#define QID2INO(q) ((ino_t) ((q)->path+2)) +#endif + void v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode, struct super_block *sb, unsigned int flags); void v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode, diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c index 4102759a5cb5..e0d34e4e9076 100644 --- a/fs/9p/vfs_dir.c +++ b/fs/9p/vfs_dir.c @@ -127,7 +127,7 @@ static int v9fs_dir_readdir(struct file *file, struct dir_context *ctx) } over = !dir_emit(ctx, st.name, strlen(st.name), - v9fs_qid2ino(&st.qid), dt_type(&st)); + QID2INO(&st.qid), dt_type(&st)); p9stat_free(&st); if (over) return 0; @@ -184,7 +184,7 @@ static int v9fs_dir_readdir_dotl(struct file *file, struct dir_context *ctx) if (!dir_emit(ctx, curdirent.d_name, strlen(curdirent.d_name), - v9fs_qid2ino(&curdirent.qid), + QID2INO(&curdirent.qid), curdirent.d_type)) return 0; diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 0d06dca353aa..3b6c9172b40e 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -407,7 +407,6 @@ static struct inode *v9fs_qid_iget(struct super_block *sb, dev_t rdev; int retval; umode_t umode; - unsigned long i_ino; struct inode *inode; struct v9fs_session_info *v9ses = sb->s_fs_info; int (*test)(struct inode *inode, void *data); @@ -417,8 +416,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb, else test = v9fs_test_inode; - i_ino = v9fs_qid2ino(qid); - inode = iget5_locked(sb, i_ino, test, v9fs_set_inode, st); + inode = iget5_locked(sb, QID2INO(qid), test, v9fs_set_inode, st); if (!inode) return ERR_PTR(-ENOMEM); if (!(inode->i_state & I_NEW)) @@ -428,7 +426,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb, * FIXME!! we may need support for stale inodes * later. */ - inode->i_ino = i_ino; + inode->i_ino = QID2INO(qid); umode = p9mode2unixmode(v9ses, st, &rdev); retval = v9fs_init_inode(v9ses, inode, umode, rdev); if (retval) @@ -1159,26 +1157,6 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode, v9inode->cache_validity &= ~V9FS_INO_INVALID_ATTR; } -/** - * v9fs_qid2ino - convert qid into inode number - * @qid: qid to hash - * - * BUG: potential for inode number collisions? - */ - -ino_t v9fs_qid2ino(struct p9_qid *qid) -{ - u64 path = qid->path + 2; - ino_t i = 0; - - if (sizeof(ino_t) == sizeof(path)) - memcpy(&i, &path, sizeof(ino_t)); - else - i = (ino_t) (path ^ (path >> 32)); - - return i; -} - /** * v9fs_vfs_get_link - follow a symlink path * @dentry: dentry for symlink diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index ddc3cfdcc13b..61811cf5d9ff 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -100,7 +100,6 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb, int new) { int retval; - unsigned long i_ino; struct inode *inode; struct v9fs_session_info *v9ses = sb->s_fs_info; int (*test)(struct inode *inode, void *data); @@ -110,8 +109,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb, else test = v9fs_test_inode_dotl; - i_ino = v9fs_qid2ino(qid); - inode = iget5_locked(sb, i_ino, test, v9fs_set_inode_dotl, st); + inode = iget5_locked(sb, QID2INO(qid), test, v9fs_set_inode_dotl, st); if (!inode) return ERR_PTR(-ENOMEM); if (!(inode->i_state & I_NEW)) @@ -121,7 +119,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb, * FIXME!! we may need support for stale inodes * later. */ - inode->i_ino = i_ino; + inode->i_ino = QID2INO(qid); retval = v9fs_init_inode(v9ses, inode, st->st_mode, new_decode_dev(st->st_rdev)); if (retval) From patchwork Mon Jan 8 15:18:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Van Hensbergen X-Patchwork-Id: 13513602 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9F89352F82; Mon, 8 Jan 2024 15:18:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Aw2e20xD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8BA6C433AB; Mon, 8 Jan 2024 15:18:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704727114; bh=VG1msmn/vAa3BrGkNkxA3mfakhGXdyjY6wcs0iQkjqs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Aw2e20xDtw9RQ683qg0ekxLYO4OG1FjzW2nn0nt3IBJDiEWIvGZ3414kpFi6uF/Vy Vqk9DNvuncKvymhLaLA3UBt9JV43MuyM2CPRaphfg5aEU9ywCACLffV1KviAtbIfVU 3jyASZQJAqTeBcgbqF0MgGCC86ZLxq7oaU860J34CyL1CR+Dl/MDctBMpKyhkaiopR ykPagqHp1F4vhz/EeeZT4TNVlo3fzdPEAuPiaWUTrMqJe4siSlrEAQqq5RrtzhfQzU OjAgGFTVmsUgHcl8iqNUhXfs8fO6mqol2aZ1zlJ4aVF4u0UOKQjprgf+Nk7cysY2Oo T04+24EoMzMjQ== From: Eric Van Hensbergen Date: Mon, 08 Jan 2024 15:18:23 +0000 Subject: [PATCH v2 7/8] fs/9p: simplify iget to remove unnecessary paths Precedence: bulk X-Mailing-List: v9fs@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240108-ericvh-fix-cache-dups-v2-7-a73f8822838c@kernel.org> References: <20240108-ericvh-fix-cache-dups-v2-0-a73f8822838c@kernel.org> In-Reply-To: <20240108-ericvh-fix-cache-dups-v2-0-a73f8822838c@kernel.org> To: Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck Cc: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, Eric Van Hensbergen X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=12689; i=ericvh@kernel.org; h=from:subject:message-id; bh=VG1msmn/vAa3BrGkNkxA3mfakhGXdyjY6wcs0iQkjqs=; b=owEBbQKS/ZANAwAKAYj/1ftKX/+YAcsmYgBlnBJDAjpubxFmBW2aX/5B0LxcVA88T6kQI3h59 KhxPQ8+NDyJAjMEAAEKAB0WIQSWlvDRlqWQmKTK0VGI/9X7Sl//mAUCZZwSQwAKCRCI/9X7Sl// mDTkD/42YEQQ+mlf82tVVRvlipphSP5JXeOxo9QgYdwnl7mJRHoTOu8dFynfs5TPxeu98IjK+TG tdRX5Iyq1skGLeMJ18mEF5GqmM1Q4V5WaTZ2owk8OiCrbFs7zQYLC61UYskUEvTBV+TKBehfEo6 N7ePFDzOpq2Q8uWkzw2POs9l1rIpVX4ipRPAkpaDpb9xoMWY57r23LQwr9FhITL9yyrp4SwPQsr cJX+LNmfN03YpwbK2kQ6o4QZnxKsOxVXo21xRoYPxISlPyiI5+qxI0mZUs/7jjj7HtLgAxuhNDy Xqqslmax7B4viAcaGdPDvkVxQnR3T65zGINtVjBxoso1LE+sdNKLkM6EL8cHnpzG9AvXXdX3fn4 Db7s7sdgXT32dfdeZu5wMLLkfNaXywVYjYDUG1m9VEdP4oSEaPxHcOJ/xk1UXCHAoan9WeOi8JT hjjn+3tFPsbivKMjsqLKMHekfz3V5g6m2vdVoOqZNOjwceFauoI+JSu49rZB1/q6U6t+Vj+2L82 j4pwSIPNtWWw0sRC5wCYgdsIHMnV8Z3mU2JA5bRusfzIc+bDgrU21kWUD6sJSkEr/5e2fG+Md/L m1bbc3hkV136LEgjq2juSFaln0FbgAjxYvPvPFmbdYbmV0xiqBJ1pBo/BLtbqux5y9TdCyPj2Du Z58/5DkMYdgyjtg== X-Developer-Key: i=ericvh@kernel.org; a=openpgp; fpr=9696F0D196A59098A4CAD15188FFD5FB4A5FFF98 Remove the additional comparison operators and switch to simply lookup by inode number (aka qid.path). Signed-off-by: Eric Van Hensbergen --- fs/9p/v9fs.h | 31 +++------------- fs/9p/v9fs_vfs.h | 2 +- fs/9p/vfs_inode.c | 98 +++++++++++--------------------------------------- fs/9p/vfs_inode_dotl.c | 92 +++++++++-------------------------------------- fs/9p/vfs_super.c | 2 +- 5 files changed, 45 insertions(+), 180 deletions(-) diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h index 698c43dd5dc8..9defa12208f9 100644 --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h @@ -179,16 +179,13 @@ extern int v9fs_vfs_rename(struct mnt_idmap *idmap, struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags); -extern struct inode *v9fs_inode_from_fid(struct v9fs_session_info *v9ses, - struct p9_fid *fid, - struct super_block *sb, int new); +extern struct inode *v9fs_fid_iget(struct super_block *sb, struct p9_fid *fid); extern const struct inode_operations v9fs_dir_inode_operations_dotl; extern const struct inode_operations v9fs_file_inode_operations_dotl; extern const struct inode_operations v9fs_symlink_inode_operations_dotl; extern const struct netfs_request_ops v9fs_req_ops; -extern struct inode *v9fs_inode_from_fid_dotl(struct v9fs_session_info *v9ses, - struct p9_fid *fid, - struct super_block *sb, int new); +extern struct inode *v9fs_fid_iget_dotl(struct super_block *sb, + struct p9_fid *fid); /* other default globals */ #define V9FS_PORT 564 @@ -230,27 +227,9 @@ v9fs_get_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid, struct super_block *sb) { if (v9fs_proto_dotl(v9ses)) - return v9fs_inode_from_fid_dotl(v9ses, fid, sb, 0); + return v9fs_fid_iget_dotl(sb, fid); else - return v9fs_inode_from_fid(v9ses, fid, sb, 0); -} - -/** - * v9fs_get_new_inode_from_fid - Helper routine to populate an inode by - * issuing a attribute request - * @v9ses: session information - * @fid: fid to issue attribute request for - * @sb: superblock on which to create inode - * - */ -static inline struct inode * -v9fs_get_new_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid, - struct super_block *sb) -{ - if (v9fs_proto_dotl(v9ses)) - return v9fs_inode_from_fid_dotl(v9ses, fid, sb, 1); - else - return v9fs_inode_from_fid(v9ses, fid, sb, 1); + return v9fs_fid_iget(sb, fid); } #endif diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h index 507dc1389e07..3e9e7df14112 100644 --- a/fs/9p/v9fs_vfs.h +++ b/fs/9p/v9fs_vfs.h @@ -41,7 +41,7 @@ extern struct kmem_cache *v9fs_inode_cache; struct inode *v9fs_alloc_inode(struct super_block *sb); void v9fs_free_inode(struct inode *inode); int v9fs_init_inode(struct v9fs_session_info *v9ses, - struct inode *inode, umode_t mode, dev_t rdev); + struct inode *inode, struct p9_qid *qid, umode_t mode, dev_t rdev); void v9fs_evict_inode(struct inode *inode); #if (BITS_PER_LONG == 32) #define QID2INO(q) ((ino_t) (((q)->path+2) ^ (((q)->path) >> 32))) diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 3b6c9172b40e..498d6b7257d3 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -253,9 +253,12 @@ static void v9fs_set_netfs_context(struct inode *inode) } int v9fs_init_inode(struct v9fs_session_info *v9ses, - struct inode *inode, umode_t mode, dev_t rdev) + struct inode *inode, struct p9_qid *qid, umode_t mode, dev_t rdev) { int err = 0; + struct v9fs_inode *v9inode = V9FS_I(inode); + + memcpy(&v9inode->qid, qid, sizeof(struct p9_qid)); inode_init_owner(&nop_mnt_idmap, inode, NULL, mode); inode->i_blocks = 0; @@ -359,80 +362,40 @@ void v9fs_evict_inode(struct inode *inode) #endif } -static int v9fs_test_inode(struct inode *inode, void *data) -{ - int umode; - dev_t rdev; - struct v9fs_inode *v9inode = V9FS_I(inode); - struct p9_wstat *st = (struct p9_wstat *)data; - struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode); - - umode = p9mode2unixmode(v9ses, st, &rdev); - /* don't match inode of different type */ - if (inode_wrong_type(inode, umode)) - return 0; - - /* compare qid details */ - if (memcmp(&v9inode->qid.version, - &st->qid.version, sizeof(v9inode->qid.version))) - return 0; - - if (v9inode->qid.type != st->qid.type) - return 0; - - if (v9inode->qid.path != st->qid.path) - return 0; - return 1; -} - -static int v9fs_test_new_inode(struct inode *inode, void *data) -{ - return 0; -} - -static int v9fs_set_inode(struct inode *inode, void *data) -{ - struct v9fs_inode *v9inode = V9FS_I(inode); - struct p9_wstat *st = (struct p9_wstat *)data; - - memcpy(&v9inode->qid, &st->qid, sizeof(st->qid)); - return 0; -} - -static struct inode *v9fs_qid_iget(struct super_block *sb, - struct p9_qid *qid, - struct p9_wstat *st, - int new) +struct inode *v9fs_fid_iget(struct super_block *sb, struct p9_fid *fid) { dev_t rdev; int retval; umode_t umode; struct inode *inode; + struct p9_wstat *st; struct v9fs_session_info *v9ses = sb->s_fs_info; - int (*test)(struct inode *inode, void *data); - - if (new) - test = v9fs_test_new_inode; - else - test = v9fs_test_inode; - inode = iget5_locked(sb, QID2INO(qid), test, v9fs_set_inode, st); - if (!inode) + inode = iget_locked(sb, QID2INO(&fid->qid)); + if (unlikely(!inode)) return ERR_PTR(-ENOMEM); if (!(inode->i_state & I_NEW)) return inode; + /* * initialize the inode with the stat info * FIXME!! we may need support for stale inodes * later. */ - inode->i_ino = QID2INO(qid); + st = p9_client_stat(fid); + if (IS_ERR(st)) { + retval = PTR_ERR(st); + goto error; + } + umode = p9mode2unixmode(v9ses, st, &rdev); - retval = v9fs_init_inode(v9ses, inode, umode, rdev); + retval = v9fs_init_inode(v9ses, inode, &fid->qid, umode, rdev); + v9fs_stat2inode(st, inode, sb, 0); + p9stat_free(st); + kfree(st); if (retval) goto error; - v9fs_stat2inode(st, inode, sb, 0); v9fs_cache_inode_get_cookie(inode); unlock_new_inode(inode); return inode; @@ -442,23 +405,6 @@ static struct inode *v9fs_qid_iget(struct super_block *sb, } -struct inode * -v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid, - struct super_block *sb, int new) -{ - struct p9_wstat *st; - struct inode *inode = NULL; - - st = p9_client_stat(fid); - if (IS_ERR(st)) - return ERR_CAST(st); - - inode = v9fs_qid_iget(sb, &st->qid, st, new); - p9stat_free(st); - kfree(st); - return inode; -} - /** * v9fs_at_to_dotl_flags- convert Linux specific AT flags to * plan 9 AT flag. @@ -605,7 +551,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir, /* * instantiate inode and assign the unopened fid to the dentry */ - inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); + inode = v9fs_get_inode_from_fid(v9ses, fid, dir->i_sb); if (IS_ERR(inode)) { err = PTR_ERR(inode); p9_debug(P9_DEBUG_VFS, @@ -733,10 +679,8 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, inode = NULL; else if (IS_ERR(fid)) inode = ERR_CAST(fid); - else if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) - inode = v9fs_get_inode_from_fid(v9ses, fid, dir->i_sb); else - inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); + inode = v9fs_get_inode_from_fid(v9ses, fid, dir->i_sb); /* * If we had a rename on the server and a parallel lookup * for the new name, then make sure we instantiate with diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 61811cf5d9ff..4d3ae108ac7e 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -52,76 +52,33 @@ static kgid_t v9fs_get_fsgid_for_create(struct inode *dir_inode) return current_fsgid(); } -static int v9fs_test_inode_dotl(struct inode *inode, void *data) -{ - struct v9fs_inode *v9inode = V9FS_I(inode); - struct p9_stat_dotl *st = (struct p9_stat_dotl *)data; - - /* don't match inode of different type */ - if (inode_wrong_type(inode, st->st_mode)) - return 0; - - if (inode->i_generation != st->st_gen) - return 0; - - /* compare qid details */ - if (memcmp(&v9inode->qid.version, - &st->qid.version, sizeof(v9inode->qid.version))) - return 0; - - if (v9inode->qid.type != st->qid.type) - return 0; - - if (v9inode->qid.path != st->qid.path) - return 0; - return 1; -} - -/* Always get a new inode */ -static int v9fs_test_new_inode_dotl(struct inode *inode, void *data) -{ - return 0; -} - -static int v9fs_set_inode_dotl(struct inode *inode, void *data) -{ - struct v9fs_inode *v9inode = V9FS_I(inode); - struct p9_stat_dotl *st = (struct p9_stat_dotl *)data; - - memcpy(&v9inode->qid, &st->qid, sizeof(st->qid)); - inode->i_generation = st->st_gen; - return 0; -} - -static struct inode *v9fs_qid_iget_dotl(struct super_block *sb, - struct p9_qid *qid, - struct p9_fid *fid, - struct p9_stat_dotl *st, - int new) +struct inode *v9fs_fid_iget_dotl(struct super_block *sb, struct p9_fid *fid) { int retval; struct inode *inode; + struct p9_stat_dotl *st; struct v9fs_session_info *v9ses = sb->s_fs_info; - int (*test)(struct inode *inode, void *data); - - if (new) - test = v9fs_test_new_inode_dotl; - else - test = v9fs_test_inode_dotl; - inode = iget5_locked(sb, QID2INO(qid), test, v9fs_set_inode_dotl, st); - if (!inode) + inode = iget_locked(sb, QID2INO(&fid->qid)); + if (unlikely(!inode)) return ERR_PTR(-ENOMEM); if (!(inode->i_state & I_NEW)) return inode; + /* * initialize the inode with the stat info * FIXME!! we may need support for stale inodes * later. */ - inode->i_ino = QID2INO(qid); - retval = v9fs_init_inode(v9ses, inode, + st = p9_client_getattr_dotl(fid, P9_STATS_BASIC | P9_STATS_GEN); + if (IS_ERR(st)) { + retval = PTR_ERR(st); + goto error; + } + + retval = v9fs_init_inode(v9ses, inode, &fid->qid, st->st_mode, new_decode_dev(st->st_rdev)); + kfree(st); if (retval) goto error; @@ -132,6 +89,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb, goto error; unlock_new_inode(inode); + return inode; error: iget_failed(inode); @@ -139,22 +97,6 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb, } -struct inode * -v9fs_inode_from_fid_dotl(struct v9fs_session_info *v9ses, struct p9_fid *fid, - struct super_block *sb, int new) -{ - struct p9_stat_dotl *st; - struct inode *inode = NULL; - - st = p9_client_getattr_dotl(fid, P9_STATS_BASIC | P9_STATS_GEN); - if (IS_ERR(st)) - return ERR_CAST(st); - - inode = v9fs_qid_iget_dotl(sb, &st->qid, fid, st, new); - kfree(st); - return inode; -} - struct dotl_openflag_map { int open_flag; int dotl_flag; @@ -304,7 +246,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); goto out; } - inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); + inode = v9fs_fid_iget_dotl(dir->i_sb, fid); if (IS_ERR(inode)) { err = PTR_ERR(inode); p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err); @@ -399,7 +341,7 @@ static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap, } /* instantiate inode and assign the unopened fid to the dentry */ - inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); + inode = v9fs_fid_iget_dotl(dir->i_sb, fid); if (IS_ERR(inode)) { err = PTR_ERR(inode); p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", @@ -834,7 +776,7 @@ v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir, err); goto error; } - inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); + inode = v9fs_fid_iget_dotl(dir->i_sb, fid); if (IS_ERR(inode)) { err = PTR_ERR(inode); p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 8d14cc0b3916..6d9a98c57185 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c @@ -139,7 +139,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, else sb->s_d_op = &v9fs_dentry_operations; - inode = v9fs_get_new_inode_from_fid(v9ses, fid, sb); + inode = v9fs_get_inode_from_fid(v9ses, fid, sb); if (IS_ERR(inode)) { retval = PTR_ERR(inode); goto release_sb; From patchwork Mon Jan 8 15:18:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Van Hensbergen X-Patchwork-Id: 13513603 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C6911537FF; Mon, 8 Jan 2024 15:18:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="G8W5ldSG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5AD5C433CB; Mon, 8 Jan 2024 15:18:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704727115; bh=JAXtta6eBaQuUW49iLcF5j0hoJdzALXBq37p3uzPtxo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=G8W5ldSGTcXe1wI85QiNk/R4Nt5M91jkwxAgBe7JJWfQVHEnkgQGFTbv6dOrakM5w gc9ZTQ75jGGpTENuwGqaq7ouk57FJdGulSMQHIBlQwpo1CSQmQDvlkyVT5WqMesilS k3SuOPvJNU7DOgq8jXIxtfQYV/XYoZ1/d4dRLvLhReGCi3M+OKBfdC3wlgJF+quFi3 L/86jSQk+SAMPcRpB82COCFopTbp/0SrP6l2Dbn+FCUcdI6n9ReBoE7c3eDGnIGCQf YpLNhI9nUhjrENtUo5gQo7W0CT+ug7ZUwKnY3F1InrYA8ZVYUzMp7gQXpiRn99cCOZ pO66HJ+wrohgw== From: Eric Van Hensbergen Date: Mon, 08 Jan 2024 15:18:24 +0000 Subject: [PATCH v2 8/8] fs/9p: fix dups even in uncached mode Precedence: bulk X-Mailing-List: v9fs@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240108-ericvh-fix-cache-dups-v2-8-a73f8822838c@kernel.org> References: <20240108-ericvh-fix-cache-dups-v2-0-a73f8822838c@kernel.org> In-Reply-To: <20240108-ericvh-fix-cache-dups-v2-0-a73f8822838c@kernel.org> To: Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck Cc: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, Eric Van Hensbergen X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1475; i=ericvh@kernel.org; h=from:subject:message-id; bh=JAXtta6eBaQuUW49iLcF5j0hoJdzALXBq37p3uzPtxo=; b=owEBbQKS/ZANAwAKAYj/1ftKX/+YAcsmYgBlnBJDMKN7uTDozbiBwYw6Uw+238ExMxgmeCOXH MVtGpdR1/6JAjMEAAEKAB0WIQSWlvDRlqWQmKTK0VGI/9X7Sl//mAUCZZwSQwAKCRCI/9X7Sl// mAAnEACF+V9GYs3urXSoT14H4gdEtiV8xD2pN2kphsn7+ltgzvWpkOPglthv7i2EcrX6IFLUaMY BqITnL8z0RjKO8FY5MFcoUiz+5ROo2gr63Me1HOYmJb4H+lH5Xj/XmBGTltdtZpblJhcpAD7xI6 mQxAB85VQp7jzbCO7Vj5Aamf/SlIyD/CI6yYh0IRI7XBJG2b7AzjeUP2iKWXAHqnnX4KTiOptHn I/adoxCTrkL5wJixuFYBGRLNGWlHBrkntkGse65utIbuHOGKADPU+u0kxnw6FUGE/vjIMQt0vdF fk45nf4YHmvvyxYcuvgN11ua4e38hJs8dfKMRNOlBNEZ21Ck/87LtT/6mZNZzZWt5U+DLOsNPGH V7zB8BExdew9hrai/DkW6QBkPIBo8YLBBOShuLskj52H8XLT/D1YX0gAImgvDtMOcG7TvAQbthS OXTfa+040u8xfVK7TpGCwbsGw4uhNGe/oaLZr8HFbHGrNXziiUUBeLrVaHp2a13wcS1sBqZ8jI6 Fzm3S29DkK8OLmZA8kSbqXAGEN/+7UbZnLpbIlMNvIzbjtZhKjLUAmFYtpaTTySBjZ01oRjTaiw ga1EE8R+v46LgJLD43Ri9p+yqld9tIgHY036w+1Xh4EsKk/XRiyg7QIvguTMfz1M0a7nanGP5O2 rfsuDmgHuskwUiQ== X-Developer-Key: i=ericvh@kernel.org; a=openpgp; fpr=9696F0D196A59098A4CAD15188FFD5FB4A5FFF98 In uncached mode we were still seeing duplicate getattr requests because of aggressive dropping of inodes. Inode "freshness" is guarded by other mechanisms when caches are disabled so this is unnecessary and increases overhead of almost every operation. Signed-off-by: Eric Van Hensbergen --- fs/9p/vfs_super.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 6d9a98c57185..a898dbf97710 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c @@ -244,21 +244,6 @@ static int v9fs_statfs(struct dentry *dentry, struct kstatfs *buf) return res; } -static int v9fs_drop_inode(struct inode *inode) -{ - struct v9fs_session_info *v9ses; - - v9ses = v9fs_inode2v9ses(inode); - if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) - return generic_drop_inode(inode); - /* - * in case of non cached mode always drop the - * inode because we want the inode attribute - * to always match that on the server. - */ - return 1; -} - static int v9fs_write_inode(struct inode *inode, struct writeback_control *wbc) { @@ -303,7 +288,6 @@ static const struct super_operations v9fs_super_ops_dotl = { .alloc_inode = v9fs_alloc_inode, .free_inode = v9fs_free_inode, .statfs = v9fs_statfs, - .drop_inode = v9fs_drop_inode, .evict_inode = v9fs_evict_inode, .show_options = v9fs_show_options, .umount_begin = v9fs_umount_begin,