Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1118923ybi; Fri, 21 Jun 2019 14:16:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqyIIvgP+wijbM+9403ZEX386SEFy8ICm3t0Mbc6xxm0vRWbJ6wLXUelRO9AYtz63BzPX93+ X-Received: by 2002:a17:902:2a6b:: with SMTP id i98mr46436806plb.75.1561151803911; Fri, 21 Jun 2019 14:16:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561151803; cv=none; d=google.com; s=arc-20160816; b=jVPnQC3rZasTGeLzv6hfWp58qiPGat/4BGn8yjLvL5dBvDFh83VqJz2KWPf7r92UTy enyGduecqZlSaimrTEAdg6/ptXncKR9DsUdbfX2LFntMwziDk5FaD6jjU+x1G17xOhWn SRj6W9DWYhWI8P7yUS+W4fvmDnAXnI2lz8Lg3RKKxMGZzCLp5ZRJQNUZ97A/C1Imb6Pm sOyy5vDscm7PgQ1glG/B+dSLOE3I/90AwB7uiwAEp7JfdalkVOwx1EW1GlgjMrXp7SNF mn8muSsd/FelGvOOhaGYTvlnDgy7SwpzSFYgorvFJBsYKfIT6D0WzwiVWsrXM79GJZuk pBAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=HtzJasL8gBS8kZ7UuL9gM+A/DUZKv8o6sZNJfXr+A0U=; b=iIJhlhEiUuXjjs2787lQC22i+CuSJsRFqAOSZaJrqZj47cnWnAOGxQktLUuYGPM+4z EF/lxeiv5j+kbwpqbIDYNTyRU/zywxgBkTtNoawdqYU+OR/pweS2ry7uVDAC72Ahu6pY tD9xHtSzmO1dDRdLH7y4mrvVU8Nv5WlZI4Ma2VchNBQSgEcvHd2r5rmOWV4OSPny/tJf WPF5fxxvt+an5mupxEczizV2LLyjLSAlTn9q014ZKkTVRAKmRUT09oCYebTXwDErmgik Qn+NZqYV8mZUiNsEZ3vU4rj19uakhbilg2g+7mvSb5pdY30G/lH/0Ius1fU4ZTNeVfK6 sDrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=j9DfiZ1u; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c36si3627672pgl.389.2019.06.21.14.16.29; Fri, 21 Jun 2019 14:16:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=j9DfiZ1u; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726141AbfFUVO6 (ORCPT + 99 others); Fri, 21 Jun 2019 17:14:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:47892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726017AbfFUVO6 (ORCPT ); Fri, 21 Jun 2019 17:14:58 -0400 Received: from gmail.com (unknown [104.132.1.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3077F205C9; Fri, 21 Jun 2019 21:14:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561151697; bh=+A5ovqJOpzLcVONMQRqVKOitIoP9VN9sjk5zTETdR4Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=j9DfiZ1uUH08EceCSIPbtAHoj+1iKMIXKrynwMLsOWtqLgEvj48Zi/fotz29tZEY+ tCYq1rAzXvfnE+5rfL6YujS5izY4ah+/Y9ndYmG1Hqs3rbscRdy5Dcw0/GVUAW7vts 4zcql4EErO0CmjrdcxzOSjskFJq4jMSCuFI+hxms= Date: Fri, 21 Jun 2019 14:14:55 -0700 From: Eric Biggers To: Chandan Rajendra Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fscrypt@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jaegeuk@kernel.org, yuchao0@huawei.com, hch@infradead.org Subject: Re: [PATCH V3 4/7] fs/mpage.c: Integrate read callbacks Message-ID: <20190621211454.GC167064@gmail.com> References: <20190616160813.24464-1-chandan@linux.ibm.com> <20190616160813.24464-5-chandan@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190616160813.24464-5-chandan@linux.ibm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Sun, Jun 16, 2019 at 09:38:10PM +0530, Chandan Rajendra wrote: > This commit adds code to make do_mpage_readpage() to be "read callbacks" > aware i.e. for files requiring decryption, do_mpage_readpage() now > sets up the read callbacks state machine when allocating a bio and later > starts execution of the state machine after file data is read from the > underlying disk. > > Signed-off-by: Chandan Rajendra > --- > fs/mpage.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/fs/mpage.c b/fs/mpage.c > index 436a85260394..611ad122fc92 100644 > --- a/fs/mpage.c > +++ b/fs/mpage.c > @@ -30,6 +30,7 @@ > #include > #include > #include > +#include > #include "internal.h" > > /* > @@ -49,6 +50,8 @@ static void mpage_end_io(struct bio *bio) > struct bio_vec *bv; > struct bvec_iter_all iter_all; > > + if (read_callbacks_end_bio(bio)) > + return; > bio_for_each_segment_all(bv, bio, iter_all) { > struct page *page = bv->bv_page; > page_endio(page, bio_op(bio), > @@ -309,6 +312,12 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args) > gfp); > if (args->bio == NULL) > goto confused; > + > + if (read_callbacks_setup(inode, args->bio, NULL)) { > + bio_put(args->bio); > + args->bio = NULL; > + goto confused; > + } > } > > length = first_hole << blkbits; > @@ -330,7 +339,7 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args) > confused: > if (args->bio) > args->bio = mpage_bio_submit(REQ_OP_READ, op_flags, args->bio); > - if (!PageUptodate(page)) > + if (!PageUptodate(page) && !PageError(page)) > block_read_full_page(page, args->get_block); > else > unlock_page(page); > -- > 2.19.1 Why is the !PageError() check needed here? - Eric