From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6ED7BC433DF for ; Sun, 5 Jul 2020 15:13:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 14DD020737 for ; Sun, 5 Jul 2020 15:13:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="V635oql6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14DD020737 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 496738D001A; Sun, 5 Jul 2020 11:13:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4486D8D0001; Sun, 5 Jul 2020 11:13:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 35D0F8D001A; Sun, 5 Jul 2020 11:13:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0217.hostedemail.com [216.40.44.217]) by kanga.kvack.org (Postfix) with ESMTP id 20DF68D0001 for ; Sun, 5 Jul 2020 11:13:10 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 998341DF2 for ; Sun, 5 Jul 2020 15:13:09 +0000 (UTC) X-FDA: 77004365298.26.water08_2c02fbf26ea4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id 5B95218016526 for ; Sun, 5 Jul 2020 15:08:39 +0000 (UTC) X-HE-Tag: water08_2c02fbf26ea4 X-Filterd-Recvd-Size: 5182 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Sun, 5 Jul 2020 15:08:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593961718; 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=Ew/OdjOd95BOa3dKjs/VTo1bRUIFHTAarG64/Xhncjs=; b=V635oql6I5ajli9OKW4Rc5LfL9eT64XUHrYZtsfPSLbgMCwLagSmDJ3P2zeSQZuEALDxey z7BQcBUcdOiy7rtd3DJz5UYxsjPaXkkeo/28MCIq/UlkdVeXod9rvE0dKSGa87kP98+lNJ JikRcT6jOYt7nx+L+HLv8jZLwrkdRWA= Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-363-UQ9WLEGtMA6fhmWMQTizBw-1; Sun, 05 Jul 2020 11:08:34 -0400 X-MC-Unique: UQ9WLEGtMA6fhmWMQTizBw-1 Received: by mail-ot1-f71.google.com with SMTP id i21so20861560otf.5 for ; Sun, 05 Jul 2020 08:08:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ew/OdjOd95BOa3dKjs/VTo1bRUIFHTAarG64/Xhncjs=; b=H25OsR8Y3L/cK3Hbp2UO5ncsuHkhmKc5/GHAX3EeoLlXsKhAQ+b/nWxnN33ykZJ8D1 qibYuaP8+STtOKPOfxyScaZtR9tMCvLBr9JXgTS2eSVnc8Cs3YrAMBB+XlnE1i3aD57A E08mB1TsBJmKf4qZjzhLDfFGHZPk78Iqpa1UMV7AZ6tfhCmGwppDUHuysay94TQyMY0P uWyjy8tcHMwVwk2dfoobAPG8Nny2XNPpr2NWBcpBkJ3PtH2ay7zI4G+V4YvwMvb4qu50 1hpH3a78wLPFmlR+SAYeU6ctzcgAPOPClvVKPh5/qPjKon1Q53bsXKsotM4ridAMN853 qE5Q== X-Gm-Message-State: AOAM5329yGlxcJj1C1cU5jRx66jP9BZfDu9efv2d4T1vyxRwphszTJy+ SBl+YemccxzjCjN9r/qoKqOXm+pdkmcVjBatv7LtQ13GPEuuCFifnMTpbKElCAPRdQBH+9umel7 +ezT6hhYHoXhDQvTLpkd/I+RP2w4= X-Received: by 2002:a05:6830:1c6e:: with SMTP id s14mr33097425otg.58.1593961713305; Sun, 05 Jul 2020 08:08:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRg3eAq/NtdI3fapt+nPvYFvGVXas6I8K/gwkuEhNAnNsRgfDspzv3RMomr27ExhtxybgWpGD6uUv4bO06Ei4= X-Received: by 2002:a05:6830:1c6e:: with SMTP id s14mr33097413otg.58.1593961713041; Sun, 05 Jul 2020 08:08:33 -0700 (PDT) MIME-Version: 1.0 References: <20200703095325.1491832-1-agruenba@redhat.com> <20200703095325.1491832-2-agruenba@redhat.com> <20200703114108.GE25523@casper.infradead.org> In-Reply-To: <20200703114108.GE25523@casper.infradead.org> From: Andreas Gruenbacher Date: Sun, 5 Jul 2020 17:08:21 +0200 Message-ID: Subject: Re: [RFC v2 1/2] fs: Add IOCB_NOIO flag for generic_file_read_iter To: Matthew Wilcox Cc: Linus Torvalds , Dave Chinner , linux-fsdevel , Linux-MM , LKML Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=agruenba@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 5B95218016526 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Jul 3, 2020 at 1:41 PM Matthew Wilcox wrote: > > On Fri, Jul 03, 2020 at 11:53:24AM +0200, Andreas Gruenbacher wrote: > > Add an IOCB_NOIO flag that indicates to generic_file_read_iter that it > > shouldn't trigger any filesystem I/O for the actual request or for > > readahead. This allows to do tentative reads out of the page cache as > > some filesystems allow, and to take the appropriate locks and retry the > > reads only if the requested pages are not cached. > > > > Signed-off-by: Andreas Gruenbacher > > Reviewed-by: Matthew Wilcox (Oracle) > > > @@ -2249,9 +2253,18 @@ EXPORT_SYMBOL_GPL(generic_file_buffered_read); > > * > > * This is the "read_iter()" routine for all filesystems > > * that can use the page cache directly. > > + * > > + * The IOCB_NOWAIT flag in iocb->ki_flags indicates that -EAGAIN shall > > + * be returned when no data can be read without waiting for I/O requests > > + * to complete; it doesn't prevent readahead. > > + * > > + * The IOCB_NOIO flag in iocb->ki_flags indicates that -EAGAIN shall be > > + * returned when no data can be read without issuing new I/O requests, > > + * and 0 shall be returned when readhead would have been triggered. > > s/shall/may/ -- if we read a previous page then hit a readahead page, > we'll return a positive value. If the first page we hit is a readahead > page, then yes, we'll return zero. How about this? * The IOCB_NOIO flag in iocb->ki_flags indicates that no new I/O * requests shall be made for the read or for readahead. When no data * can be read, -EAGAIN shall be returned. When readahead would be * triggered, a short read (possibly of length 0) shall be returned. > Again, I'm happy for the patch to go in as-is without this nitpick. Thanks, Andreas