Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1259279ybl; Fri, 23 Aug 2019 16:23:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqw10aRAt9ExnYLi6J3TBUQrnYAcdqGHOZ2sOk1oQvm98xKJJBlfEWkFy9VLLJ65nsQX62Df X-Received: by 2002:a17:902:12d:: with SMTP id 42mr7545008plb.125.1566602581085; Fri, 23 Aug 2019 16:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566602581; cv=none; d=google.com; s=arc-20160816; b=UEq5FXxRAZqFvKebuDU1UC4EjJWxxNapCGUHbEPmI0KORcaa0rmk5nUXQYZ4F8rWut UxSibfCRi6i6+UlbxqM40A1KLo0UD5fENPIlSzSBvNr2R3LUWqOcVLefM4tbjsOE9lfH cGyB2Y7A+17bNv5s+VlD16SOXm0mocXF669EDTX69yJdfkdZQAUJDppZJb2BnSNnhDcB kLiptfHvt4zPgzY4qqYPAH/avDxqY6CUj0ZCAD0tralWDi8+Bf+/9UM+rWBITjKHP8dL C6KTuIbNoyUBFocok6220GHX2JxwvbXNr6TKbU3CfrsZvLVh7TP0d3cK6brLuV3T/7Cx hMCQ== 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=O0AX6SByVZrpm9KnpQrGbgOc/YpjFjIRXRhLGeoITHJNYbmLUvr4hJpZNReDAlA0lV Q/lR+Jb45hQzcwGR4fIUAlbu1RUR0HocdbEqHUYv7RZl/qyB5BYIMrH6Pu475qnBUoYd RxHEflnVrxVO6vaz+uDY4OjTd1WYYp3CvQrrmoaEFOZe+jsr8YuYNoIGpSXPR2IlMmAG sqowDhTfLKa1eN+D7JSp+64jyQ0owt4TzJlI5kp3oUiJ91GawYe5dqDC8PGSkEAtT24l VtnCD60zg6Py/z66bYHMwsMxvcyVG834842v0n89MRxqF0GZbbRMIyfTKhUPN6HjWX0u aWBg== 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 ck12si3451061pjb.56.2019.08.23.16.22.47; Fri, 23 Aug 2019 16:23:01 -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 S2404322AbfHWNYf (ORCPT + 99 others); Fri, 23 Aug 2019 09:24:35 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:22906 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2392195AbfHWNYd (ORCPT ); Fri, 23 Aug 2019 09:24:33 -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 x7NDMlbI113589; Fri, 23 Aug 2019 09:24:26 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ujg3ptf6j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Aug 2019 09:24:26 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.27/8.16.0.27) with SMTP id x7NDNYS9116759; Fri, 23 Aug 2019 09:24:25 -0400 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ujg3ptf60-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Aug 2019 09:24:25 -0400 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id x7NDLJYD002507; Fri, 23 Aug 2019 13:24:24 GMT Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by ppma03dal.us.ibm.com with ESMTP id 2ue977cd8h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Aug 2019 13:24:24 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x7NDONdY37552488 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Aug 2019 13:24:23 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D3711AC060; Fri, 23 Aug 2019 13:24:23 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 78827AC05B; Fri, 23 Aug 2019 13:24:20 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.199.53.214]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 23 Aug 2019 13:24:20 +0000 (GMT) From: Chandan Rajendra To: 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 V5 3/7] fs/mpage.c: Integrate read callbacks Date: Fri, 23 Aug 2019 18:55:38 +0530 Message-Id: <20190823132542.13434-4-chandan@linux.ibm.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190823132542.13434-1-chandan@linux.ibm.com> References: <20190823132542.13434-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-08-23_05:,, 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-1908230138 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