Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1622191ybi; Sun, 16 Jun 2019 09:08:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXcUukYLK2YqxnA22QrBPqnwb3HZxC6C9TTW1Czr4nTqtLCC4iMTYq6EhqeAwQVr/8FW/L X-Received: by 2002:a65:60d9:: with SMTP id r25mr45110576pgv.228.1560701329506; Sun, 16 Jun 2019 09:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560701329; cv=none; d=google.com; s=arc-20160816; b=wDSyTmUa4d2wITLlW64HXKIhB7JHKoPRpP9pOQZPIBtLt/WV24HEb9pp8H7OLvFYLL pyV+ofcvwluSYoRsMQiEF4wEjxMEqTC7Pp3lydd2DG7aDSD2hZHeQeZMV/IupeOxl85B 0+PceDoyALH8HYCaNJ8mSE3sZIimGOMRAaLtygiHEtvrvQnLASLEY+HSVjXsLLIgNwtZ Vvk7hxR78j/QKahYgqRBpQAOe+xod+yv2GZKZKSDK27DGcjnlMpJmJrBcljKEFhbKhIc Bslm0uNU9nUt78xUPfmnE8s+LzPGDniuYCofHJRBrgiF9GmF9v6qWuKZziZln13RLmn3 YWYg== 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=zRGe0l5xEkEfOzhMkFWBQYRH5+d3rG0+EeNlKh77E8s=; b=0iEej0C+Cx+j1mheFPBDQ6BD9BEKzJtD2FsKf0oPZuSXXr/z+irzeNjVy+Qf1tINeY AqgaKdBKIm/GYqsB9UuC05lPZZChItKYRQa+Oo3GSNUY3H2GAMaaEZX/Iu3y1ksgUbgi z3BkeWAhlAYz0Z63dSVQgEIBgZGRtzQjRf2MM60sLuHk21MmG695K0hZ4BXart0xQKQ6 HT7jJ41oZyuVzgtFUO0nZCDhQctladZOOB3UeirmFMG5kM5cPSwK0w+Ce772jRSZclch IzxlinRpNPDH391X9sgHjaCdUwrDCbF/SPZBinYcy3l8jJOqGDLw3y2XwIFuFmbWB2F+ XKlA== 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 i15si8165913pfd.259.2019.06.16.09.08.32; Sun, 16 Jun 2019 09:08:49 -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 S1726515AbfFPQIU (ORCPT + 99 others); Sun, 16 Jun 2019 12:08:20 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:35860 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727312AbfFPQIT (ORCPT ); Sun, 16 Jun 2019 12:08:19 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5GG6SXi063708 for ; Sun, 16 Jun 2019 12:08:18 -0400 Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) by mx0b-001b2d01.pphosted.com with ESMTP id 2t5e9te9ng-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 12:08:18 -0400 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 17:08:17 +0100 Received: from b03cxnp08026.gho.boulder.ibm.com (9.17.130.18) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 16 Jun 2019 17:08:12 +0100 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GG8BHB33292682 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 16:08:12 GMT Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E3F526E04C; Sun, 16 Jun 2019 16:08:11 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D5E256E04E; Sun, 16 Jun 2019 16:08:07 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.102.1.181]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 16:08:07 +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 , tytso@mit.edu, adilger.kernel@dilger.ca, ebiggers@kernel.org, jaegeuk@kernel.org, yuchao0@huawei.com, hch@infradead.org Subject: [PATCH V3 4/7] fs/mpage.c: Integrate read callbacks Date: Sun, 16 Jun 2019 21:38:10 +0530 X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190616160813.24464-1-chandan@linux.ibm.com> References: <20190616160813.24464-1-chandan@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19061616-0036-0000-0000-00000ACC2B88 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011273; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000286; SDB=6.01218855; UDB=6.00641061; IPR=6.00999987; MB=3.00027334; MTD=3.00000008; XFM=3.00000015; UTC=2019-06-16 16:08:16 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061616-0037-0000-0000-00004C3ED7B1 Message-Id: <20190616160813.24464-5-chandan@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-06-16_07:,, 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-1810050000 definitions=main-1906160155 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 | 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