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.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 7BF1DC433DF for ; Fri, 3 Jul 2020 11:41:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C4DE2084C for ; Fri, 3 Jul 2020 11:41:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="XocJJ6PE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726425AbgGCLlO (ORCPT ); Fri, 3 Jul 2020 07:41:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726150AbgGCLlM (ORCPT ); Fri, 3 Jul 2020 07:41:12 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1292DC08C5C1; Fri, 3 Jul 2020 04:41:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=brKPBqGkq9UpOiE2pzCiAvP7F0wRaBf/lffdYdZP/rY=; b=XocJJ6PESJAwgCpUXDyHtQLyEY ImvwQMMgXfNfl/2vJRzeoMsFHOQbc6U3VvRGZALaGzCRdcq4/Py/xEghTVrPLnzQCwkwKIaAXICoz Kg+2CbynrhQfNNo33tS8nq3CUUujct0ek/qAb5kNGsAU5zis0gLisiajUb5NHL+N+yondC6UIpCgk iwJIX+U6eRrE6Iez6yUgNwYxpKrIGUzffzSf8NqCKeVftBWuOLbFtBdAggk+5DAxT+6hGVM/dmVeY sznKaHOF8crWlVtyREAfZ26xGBqikJF0sdqoDeVS3v6yyIvKl1ecLCyjzwY1rcKwAy0WFkVrFWEU/ sHa/Plxw==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jrK45-0000Gn-0o; Fri, 03 Jul 2020 11:41:09 +0000 Date: Fri, 3 Jul 2020 12:41:08 +0100 From: Matthew Wilcox To: Andreas Gruenbacher Cc: Linus Torvalds , Dave Chinner , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC v2 1/2] fs: Add IOCB_NOIO flag for generic_file_read_iter Message-ID: <20200703114108.GE25523@casper.infradead.org> References: <20200703095325.1491832-1-agruenba@redhat.com> <20200703095325.1491832-2-agruenba@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200703095325.1491832-2-agruenba@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Again, I'm happy for the patch to go in as-is without this nitpick.