Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5790144ybe; Tue, 10 Sep 2019 08:51:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxmRJHD9LLOjcQs9mCcQGkK/SrDHwDnemjeIqOs8YXZuL0Xzd+xn1Y5l7iphxldUTNOY7pd X-Received: by 2002:aa7:d6d8:: with SMTP id x24mr12466050edr.178.1568130663050; Tue, 10 Sep 2019 08:51:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568130663; cv=none; d=google.com; s=arc-20160816; b=LWKOuDeNt4y7xwdNlozThvWP/TAmJeRddhs6lq3q10wegd4wKgw+27QKbO+uUnP0jC xxsDR7e8XkIPxZtxK+c/wLJ0wQdKhMb+ZoStNElz9mH6ncXmiZF9vhWHZjxV6L0rAaeQ 3CuShHA74ek4hkAF5Hnpun3p2Aw1ewmhzWSuEwrz2ncN0iFVUnDSssR1ediR5b62ROGf UbuCIGw4ccrS6+N1McS90rtQH4Nvd735EjdsahzmAT7I58vrWnyKECcSXLJbLi9OTdpW ncWpVHZlv0QSxd6/zyurZrKNZRUQRrH4vliW14KZwpb6IoAgi7GVvV5YWC19SK6SmDwy WMiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ZIMIV9ukHyDvr/A6+u1NYC2l1TP74KD/fs0sZEALPmo=; b=JV33Y4aXR2qCL7F6cPgbI97aSK1DAR6TLJHW2RfFcLYS6Euv+sGPX1cQ0BNA68NtYd +KeEqrdJCz9Yr4Cmq8LH7b7fhXV5I5fj0GgBDyljnAqQf73V4h9D6988xJMcaBaQ4gbV RVwkRdP4bg/DtHk5vy1fTxJMh0pPoIK6pgy+gbrOctPrcUTIEcl29uYfwTnPGKbJkXvI 5QmJJ+POAsYAOUl2MUbAxaCqBN6qf2drjrsMHpRQ3nMMLGqNCpr03ynYCYumITdAm2nV fxvfe9MJKXbkiPXr2sxd0Z3Bn3s1tnArcA8WwxkYO0ZhghE7jF9v2P3KdsLrb5tR2ZBt x1Cg== 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 l15si9084369ejd.127.2019.09.10.08.50.38; Tue, 10 Sep 2019 08:51:03 -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 S2393142AbfIJPt7 (ORCPT + 99 others); Tue, 10 Sep 2019 11:49:59 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:40820 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727024AbfIJPt7 (ORCPT ); Tue, 10 Sep 2019 11:49:59 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8AFlg4n081823; Tue, 10 Sep 2019 11:49:51 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 2uxduk2ar6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Sep 2019 11:49:50 -0400 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.27/8.16.0.27) with SMTP id x8AFlu4i083490; Tue, 10 Sep 2019 11:49:50 -0400 Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0b-001b2d01.pphosted.com with ESMTP id 2uxduk2aqb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Sep 2019 11:49:50 -0400 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id x8AFjNUO011679; Tue, 10 Sep 2019 15:49:49 GMT Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by ppma02dal.us.ibm.com with ESMTP id 2uv467aw1x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Sep 2019 15:49:49 +0000 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 x8AFnmfi20709780 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Sep 2019 15:49:48 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 539DF112067; Tue, 10 Sep 2019 15:49:48 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0F117112062; Tue, 10 Sep 2019 15:49:45 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.102.1.89]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 10 Sep 2019 15:49:44 +0000 (GMT) From: Chandan Rajendra To: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-fscrypt@vger.kernel.org Cc: Chandan Rajendra , tytso@mit.edu, adilger.kernel@dilger.ca, ebiggers@kernel.org, hch@infradead.org, chandanrlinux@gmail.com Subject: [PATCH RESEND V5 3/7] fs/mpage.c: Integrate read callbacks Date: Tue, 10 Sep 2019 21:21:11 +0530 Message-Id: <20190910155115.28550-4-chandan@linux.ibm.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190910155115.28550-1-chandan@linux.ibm.com> References: <20190910155115.28550-1-chandan@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-09-10_11:,, 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-1909100149 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