Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp528396ybl; Thu, 15 Aug 2019 23:17:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyAEjrJzLACpMD4Q41caqMCf6hRBBloEVafzdrFOQpbr8TU1Inm1QA55hmYst++alK8XfHL X-Received: by 2002:aa7:8106:: with SMTP id b6mr9231341pfi.5.1565936239231; Thu, 15 Aug 2019 23:17:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565936239; cv=none; d=google.com; s=arc-20160816; b=Bv9UCQws4jdXWZqzXvoVzqASQ7h0+SXtm5HuC3nF2rR5RRacKUCBjCwv6/758udL9h 6dxvEgeHnxVwoiX7iCG3i5ocswiFqEfIRyCKu6+i6N6SCqDmyjl3vqh5B0Ii/248j1iA zoZe1pghnMLli6fGjDiid4k1b5GTJfpTuVLHkj9zKtNHI5jw9k00rhbdCyz1a/+Vr/k/ jxb0DfvyCP+QY8vF99XzllKgqvmu46LvVD6adB0EBi3roSUoF6rAubEnBuxcUMOMUNP/ 8Z6vkmPNOg3WrYavqTcMA8c4pYySR1uWUDhSGuyKp9YJwmQbaT2y+kTnsi4HDxyaJ+WP P6+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:subject:cc:to:from; bh=ZIMIV9ukHyDvr/A6+u1NYC2l1TP74KD/fs0sZEALPmo=; b=Mn38flg+hfb7Yme4WLCN1HEh9ZDhInADdh1vGJ5nLtvFxSp3krDIRJwCt9trDEX6t7 qmicYiWWn9U4cMoUI1tcavyEnkEQUSIocQrgDWm+mvgLVVryi75pzEKr16z9d1bUISkf VJ9BGJ7KKJVDlTbCoJ+6V3TChLZezYaMfAEflS0Fb2DwAHaCqJwNOW7ydWXOJjMvvMXj KbxuV4diSWs0XP2f41mS1V8X7fCx8kHkGTUTzDjxF5GGhzy9no2qVLU4P9J5fTHjKStJ /wabc/lPULy8Ht3ib9lJ6xOjqAOljJZqU87MofhrWY+Doj76KzxCWhKcLm2SOY0H5CAs qQDA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1si3358375plg.353.2019.08.15.23.17.05; Thu, 15 Aug 2019 23:17:19 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726730AbfHPGQ5 (ORCPT + 99 others); Fri, 16 Aug 2019 02:16:57 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:62068 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726724AbfHPGQ4 (ORCPT ); Fri, 16 Aug 2019 02:16:56 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x7G64S2H144164 for ; Fri, 16 Aug 2019 02:16:55 -0400 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0b-001b2d01.pphosted.com with ESMTP id 2udkufnxfg-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 16 Aug 2019 02:16:55 -0400 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 16 Aug 2019 07:16:54 +0100 Received: from b01cxnp23034.gho.pok.ibm.com (9.57.198.29) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 16 Aug 2019 07:16:50 +0100 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x7G6GnK951708244 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Aug 2019 06:16:49 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2AC58112063; Fri, 16 Aug 2019 06:16:49 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3C9B4112065; Fri, 16 Aug 2019 06:16:46 +0000 (GMT) Received: from localhost.in.ibm.com (unknown [9.124.35.23]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 16 Aug 2019 06:16:45 +0000 (GMT) From: Chandan Rajendra To: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fscrypt@vger.kernel.org Cc: Chandan Rajendra , chandanrmail@gmail.com, tytso@mit.edu, adilger.kernel@dilger.ca, ebiggers@kernel.org, jaegeuk@kernel.org, yuchao0@huawei.com, hch@infradead.org Subject: [PATCH V4 3/8] fs/mpage.c: Integrate read callbacks Date: Fri, 16 Aug 2019 11:47:59 +0530 X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190816061804.14840-1-chandan@linux.ibm.com> References: <20190816061804.14840-1-chandan@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19081606-2213-0000-0000-000003BC996D X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011597; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000287; SDB=6.01247516; UDB=6.00658410; IPR=6.01029025; MB=3.00028195; MTD=3.00000008; XFM=3.00000015; UTC=2019-08-16 06:16:52 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19081606-2214-0000-0000-00005FAA369D Message-Id: <20190816061804.14840-4-chandan@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-08-16_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908160066 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/fs/mpage.c b/fs/mpage.c index 3f19da75178b..65e7165644e2 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "internal.h" /* @@ -44,7 +45,7 @@ * status of that page is hard. See end_buffer_async_read() for the details. * There is no point in duplicating all that complexity. */ -static void mpage_end_io(struct bio *bio) +static void end_bio(struct bio *bio) { struct bio_vec *bv; int i; @@ -52,13 +53,24 @@ static void mpage_end_io(struct bio *bio) bio_for_each_segment_all(bv, bio, i, iter_all) { struct page *page = bv->bv_page; - page_endio(page, bio_op(bio), - blk_status_to_errno(bio->bi_status)); + int err; + + err = blk_status_to_errno(bio->bi_status); + + if (!err && read_callbacks_failed(page)) + err = -EIO; + + page_endio(page, bio_op(bio), err); } bio_put(bio); } +static void mpage_end_io(struct bio *bio) +{ + read_callbacks_endio_bio(bio, end_bio); +} + static struct bio *mpage_bio_submit(int op, int op_flags, struct bio *bio) { bio->bi_end_io = mpage_end_io; @@ -310,6 +322,12 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args) gfp); if (args->bio == NULL) goto confused; + + if (read_callbacks_setup_bio(inode, args->bio)) { + bio_put(args->bio); + args->bio = NULL; + goto confused; + } } length = first_hole << blkbits; -- 2.19.1