Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1842845pxb; Wed, 20 Oct 2021 12:54:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAeeBQZbT+kYuJ2wfhe9VcwYobmxnOc9Jaazm2wJHeEgOPMuiNmHncR0FEQkDaKMZg0kRb X-Received: by 2002:aa7:d556:: with SMTP id u22mr1356298edr.226.1634759688564; Wed, 20 Oct 2021 12:54:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634759688; cv=none; d=google.com; s=arc-20160816; b=pkEdi4sFGm7CiuiaMJXxPR7wo+7bq8UYjD/hZikwcHw1B8DdHLYJ1m9ANmFUOYax4h JBneRWpefHB24fv9k4geg8895Xt2ui6osFmT1mBM8mAjavGavFbjh8JlnczfxGxAYG9T H7vGJG7bVbCRurTPejvyuqAuX+xRlmdA0uCR7bdk4hY4BVcPjTXWqlBwWhAAjxqEeb38 PAIckHHg1Tcafv6rcMHkOHDvpy1Ozd6Ts92+uADTq80lRVo36F8nz9OcMSLn5VlTH3mO snzLQ0oIHdJs1rGQD5dSsj+PtIaraY9DDDC9ojO8sBPeYGovBqltRJIEUEn/hS7GBKab E/ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=pniunILaSn/hzIB/5zP3tqKBdSvzKkZgYmhtJvDwjCU=; b=xdxx0N02YQ9UhUot5lNNgHecZ75LwdOrIdL0WAty79260JXEooz3n5xFWz9KGjNV13 m7SLgDSbJMM7q3/EphY/iEM33rkbiUNZexbase6m0kTw8guVPTSPcXxmfQ+LMEwYQKCV 03pFMvb3XdKZs1UqGo6miYWHsRRChx0sUKpTlS/MW3r/UOqQ8HHZYvlzhRuu2LCEu9/I SqfnTjsGHTBAHTFV15ctmWvtIlT6JOQZxOnj7wXHMxKAb+tkP0tG8RoX1bNdT00NrDCv fcfZFigMGivJzHqolFOD9FcTPyR1VBwmfwqCBIFiqVluitgxzW9pdCdkDJHQRzWNSjMF p/tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Qf7csb/j"; 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 22si4288038edx.513.2021.10.20.12.54.09; Wed, 20 Oct 2021 12:54:48 -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="Qf7csb/j"; 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 S230484AbhJTT4V (ORCPT + 99 others); Wed, 20 Oct 2021 15:56:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45395 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230326AbhJTT4U (ORCPT ); Wed, 20 Oct 2021 15:56:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634759645; 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: in-reply-to:in-reply-to:references:references; bh=pniunILaSn/hzIB/5zP3tqKBdSvzKkZgYmhtJvDwjCU=; b=Qf7csb/j11fE7JD8TaYS9lquFUMJZRKyYbBNsJr17KYXDSbhWfOEAtyJa2zXu3toByHFV2 p0jQ2Mg22ssJlCs9ZofGqoFcwnhKhe9w/L0JfHe0e2uOg2BxUoOYLFXOUuTsm0DKgo5+t7 Q7TritZTHqoL470OdmHUMS3moIoIcQs= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-320-Y2IHHSNJNmKP_CiVXthBGw-1; Wed, 20 Oct 2021 15:54:04 -0400 X-MC-Unique: Y2IHHSNJNmKP_CiVXthBGw-1 Received: by mail-ed1-f72.google.com with SMTP id f4-20020a50e084000000b003db585bc274so21999701edl.17 for ; Wed, 20 Oct 2021 12:54:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pniunILaSn/hzIB/5zP3tqKBdSvzKkZgYmhtJvDwjCU=; b=Zi4KOqYKHaXo8tRB5ZDBgnBBJUUIn5vJsJewMMYlR1YGftEuRwUTUtzmL2mrn+iPbF KNQe3Ej621ZG8J1R135cZJ4WntzaEYJN4JOt6sXnJY+vXM05/5+7y0uo0sPouKni/R33 GvBZguYZaghQvkU6ipaHKiXYt5dxaYXZ0zR49Hbmo6gx0o94uRaULhF3QzvksWyVQWKT SLfTg9vn0vHSVTeh1lggDNAXN5eJ7diRvEwR3AV5YpgQgslfPk5Vteu7YXbx3QFKq2+G sHAnoqof2mA2InIIDcNzTPRLfoPd3uE2gcVuxLJM5SZxg7dfGWI57yqneINXKnlKFE8c xwUQ== X-Gm-Message-State: AOAM532Kup4Ot8rIYB6VYdznSHjgake2sAhJtvQVWu5d89i0GIt0ujGb iWKStv2LpYBm+fsxrrsFKhSlmvAXYi7ry78l7oXCBG0s7u+ep3RigX+qTE1Os57LldOXmJhPBr7 yh54GwC7+OSnFsGqKQRCw+xhi42l9y3oExTn6 X-Received: by 2002:a50:bf4a:: with SMTP id g10mr1341909edk.11.1634759642920; Wed, 20 Oct 2021 12:54:02 -0700 (PDT) X-Received: by 2002:a50:bf4a:: with SMTP id g10mr1341872edk.11.1634759642650; Wed, 20 Oct 2021 12:54:02 -0700 (PDT) MIME-Version: 1.0 References: <1633782962-18335-1-git-send-email-dwysocha@redhat.com> <1633782962-18335-2-git-send-email-dwysocha@redhat.com> <33f3ce883c7f874e2aa684f3ad83882bf7c38acb.camel@hammerspace.com> In-Reply-To: <33f3ce883c7f874e2aa684f3ad83882bf7c38acb.camel@hammerspace.com> From: David Wysochanski Date: Wed, 20 Oct 2021 15:53:26 -0400 Message-ID: Subject: Re: [PATCH v2 1/1] NFS: Convert from readpages() to readahead() To: Trond Myklebust Cc: "anna.schumaker@netapp.com" , "linux-cachefs@redhat.com" , "linux-nfs@vger.kernel.org" , "willy@infradead.org" , "dhowells@redhat.com" , "chuck.lever@oracle.com" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, Oct 20, 2021 at 3:27 PM Trond Myklebust wrote: > > On Sat, 2021-10-09 at 08:36 -0400, Dave Wysochanski wrote: > > Convert to the new VM readahead() API which is the preferred API > > to read multiple pages, and rename the NFSIOS_* counters and the > > tracepoint as needed. > > > > Signed-off-by: Dave Wysochanski > > --- > > fs/nfs/file.c | 2 +- > > fs/nfs/read.c | 18 +++++++++++++----- > > include/linux/nfs_fs.h | 3 +-- > > include/linux/nfs_iostat.h | 6 +++--- > > 4 files changed, 18 insertions(+), 11 deletions(-) > > > > diff --git a/fs/nfs/file.c b/fs/nfs/file.c > > index 209dac208477..cc76d17fa97f 100644 > > --- a/fs/nfs/file.c > > +++ b/fs/nfs/file.c > > @@ -519,7 +519,7 @@ static void nfs_swap_deactivate(struct file > > *file) > > > > const struct address_space_operations nfs_file_aops = { > > .readpage = nfs_readpage, > > - .readpages = nfs_readpages, > > + .readahead = nfs_readahead, > > .set_page_dirty = __set_page_dirty_nobuffers, > > .writepage = nfs_writepage, > > .writepages = nfs_writepages, > > diff --git a/fs/nfs/read.c b/fs/nfs/read.c > > index d06b91a101d2..296ea9a9b6ce 100644 > > --- a/fs/nfs/read.c > > +++ b/fs/nfs/read.c > > @@ -397,15 +397,19 @@ int nfs_readpage(struct file *file, struct page > > *page) > > return ret; > > } > > > > -int nfs_readpages(struct file *file, struct address_space *mapping, > > - struct list_head *pages, unsigned nr_pages) > > +void nfs_readahead(struct readahead_control *ractl) > > { > > + struct file *file = ractl->file; > > + struct address_space *mapping = ractl->mapping; > > + struct page *page; > > + unsigned int nr_pages = readahead_count(ractl); > > + > > struct nfs_readdesc desc; > > struct inode *inode = mapping->host; > > int ret; > > > > trace_nfs_aop_readahead(inode, nr_pages); > > - nfs_inc_stats(inode, NFSIOS_VFSREADPAGES); > > + nfs_inc_stats(inode, NFSIOS_VFSREADAHEAD); > > > > ret = -ESTALE; > > if (NFS_STALE(inode)) > > @@ -422,14 +426,18 @@ int nfs_readpages(struct file *file, struct > > address_space *mapping, > > > This function fails to compile due to the call to > nfs_readpages_from_fscache() taking a 'pages' argument. > Sorry about the confusion. See the "PATCH 0/1" description [1]. This patch as posted assumes dhowells "fallback API" series. Are you ok with that series, or do you still have concerns? I am not sure if I can redo this patch without that series but I can try if you're opposed to the fallback API series or see problems such as merging conflicts or want this patch only for some reason. Let me know what you want and I'll try to make it happen. [1] https://marc.info/?l=linux-nfs&m=163378294028491&w=2 > > nfs_pageio_init_read(&desc.pgio, inode, false, > > &nfs_async_read_completion_ops); > > > > - ret = read_cache_pages(mapping, pages, readpage_async_filler, > > &desc); > > + ret = 0; > > + while (!ret && (page = readahead_page(ractl))) { > > + prefetchw(&page->flags); > > + ret = readpage_async_filler(&desc, page); > > + put_page(page); > > + } > > > > nfs_pageio_complete_read(&desc.pgio); > > > > put_nfs_open_context(desc.ctx); > > out: > > trace_nfs_aop_readahead_done(inode, nr_pages, ret); > > - return ret; > > } > > > > int __init nfs_init_readpagecache(void) > > diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h > > index 140187b57db8..a5aef2cbe4ee 100644 > > --- a/include/linux/nfs_fs.h > > +++ b/include/linux/nfs_fs.h > > @@ -586,8 +586,7 @@ extern int nfs_access_get_cached(struct inode > > *inode, const struct cred *cred, s > > * linux/fs/nfs/read.c > > */ > > extern int nfs_readpage(struct file *, struct page *); > > -extern int nfs_readpages(struct file *, struct address_space *, > > - struct list_head *, unsigned); > > +extern void nfs_readahead(struct readahead_control *); > > > > /* > > * inline functions > > diff --git a/include/linux/nfs_iostat.h b/include/linux/nfs_iostat.h > > index 027874c36c88..418145f23700 100644 > > --- a/include/linux/nfs_iostat.h > > +++ b/include/linux/nfs_iostat.h > > @@ -22,7 +22,7 @@ > > #ifndef _LINUX_NFS_IOSTAT > > #define _LINUX_NFS_IOSTAT > > > > -#define NFS_IOSTAT_VERS "1.1" > > +#define NFS_IOSTAT_VERS "1.2" > > > > /* > > * NFS byte counters > > @@ -53,7 +53,7 @@ > > * NFS page counters > > * > > * These count the number of pages read or written via > > nfs_readpage(), > > - * nfs_readpages(), or their write equivalents. > > + * nfs_readahead(), or their write equivalents. > > * > > * NB: When adding new byte counters, please include the measured > > * units in the name of each byte counter to help users of this > > @@ -98,7 +98,7 @@ enum nfs_stat_eventcounters { > > NFSIOS_VFSACCESS, > > NFSIOS_VFSUPDATEPAGE, > > NFSIOS_VFSREADPAGE, > > - NFSIOS_VFSREADPAGES, > > + NFSIOS_VFSREADAHEAD, > > NFSIOS_VFSWRITEPAGE, > > NFSIOS_VFSWRITEPAGES, > > NFSIOS_VFSGETDENTS, > > -- > Trond Myklebust > Linux NFS client maintainer, Hammerspace > trond.myklebust@hammerspace.com > >