Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2373614pxb; Fri, 17 Sep 2021 08:23:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPCg11pjHd16/BUoDMVpSGEG/3G+rw+IsFrhl6eiK0gZh799RF9ot5txc9pO9DAoFvKBnE X-Received: by 2002:a17:906:4310:: with SMTP id j16mr12665311ejm.48.1631892182906; Fri, 17 Sep 2021 08:23:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631892182; cv=none; d=google.com; s=arc-20160816; b=0okjglgAQ8ppm2NLjCq/CQ5F/RbTJrfR1ryGOvm1rWL7bqnudsIjwK7cSGVZteaq/T uoLQ/btUuNy7dg00Hh5sn33tzJF2AEgrhWCyHweDIlpiae4V2dKGquSsDXI+6EEh/NiM 2vTB/Wt/Kd/BHdWGrwDV8rUg3eefLzxMzwzrfd1Tt5KRJCdjqtZRmgmS8h5pzY5+fUzj qUc8Vb2WeGbYo+hHMfNpZ51IeFE3keLvWYV00nb643WrSz3ZRkMnfQFyYjVHkvS85BCQ J+1qUy35OyHo3syL2+dstINs2LonoYqisCyKWTtUJT/sB+MaXsE64Vmo8ZCwmoXPurtr 9FLA== 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 :user-agent:message-id:date:cc:to:from:subject:dkim-signature; bh=hnHrnZKQhP4J2A3TyE1PL59ZXDbErzZjkrNl4K5MHQo=; b=HQ6+byGoDznS0t94e5KMgJJ1yYThhTIg9ICLQfhn+oi0h6V/Olvq2Mz2IW85wp2kYT w4zaf+3us0ktThve4fa04NRq+sSKj73OUEKwEgwK4fHo5ujot/YJxNo1W38/iQlZFs6+ LAdOOqy2wZXaDsaCEQ0iBGMiQy+FZ7am6yjmWJLVLItjSOUSq+CPVnk4O4H1l/irrB5v cMO11tLv7HPLyuJW1B3PdGDWkAdhQ+rFFqzXlUWdo0GQAshSDN3W4s1u2yphYT/KVGmg h+Gf1993oRzjUKq4d+rLBUx/qwnIryJey/P8nHr7OLl74Hu9vAEVlHvPmqpLbq2WdP9V Uy2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="G/qkW9+L"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n13si7309279edt.68.2021.09.17.08.22.37; Fri, 17 Sep 2021 08:23:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="G/qkW9+L"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244145AbhIQPFi (ORCPT + 99 others); Fri, 17 Sep 2021 11:05:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24408 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244235AbhIQPFg (ORCPT ); Fri, 17 Sep 2021 11:05:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631891054; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hnHrnZKQhP4J2A3TyE1PL59ZXDbErzZjkrNl4K5MHQo=; b=G/qkW9+LN5HyazpUlXby+dMFLVGIu7F1Z2W4ilYu/wr+9VfozoPF8UIu/3mLpyd5wVqzx4 lZ7nkbd3IDXz+O8/t+S2MR6tQf+BhpT5gBR7fGjEd/TnQgh0vh+kjm3X4v8cN9B6cFA9tW KdJOGaa0XPtDdMlgT53gWHk63XQ/NfM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-381-2JKUrCTeP-Gl_mwb6wm8ZQ-1; Fri, 17 Sep 2021 11:04:12 -0400 X-MC-Unique: 2JKUrCTeP-Gl_mwb6wm8ZQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 577C51006AA4; Fri, 17 Sep 2021 15:04:10 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08B3D60843; Fri, 17 Sep 2021 15:04:05 +0000 (UTC) Subject: [RFC PATCH v2 0/8] fscache: Replace and remove old I/O API v2 From: David Howells To: Trond Myklebust , Anna Schumaker , Steve French , Dominique Martinet Cc: linux-cachefs@redhat.com, Trond Myklebust , linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, Shyam Prasad N , v9fs-developer@lists.sourceforge.net, dhowells@redhat.com, Jeff Layton , Matthew Wilcox , Alexander Viro , Linus Torvalds , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 17 Sep 2021 16:04:05 +0100 Message-ID: <163189104510.2509237.10805032055807259087.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.23 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Here's a set of patches that removes the old fscache I/O API by the following means: (1) A simple fallback API is added that can read or write a single page synchronously. The functions for this have "fallback" in their names as they have to be removed at some point. (2) An implementation of this is provided in cachefiles. It creates a kiocb to use DIO to the backing file rather than calling readpage on the backing filesystem page and then snooping the page wait queue. (3) NFS is switched to use the fallback API. (4) CIFS is switched to use the fallback API also for the moment. (5) 9P is switched to using netfslib. (6) The old I/O API is removed from fscache and the page snooping implementation is removed from cachefiles. The reasons for doing this are: (A) Using a kiocb to do asynchronous DIO from/to the pages of the backing file is now a possibility that didn't exist when cachefiles was created. This is much simpler than the snooping mechanism with a proper callback path and it also requires fewer copies and less memory. (B) We have to stop using bmap() or SEEK_DATA/SEEK_HOLE to work out what blocks are present in the backing file is dangerous and can lead to data corruption if the backing filesystem can insert or remove blocks of zeros arbitrarily in order to optimise its extent list[1]. Whilst this patchset doesn't fix that yet, it does simplify the code and the fix for that can be made in a subsequent patchset. (C) In order to fix (B), the cache will need to keep track itself of what data is present. To make this easier to manage, the intention is to increase the cache block granularity to, say, 256KiB - importantly, a size that will span multiple pages - which means the single-page interface will have to go away. netfslib is designed to deal with that on behalf of a filesystem, though a filesystem could use raw cache calls instead and manage things itself. These patches can be found also on: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=fscache-iter-3 David Changes ======= ver #2: - Changed "deprecated" to "fallback" in the new function names[2]. - Cleaned up some kernel test robot warnings[3]. - Made the netfs read helpers use NETFS_READ_HOLE_* flags. References ========== Link: https://lore.kernel.org/r/YO17ZNOcq+9PajfQ@mit.edu [1] Link: https://lore.kernel.org/r/CAHk-=wiVK+1CyEjW8u71zVPK8msea=qPpznX35gnX+s8sXnJTg@mail.gmail.com/ [2] Link: https://lore.kernel.org/r/202109150420.QX7dDzSE-lkp@intel.com/ [3] Older postings ============== Link: https://lore.kernel.org/r/163162767601.438332.9017034724960075707.stgit@warthog.procyon.org.uk/ # rfc v1 Note that some of this was seen in previous patchsets too: # [RFC PATCH 00/61] fscache, cachefiles: Rewrite the I/O interface in terms of kiocb/iov_iter Link: https://lore.kernel.org/r/158861203563.340223.7585359869938129395.stgit@warthog.procyon.org.uk/ # [PATCH 00/14] fscache: Rewrite 1: Disable and clean in preparation for rewrite Link: https://lore.kernel.org/r/159465766378.1376105.11619976251039287525.stgit@warthog.procyon.org.uk/ # [RFC PATCH 00/76] fscache: Modernisation Link: https://lore.kernel.org/r/160588455242.3465195.3214733858273019178.stgit@warthog.procyon.org.uk/ --- David Howells (8): fscache: Generalise the ->begin_read_operation method fscache: Implement a fallback I/O interface to replace the old API nfs: Move to using the alternate fallback fscache I/O API 9p: (untested) Convert to using the netfs helper lib to do reads and caching cifs: (untested) Move to using the alternate fallback fscache I/O API fscache: Remove the old I/O API fscache: Remove stats that are no longer used fscache: Update the documentation to reflect I/O API changes .../filesystems/caching/backend-api.rst | 138 +-- .../filesystems/caching/netfs-api.rst | 385 +----- fs/9p/Kconfig | 1 + fs/9p/cache.c | 137 --- fs/9p/cache.h | 98 +- fs/9p/v9fs.h | 9 + fs/9p/vfs_addr.c | 174 ++- fs/9p/vfs_file.c | 21 +- fs/cachefiles/Makefile | 1 - fs/cachefiles/interface.c | 15 - fs/cachefiles/internal.h | 38 - fs/cachefiles/io.c | 28 +- fs/cachefiles/main.c | 1 - fs/cachefiles/rdwr.c | 972 --------------- fs/cifs/file.c | 64 +- fs/cifs/fscache.c | 105 +- fs/cifs/fscache.h | 74 +- fs/fscache/cache.c | 6 - fs/fscache/cookie.c | 10 - fs/fscache/internal.h | 58 +- fs/fscache/io.c | 137 ++- fs/fscache/object.c | 2 - fs/fscache/page.c | 1066 ----------------- fs/fscache/stats.c | 73 +- fs/netfs/read_helper.c | 8 +- fs/nfs/file.c | 14 +- fs/nfs/fscache-index.c | 26 - fs/nfs/fscache.c | 161 +-- fs/nfs/fscache.h | 84 +- fs/nfs/read.c | 25 +- fs/nfs/write.c | 7 +- include/linux/fscache-cache.h | 131 -- include/linux/fscache.h | 442 ++----- include/linux/netfs.h | 17 +- 34 files changed, 533 insertions(+), 3995 deletions(-) delete mode 100644 fs/cachefiles/rdwr.c