Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp1809667rwj; Sun, 18 Dec 2022 16:15:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf7/Jde68mHSFh7pa4B/48jt2phwyvs08mORkAdmvEJOsQieNuaZVVp/S/8+cVSjn/s/LPd8 X-Received: by 2002:a05:6a20:9f4b:b0:a3:8d47:6aa9 with SMTP id ml11-20020a056a209f4b00b000a38d476aa9mr51638587pzb.34.1671408933861; Sun, 18 Dec 2022 16:15:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671408933; cv=none; d=google.com; s=arc-20160816; b=vOfqAPZ5vpbfhE4V44wBEJ+e3Dkvn8S5muhKAhaLp9YHS/9BJGQQqEq9T4VCyQFQzj 5e6IOQ4NuGYlokuGq2k+s02wJK1yJqkAyQNFvTUcngX16vrFmSa5rP9B6LgCamr5d/k6 QWCsX+NSa4QP6FztRSU85ZbcmB6HdT+KjmtXI9B/zwv2ay5clX1FxM+bPMQ9+B8wBbrv djwKPh2XccTlblIA+oBtz3Uc/RjzJ/wlaZfYSBjuYihnbLl+fxsRYrSVT/hZWiKx6sEV HUJHUXlm3o2JcC/WnSecH7sgTJoMq0KI30wkpox7m0J0ckKO8G6M3VdbqyvNOltQoxKt emeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=22z3hM7ajo6v6alaXwjTYA9bNfBA2cVdMH1XeN/HN8w=; b=j1hGF/qOvWTg1Wu7guZQouFtWzF5HneEYRJyb8b9Y+g7c8Bs3j+XDEcWKY31zluh7D 5rL5uy45oTtsp36iSyX+XTajrtrf3Jj9m/EmIg/g0RbdR2AdprIA5ZA0SpQ5LSOwto1P iBHfjievalMv8WsBGYEOfYHM6KZXzQ/ye/6AFJ6gLkp8WtUYPMTUg3xayy5/wpmujBAR uBlWnTmTZ4c10vAYB2pXelRA600ZqDeFDej/0Cpjsj8YK3bnpvdDRsjAZUIrz79uGEpY RubAg7kyoqeNHRiGDfidiD+GiuouPrvg7AX1lG5f/fOHopzrd7MgFaV6qjZ5TzSzTNXB fdRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@icloud.com header.s=1a1hai header.b="AhGZ/gRl"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=icloud.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bd9-20020a056a00278900b00576b2758a55si8684762pfb.46.2022.12.18.16.15.23; Sun, 18 Dec 2022 16:15:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@icloud.com header.s=1a1hai header.b="AhGZ/gRl"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=icloud.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbiLRXXU (ORCPT + 71 others); Sun, 18 Dec 2022 18:23:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230421AbiLRXXJ (ORCPT ); Sun, 18 Dec 2022 18:23:09 -0500 Received: from ms11p00im-qufo17281301.me.com (ms11p00im-qufo17281301.me.com [17.58.38.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C9E5BCB2 for ; Sun, 18 Dec 2022 15:23:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1671405788; bh=22z3hM7ajo6v6alaXwjTYA9bNfBA2cVdMH1XeN/HN8w=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=AhGZ/gRlKJAbhBYe///aGRqU841GDi1pufsqrw6cVmXhXmUPVV+3+uk2I0j6IrHRZ fhaedWs2TR66dOh0LovO9dj3XdUFtGNqgIcsjAvM/M/m0GeuCXyTnAcQyjyBcaKYgd ZZLfXDFkGoYgigim7B0g4yKjPH62psyHkGM4xipNOP8+ZSADqElhDwEoPhoakPbQfa ucttCjquqOMb/DJ7+NnGOQ2pGcQj0lLI8GVvn4H/nyRhAdsvEUOsXYDoxsrLDoggOo tJBYeoTFstoFuEGiZQxV3mf3uJzHC47fVkz6WHKijAaJ295vZ2zfPwVm9ihI/wfGr+ vO5pqYbx2Ao2g== Received: from thundercleese.localdomain (ms11p00im-dlb-asmtpmailmevip.me.com [17.57.154.19]) by ms11p00im-qufo17281301.me.com (Postfix) with ESMTPSA id 277F4CC0239; Sun, 18 Dec 2022 23:23:07 +0000 (UTC) From: Eric Van Hensbergen To: v9fs-developer@lists.sourceforge.net, asmadeus@codewreck.org, rminnich@gmail.com, lucho@ionkov.net Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux_oss@crudebyte.com, Eric Van Hensbergen Subject: [PATCH v2 02/10] Expand setup of writeback cache to all levels Date: Sun, 18 Dec 2022 23:22:11 +0000 Message-Id: <20221218232217.1713283-3-evanhensbergen@icloud.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221218232217.1713283-1-evanhensbergen@icloud.com> References: <20221217183142.1425132-1-evanhensbergen@icloud.com> <20221218232217.1713283-1-evanhensbergen@icloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-ORIG-GUID: OhTYzBw9FLrxmjW8PVOHBYnxPTuVCWbs X-Proofpoint-GUID: OhTYzBw9FLrxmjW8PVOHBYnxPTuVCWbs X-Proofpoint-Virus-Version: =?UTF-8?Q?vendor=3Dfsecure_engine=3D1.1.170-22c6f66c430a71ce266a39bfe25bc?= =?UTF-8?Q?2903e8d5c8f:6.0.425,18.0.572,17.11.62.513.0000000_definitions?= =?UTF-8?Q?=3D2022-01-14=5F01:2022-01-14=5F01,2020-02-14=5F11,2021-12-02?= =?UTF-8?Q?=5F01_signatures=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 mlxscore=0 spamscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=838 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2212180222 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If cache is enabled, make sure we are putting the right things in place (mainly impacts mmap). This also sets us up for more cache levels. Signed-off-by: Eric Van Hensbergen --- fs/9p/v9fs.c | 2 +- fs/9p/vfs_addr.c | 2 -- fs/9p/vfs_file.c | 7 ++++--- fs/9p/vfs_inode.c | 3 +-- fs/9p/vfs_inode_dotl.c | 7 ++++--- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 3a9c4517265f..61a51b90600d 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c @@ -468,7 +468,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, #ifdef CONFIG_9P_FSCACHE /* register the session for caching */ - if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { + if (v9ses->cache == CACHE_FSCACHE) { rc = v9fs_cache_session_get_cookie(v9ses, dev_name); if (rc < 0) goto err_clnt; diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index 93373486ab04..9da47465e568 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c @@ -279,8 +279,6 @@ static int v9fs_write_begin(struct file *filp, struct address_space *mapping, p9_debug(P9_DEBUG_VFS, "filp %p, mapping %p\n", filp, mapping); - BUG_ON(!v9inode->writeback_fid); - /* Prefetch area to be written into the cache if we're caching this * file. We need to do this before we get a lock on the page in case * there's more than one writer competing for the same cache block. diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index b740017634ef..3b6458846a0b 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -73,8 +73,7 @@ int v9fs_file_open(struct inode *inode, struct file *file) } mutex_lock(&v9inode->v_mutex); - if ((v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) && - !v9inode->writeback_fid && + if ((v9ses->cache) && !v9inode->writeback_fid && ((file->f_flags & O_ACCMODE) != O_RDONLY)) { /* * clone a fid and add it to writeback_fid @@ -92,9 +91,11 @@ int v9fs_file_open(struct inode *inode, struct file *file) v9inode->writeback_fid = (void *) writeback_fid; } mutex_unlock(&v9inode->v_mutex); - if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) +#ifdef CONFIG_9P_FSCACHE + if (v9ses->cache == CACHE_FSCACHE) fscache_use_cookie(v9fs_inode_cookie(v9inode), file->f_mode & FMODE_WRITE); +#endif v9fs_open_fid_add(inode, &fid); return 0; out_error: diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 27a04a226d97..33e521c60e2c 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -843,8 +843,7 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry, inode = d_inode(dentry); v9inode = V9FS_I(inode); mutex_lock(&v9inode->v_mutex); - if ((v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) && - !v9inode->writeback_fid && + if ((v9ses->cache) && !v9inode->writeback_fid && ((flags & O_ACCMODE) != O_RDONLY)) { /* * clone a fid and add it to writeback_fid diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 8696e8899c27..9fde73ffadaa 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -316,8 +316,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, v9inode = V9FS_I(inode); mutex_lock(&v9inode->v_mutex); - if ((v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) && - !v9inode->writeback_fid && + if ((v9ses->cache) && !v9inode->writeback_fid && ((flags & O_ACCMODE) != O_RDONLY)) { /* * clone a fid and add it to writeback_fid @@ -340,9 +339,11 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, if (err) goto out; file->private_data = ofid; - if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) +#ifdef CONFIG_9P_FSCACHE + if (v9ses->cache == CACHE_FSCACHE) fscache_use_cookie(v9fs_inode_cookie(v9inode), file->f_mode & FMODE_WRITE); +#endif v9fs_open_fid_add(inode, &ofid); file->f_mode |= FMODE_CREATED; out: -- 2.37.2