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: 186036 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1084661dyq; Mon, 8 Jan 2024 07:19:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IFZoTkq1XgWPwSKQtxLMB9Dono7s+TJXct3DeXxVPeV2NzWW0avtPQCvFPdhmEYfyvvdTzS X-Received: by 2002:a05:6a20:432b:b0:199:6a8d:4b47 with SMTP id h43-20020a056a20432b00b001996a8d4b47mr5293031pzk.92.1704727148554; Mon, 08 Jan 2024 07:19:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704727148; cv=none; d=google.com; s=arc-20160816; b=d4DvvVqgb3gkvxq/1ZWZFcHARJghoAAKigzdchjLwSaNllXeZA2hp68DI7pCOnZ6hv RcG44ZNe1kKiXHVcK7WARwa16V8v0xq6+1rUAPvlY02TbMk7fTkkACwtl8BwAFPzigt1 XlQvJdASSSrqiEcI4F/qGNSk2aQxNQ9loFmb630ZpOW2q+ivul9PQT/xAOqrTBmse64z A8qNDlDzswrQPdgCOSL/AfUpPVgvAvzwi+xpdjODQxvJ9gYzubxOszLXo+XEbms621dR A86db5S6m/ui19FrTjl4qxiNRtN03/gXz0PGi6XZb7FjWhDVKQlL4/SmETayFn1NSSa3 wlbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=f6Zbmxe9kB3idnjeYXjdFSRIS52myKN0cOB0cHARXeE=; fh=34zNr7a0BVYUu9GLC6Z8rO/FcAceqP5NONmRFRP2POA=; b=iRLlfe9FQBwSuqeF2McQnSmOInLBhUEInPw2kz9jhivnJfQe9knnGhbdGdJWHg89hf d75aJprvb6kCWeq31+CZwzlB6PKJWDylSeVDMqLfHKnLEYIhtY4gjF0nagp5j3rKm5G3 r7aJtPyLwMJy/ucv6teZNZmnZr6HTtPyN7nEdMP6fzNAgRMUYlSxMcNAY1OUiAWKbdaw 5iOJKikzCmLf/6ODaWxbJXWduA4H/VASJf9WdAJUgHYaQIFdWiOss89unt0hNRgc4EyN PHblI3AsOMjIIpuY3qkaf0KmyvKIt+X88VULpOQzdPEvpoZUN/mKjkIQESy4n3fSRd/y gKFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gvJFHb9X; spf=pass (google.com: domain of linux-kernel+bounces-19747-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19747-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y67-20020a636446000000b005cdf851b5ffsi5981627pgb.537.2024.01.08.07.19.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 07:19:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19747-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gvJFHb9X; spf=pass (google.com: domain of linux-kernel+bounces-19747-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19747-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 529A0284799 for ; Mon, 8 Jan 2024 15:19:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E24F51C46; 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="gvJFHb9X" X-Original-To: linux-kernel@vger.kernel.org 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) 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: linux-kernel@vger.kernel.org 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787535973975453365 X-GMAIL-MSGID: 1787535973975453365 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: 186037 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1084923dyq; Mon, 8 Jan 2024 07:19:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IGy5ngtYoolFT+qp859BZVEK7J+xzJCNiFFHanFNZNGi0mR8AcaoG0MOOsvvUFTvKyjvE1A X-Received: by 2002:aa7:8887:0:b0:6d9:bc39:e5ac with SMTP id z7-20020aa78887000000b006d9bc39e5acmr1625784pfe.6.1704727166724; Mon, 08 Jan 2024 07:19:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704727166; cv=none; d=google.com; s=arc-20160816; b=iAjTLShjrWsXNkn1modkvwOzPFoYB8C3fWdVLsZfDul70v8obeMA5RWgRzWB4z4no1 A4i0sMy8V4Vk7+gC4bt9oXT4QlihbuiqyBNkMJ7smFs18zN4JySf/ws/pjcPcC7Jbvwu Z18vbniL4kl3CgbbxHID4jJDhDRto2FW8NJGNdywthR9FRJHlr1tzUUagdFEbF4PMkfN zs0rqkvOELWESiB65vaD62alPWXwWKC57M+Uf8XqKaj9xKR+KZrcse+blqFzOy306Xjr Cwo8IOxtyVWgIwe+kKJsf9xRCuuKw4JdyLyqrmAFSUBUfYEs3mvtP0DmBi0WRsO4rZsk E3lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=lnIZsL+Gfm5vt9T1Ku0R0rqDGcsChXoKQb6rnEU1r2I=; fh=34zNr7a0BVYUu9GLC6Z8rO/FcAceqP5NONmRFRP2POA=; b=Cfuk6QlWdlrvTdG4MPNa1kS9qm88f5NK5vs/MFT5nxF5Vnk05mJILASDXQ3BqVMgVk 04E0EkdO8kG2+QoYe15LXtx2P1C8ZM1PtEOK11ZZwGqbQsHG833uHSp+sxqsM5B/mGQX RviRl/NPcmGECJx5/9u+trBiMSKZCZ7YOLo6CWMvUIdPPFIg9Gd7rmF+mtmxAAxQ1H2B +dumIc2v6apGvliWwKjdj/CfA+3/wL9tOv6ktLsYwJyixW1slAOVJmk+J0wSt0qkh5BH rK7JBIJg919s493UZDx8hYpSXF1owix1YiOX+cuGp6Ep2OPYVZavCDJNDUTC6zlAcOi8 q8fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bqXvlbXp; spf=pass (google.com: domain of linux-kernel+bounces-19748-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19748-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x19-20020a63f713000000b005cdf80f8417si6052998pgh.871.2024.01.08.07.19.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 07:19:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19748-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bqXvlbXp; spf=pass (google.com: domain of linux-kernel+bounces-19748-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19748-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7D940284815 for ; Mon, 8 Jan 2024 15:19:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 670EB51C25; 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="bqXvlbXp" X-Original-To: linux-kernel@vger.kernel.org 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) 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: linux-kernel@vger.kernel.org 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787535993418562907 X-GMAIL-MSGID: 1787535993418562907 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: 186038 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1085103dyq; Mon, 8 Jan 2024 07:19:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IF4QInuaD7gogiDhte6lWOERhF9wz7VstTG5wE5gqKbFx/hxIp+9J9wgrg91hK0pGM4xhnC X-Received: by 2002:a05:6102:c91:b0:467:d491:6886 with SMTP id f17-20020a0561020c9100b00467d4916886mr685236vst.18.1704727182212; Mon, 08 Jan 2024 07:19:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704727182; cv=none; d=google.com; s=arc-20160816; b=FlR0nvDRaOmV2qZXxX9BXqTFkI37NHBiNwIfcPoTRF0Ch6YcOPY7uODMXstt4HWPYJ b2uhyBThPTi0709z/QDZb1uYiBFEfmxRVU2+FbLvuDAOsx0OoiYPrToBjtdM0b1vxN88 ls4yXhgYq0N28pra9gJk8T46AlK4cQDSnwyLZlcT+xROlK5/9IJ6pjjpa6Ray8IIs/Z6 HYTlcVxEp0JNcMOIRUBdQ7jmyn/oj+zDJGK8e8WuWSEWhc4Yke/e63osNf9cICQ5G7n7 KNFmU+3vzYBXVqn1IzbmRyv55ZAKkeDujdmVBQDpJLy/1o7aSDhiOYEfxSFic79f920s iTrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=Rwdw58Y8gLiYT2QdnhFMhSRiJEnNp8CQMuTIGa5sAyo=; fh=34zNr7a0BVYUu9GLC6Z8rO/FcAceqP5NONmRFRP2POA=; b=I6sx7pIUfoGRlNlwacGE9FxhCDvmtQOtD9lSoyH51v80M6R4Ddy6p3n2TgYUt74z9n /h9clKrSkCq0BGPMOavFFhtp+XBwkkA+a+V5v9vfXsBlQ+5GmDyfwIE9EreJ/5vm/4n8 nbVWe0Kq3RWMRo8IRzEPgT1wXo9HyVIJQI2u/MN0hwX/fVtF/9dLSokCooRVY7YBeAlb ZPSXesPfnuqf5tSnudF2jAhMQFst7ExjrD7FfYSo3NxZHxDGFUfuNUEOBc2sfhfY+Ly6 dnFtRfiECWAl5lyrxvNT1tnrewUbqCFLqCRL8hgpBhvOdqCiBeKukAUj+Bg2Q2RMq2Hk 8HmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="MAzeK0/I"; spf=pass (google.com: domain of linux-kernel+bounces-19749-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19749-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c4-20020a67c404000000b004670809bd16si29382vsk.182.2024.01.08.07.19.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 07:19:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19749-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="MAzeK0/I"; spf=pass (google.com: domain of linux-kernel+bounces-19749-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19749-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 02A771C22C95 for ; Mon, 8 Jan 2024 15:19:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4416D4C3DC; 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="MAzeK0/I" X-Original-To: linux-kernel@vger.kernel.org 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) 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: linux-kernel@vger.kernel.org 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787536009479816985 X-GMAIL-MSGID: 1787536009479816985 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: 186039 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1085302dyq; Mon, 8 Jan 2024 07:19:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IGvMMumawp1lvRzrr5PNp3PLTsb/cQoGa8s0a9k3EZvgXyY7mv90X/tAlRiaWVNOgOricUP X-Received: by 2002:a19:5e14:0:b0:50b:f0df:57bb with SMTP id s20-20020a195e14000000b0050bf0df57bbmr1591649lfb.49.1704727198224; Mon, 08 Jan 2024 07:19:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704727198; cv=none; d=google.com; s=arc-20160816; b=anKqt8MfYVJphXlaYz0tOPBuhjw7X9oLa6Z5KuZulAFinVFbRpsEUGlqycwzFDFk75 QiuWrjnFXysLVE+AbK7xHqQblIRvhcowJvxUPV9G7cc464l8eF0NGIbXTmnUuxovLCQ1 Uj1yuychkkt7K6jTob7lU95U7l8GAdzBbV/sKMdqEmIYaMT9znf7bzWTr3xGmU4UqT+V b2pyA+ChqtPlTNcwpFqCH2wta5JQhz8mLGirBu6QRjalIB+P9AwomAEf6aMR94VgtM/w P2XYEU80IoyuSZ4rOpABw1IuciBiUBSkODVIeE+BcCCdpbaTr0Kan12SDc8QzDyoWGwZ FoSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=D84cyZM9KCM4kCuK+16OY0oEvsoyvtTov+D3WEVZuYQ=; fh=34zNr7a0BVYUu9GLC6Z8rO/FcAceqP5NONmRFRP2POA=; b=Zp1FzfNwksDma/zpGfv1NzHrQB8O8G8gKyadZfs34nyb7xBtGo39XNZBp4F5++PWwb ZmlQNtGc0Onk/dh2bsTdmQ9kpK+ADhC+Ol2O2/bpnS5xMQWv4OrVc8GjSRSFOz4Plx3w OK0Yk4NHLjLXRfSizEynVvdZ9MtE2695vHOp2pggJkBzEq0Bo6HLmC4qh7Q2dybb/3cI +mi/XrMqA7LCR7YW/A7K4VZmuWw+H+KOIqEG1eQom7bwU/unCHDmfAERwmSz6MdT7AKV 9i+0Kwmz6j/PuP7LJOKCsbO1xmnJ6S7RA1qQE+nYxACnqSRNOEX3xscB+XiDJ0SCrvZE Pvyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aol7eVIA; spf=pass (google.com: domain of linux-kernel+bounces-19750-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19750-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id dg25-20020a0564021d1900b00553d7f28c10si3339240edb.550.2024.01.08.07.19.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 07:19:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19750-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aol7eVIA; spf=pass (google.com: domain of linux-kernel+bounces-19750-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19750-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AB3691F23922 for ; Mon, 8 Jan 2024 15:19:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 052A252F99; 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="aol7eVIA" X-Original-To: linux-kernel@vger.kernel.org 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) 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: linux-kernel@vger.kernel.org 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787536026202734556 X-GMAIL-MSGID: 1787536026202734556 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: 186042 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1086792dyq; Mon, 8 Jan 2024 07:22:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IEOETn1/WSPloR5ropqS/bPx05crQ7jJ3QMddzU1zfbml7N6iaN4QMMNVjBqjqfNrgewRXp X-Received: by 2002:a05:6a20:8e04:b0:199:9a74:f227 with SMTP id y4-20020a056a208e0400b001999a74f227mr923539pzj.28.1704727331663; Mon, 08 Jan 2024 07:22:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704727331; cv=none; d=google.com; s=arc-20160816; b=ZmHzOEdtcbzBERHKrIV8KiCDY1A8IA4EGc2T36JMtErc5nb9OwIJEtzsmOTXrV1IEZ /nUw8zk4dGEnHYjtrSk/yZogZf2dA4dvRW05A8VFLOakVf9to7JFqpAP0oi5AtGbVhO7 qEadSURDzP3qVTqF824rn4uswzSGJdJkTW0Ep2Mfa0KgMx6ea3WTQzjPI38l9nEZvgEa JfiPvlEgOSN4hX3nx5aOhPlKffptxOMcDzztuquT5WIrQqvjEpPESeDAdGLwkNcJOg9o Nt6tsgqaBCnl4TIHnAiyyWx2M/1Qw0NxuEHi1tPd7hZfW+OaaIFuxoe86QlKITVjiZLF JyTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=F0SiCdRrogFaqcO9GPfQ2lvU4hRmgKB6mjy3RGJ+kns=; fh=34zNr7a0BVYUu9GLC6Z8rO/FcAceqP5NONmRFRP2POA=; b=QvXUCDDxdjkdjBCdEw02kfRhVcaJAxvqqT7rvx8w2zcA1YB/Im7pCgICnd1Sr99S1T IwQ+Ms13h+5p69jQv0j3hZSbQJhjBadkep/+NwHwA8dzEa60mC2ew7toKUTYsoPqUzow di+QhrEVplvOXlv56l2wg4r7/kEAvhfOoGDlkTvz7qNUA2npmXYRFCV/3T2Eh1Xu0+CL e9SSpZPCAZxWzDHWMzNqGt47ANs9F5ucTGgNLZfnrF2k2vUKk8qbxRgZInOPUN3UJc+7 C5oq42tiA8k8TPxqjgcv1x6lNNx4DoaPTjZ5dr7xnRkehhEJqxbuUWSiajKiHMxYWrj3 E7SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PuQmyRVl; spf=pass (google.com: domain of linux-kernel+bounces-19751-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19751-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d31-20020a631d5f000000b005c6eb3502bfsi6272573pgm.309.2024.01.08.07.22.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 07:22:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19751-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PuQmyRVl; spf=pass (google.com: domain of linux-kernel+bounces-19751-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19751-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 39C1AB22E29 for ; Mon, 8 Jan 2024 15:20:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 86B0D537F1; 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="PuQmyRVl" X-Original-To: linux-kernel@vger.kernel.org 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) 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: linux-kernel@vger.kernel.org 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787536166552664373 X-GMAIL-MSGID: 1787536166552664373 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: 186040 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1085598dyq; Mon, 8 Jan 2024 07:20:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGblJZ56koX92w1dCRFJ79+gur7WtQgoNPS+TovMVUb5d++7Xq2RmnoJlIiwXqaMWnjZccP X-Received: by 2002:a17:90a:c481:b0:28d:2521:4695 with SMTP id j1-20020a17090ac48100b0028d25214695mr1135576pjt.33.1704727224575; Mon, 08 Jan 2024 07:20:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704727224; cv=none; d=google.com; s=arc-20160816; b=Ityv1lZJhw+P90MhS/CmOeMNCH+kdT369xYS4YTGaGb+AcWQpMjOzs9xE1O//AHpmZ BXdd5k6HMTp4fQ6KYA5qpZGOP+ULZ1FHV3RwsDmsEdcl7pXvAB7I3JEF+rUEQTYyHplX REE0otwx4fB5MWAeqQBbZHW2QYXAZ3TRjw96ORjQ5oVB0xx/r+v02qo6uAriEvfS27wN v1XwYEXHkXcWKwAeACb1PgAbOs1l5ul7zv0E/FoQXPFhLQSODUh9+DlFiOViWwuqctwE QLm0P3Kx9Xx45ssrEP2UU6/iI1nnVdn0VPWLK4hxczldllX1itM6XJWXx8qvRefwODAB E/Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=CcjGYx1VWsFeHxEJO52PXjLynVglD+gvQZiAKRtZJUQ=; fh=34zNr7a0BVYUu9GLC6Z8rO/FcAceqP5NONmRFRP2POA=; b=KC0uOGL+lOdvAbp3Il0KHX5EYAeRzgE4e/IGIGzzpxKIhPOl7dczrwsCEf08Gt/Mn+ AUfBgfz6cNagYtODE+HrmNcs00INkge4EGEMwke4uPx+dVuRGwRuPu1T4g6HmOrFeWEp /p4aDnR++XJZ+PJEJf9Jk9nFdnKhATXOKcHvW2IB6zC883Di/uWxY6O49PS/PAvt0XOY g9X7nXfGE2l32+iQEyGpolAwSS6DxvH+3XOfNKKX5YTIXzln+QjxMb+RY09UbqcQhlMc kIlex1J09PldjJnhJ7d2290w1DRJvWbm9brBeSGMomWeL6gC+pTOYr4ojAz6xq+zKzO8 /iAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LScFmDDD; spf=pass (google.com: domain of linux-kernel+bounces-19752-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19752-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g7-20020a17090ace8700b0028b2a3f210esi5815069pju.20.2024.01.08.07.20.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 07:20:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19752-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LScFmDDD; spf=pass (google.com: domain of linux-kernel+bounces-19752-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19752-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 447EB281456 for ; Mon, 8 Jan 2024 15:20:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9971953815; Mon, 8 Jan 2024 15:18:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LScFmDDD" X-Original-To: linux-kernel@vger.kernel.org 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) 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: linux-kernel@vger.kernel.org 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787536054293336065 X-GMAIL-MSGID: 1787536054293336065 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: 186041 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1085743dyq; Mon, 8 Jan 2024 07:20:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IHNMjWQl2U2BlzV47EdEdiwCduFzXo7FZ/CvjZrk+14EfB7YKximAZH0ECel08X+PVgiacu X-Received: by 2002:a05:6102:524b:b0:467:a40b:a1ef with SMTP id bu11-20020a056102524b00b00467a40ba1efmr1167604vsb.71.1704727233918; Mon, 08 Jan 2024 07:20:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704727233; cv=none; d=google.com; s=arc-20160816; b=SNB/FcAxRVSo4f8ijo5ZJRR7LmUeefREw3u2hB1Je2Zlb8Vl9QS1eeJtyII7IOs4Qs fXJkdvG5bj0tPwHewFmTjik1sY4x+hw0qJMJq2j+smFyImBEp/7Y8l4lHhDQEHa1qa12 GQO5JU//xQ+viIydtmokO4gWMnfgUWXYcPQ7Wl1UvjrtfaT3Fi8Dt2htcK9TfveCW39/ XDAln8Gon32Oy2ihT6vcYDgJ/K6tcAkOecFWyuoL8QR/uRQfnXR2dGr5DNoDKGSo5OS8 id9f6jKhdUiia3ANVmxAsUyprs2qDjPxLrtdJwEt5kdESTz94evHw1DXqnpalHkXXxkG IWHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=diPLra7mkmmkAZzzS7U3A8hQWO4apGgfHgAPNcoxfpE=; fh=34zNr7a0BVYUu9GLC6Z8rO/FcAceqP5NONmRFRP2POA=; b=PDBTc6ND2poO3j4Pb9Lb+QbJUEFIPcbWp1Bhlxm9rVODVuuDlTf1UKZwkOZybdarwj wltfm/PgH4dRPZLZn2o8Usa4FZS6djrB3dscKBk5KEa85SuJXdLS+keW4xp2xnPmTYoW ascKaNyjOBDqPAafTz+uJ1lXAQAuTmtByZcm2c47HLSZHEidVxmZUtSJCt1ylE7Kq1NU sMnPfNPR5n7/0t60XP24bbwt9wSaHAH6erK4G57I8H59vwCD2Ouj9VSym89nLSdHKHiB Ji3oTSNNm8CRMWsxZ8bKJz4py2qnMdKzPE73d4mnpolmZn7cewTe7bq6ivIpp5dr1zW6 /myg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Aw2e20xD; spf=pass (google.com: domain of linux-kernel+bounces-19753-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19753-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c4-20020a67c404000000b004670809bd16si29382vsk.182.2024.01.08.07.20.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 07:20:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19753-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Aw2e20xD; spf=pass (google.com: domain of linux-kernel+bounces-19753-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19753-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A0F501C21525 for ; Mon, 8 Jan 2024 15:20:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3719653E0C; Mon, 8 Jan 2024 15:18:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Aw2e20xD" X-Original-To: linux-kernel@vger.kernel.org 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) 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: linux-kernel@vger.kernel.org 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787536064047649863 X-GMAIL-MSGID: 1787536064047649863 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: 186043 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1087232dyq; Mon, 8 Jan 2024 07:22:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5cPVpnPlqxlTY+uJIRCd45BPzOrRl05tXEZLL2ZYm7B41jY52pBUcnauks3mDm9HmhtGB X-Received: by 2002:a17:90a:c78b:b0:28c:9781:d91c with SMTP id gn11-20020a17090ac78b00b0028c9781d91cmr1103447pjb.62.1704727373296; Mon, 08 Jan 2024 07:22:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704727373; cv=none; d=google.com; s=arc-20160816; b=AoYD6Jr7ARMk1SZQ0v9qcyqpBkPEz960qGdUt0cJFB50DUmC5QezmfgXvkQJRnPs0D Z5pu3CE2pLaoX/+xDQIXzPjBhmN/VHV0wprI0ZCTuK7yyYPTrdddr7YcbH02OOyfo4fX wxXdhLmkE+iXWQLn8GZ/MDcXzkRZfBWQwpSiwr+RBlwSWDHzt9JwEK2Ak24KN3Ie3kVT MTYRkZqatTzCc8dkeN3KQ0WFMfRbT7rC4jAU8Ezrc3mraJTeBcV4RA4xhLy7L6wId7zi 87JGP0iM1TNXb2Mgc0elzaLYTCb8Th5o/J5fnxTphbN6+0bkEkZOXnIDloAtAJgEboHe oGIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=aAp8JzQ/iXJQ9THNQbEuCBnObc0SbaPvIRg+91A+vNU=; fh=34zNr7a0BVYUu9GLC6Z8rO/FcAceqP5NONmRFRP2POA=; b=FU4o6+WdUM3gTz1SzvVdRiC0rbLBJ/cVCZi8WwxLlWQlOBC3uvQBWgBgu0KcnPQc9X urJfTpGn3z084DVnOeKADjcvAENifrT3+tuA9gsnDgssub/vGUzUuOeH0dPGs7Ad9aZ2 BwXJZx0mktrx9Afrse1CWJOEjosotbOAaddZnrEfPkFyoI6ktXTwTj2AoFMfIhB1SpyV dykwnxjzOkTHo5Ote5hBNDfh3cyR/Z0mnv7FfoDVnY5J9fnYepxqVDUfp3cNY+K6I1ub GuYHRLkAPhOUpJuts8I0iZAUJwGmNkTYOUdZYxazsfeGvwSM5Y/zgrRd4gqHRoG4Qdzh 3qXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G8W5ldSG; spf=pass (google.com: domain of linux-kernel+bounces-19754-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19754-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q7-20020a17090a9f4700b0028ca417b2fdsi55846pjv.106.2024.01.08.07.22.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 07:22:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19754-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G8W5ldSG; spf=pass (google.com: domain of linux-kernel+bounces-19754-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19754-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4B770B23047 for ; Mon, 8 Jan 2024 15:20:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6182F53E1F; Mon, 8 Jan 2024 15:18:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="G8W5ldSG" X-Original-To: linux-kernel@vger.kernel.org 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) 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: linux-kernel@vger.kernel.org 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787536209934377127 X-GMAIL-MSGID: 1787536209934377127 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,