Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp420435rwb; Mon, 26 Sep 2022 00:07:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7DcWsR1X6rLGdEH4m7FqWtMQ48P74D9x4Ig0VO1bUozHKOiCbjt5fclZZJqzBlFE43E9xz X-Received: by 2002:a63:5fd6:0:b0:434:96fe:f508 with SMTP id t205-20020a635fd6000000b0043496fef508mr18617809pgb.306.1664176041257; Mon, 26 Sep 2022 00:07:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664176041; cv=none; d=google.com; s=arc-20160816; b=AcUSJ60CZdPnVbgb2XX2ykGhajf0lNdPqW13/0livS0LICxD4ANfTpSvt8654/ccOz RuGnpWtOZijQCIs3O1Q7sFbLAgw8PEwpUIvPm2V57MMpDbaXc/Riqj6bNrkqcf5KskEn HLgx+NfsT/07NjMRnDwa9EceLP5HCucmcNqBtA9uL4obWzcRM0q6fpHoiWET4nZ/FwGy bjH9wiuD/U+koVvgudRZQNe7dC4BbnBE1jPQuzeajyA+coG3aukRKJ649W4wrSGxQPuq pi+7lPuGUMJn+7D4fd9zuaj5cvnhT7Y8KUnC270/lYocYFEIBBRu/NgQxSroEOWIisbD 6/FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3T8n4DAzpX8976dEkrHYHNj0usjR1dSkjNzRQWeQKjk=; b=VIS6RzXtEGj4gYRhRg0Amhgtz+HQ1ovkC3SFjEa9WvhXU1MWl/ftkJwWQKo/wC1Ap4 nDY4NvO1v6+ExSsxR7lJPprpCzq2ArOVksvwyjgBa7RgkW1Aprod7finz7/mXOhHjYC3 w+DgW2LJSmwK8vXTIHfsuvQwlgrfPQgWVfYL6kpssm6XBjeStT6oZ24Bj2xT2/mbzIcx W4BFXytnzvjCc8pAx9nRj7l4MTZw+QfCTAYxQmzlO4G1X8Rj9kfOAG6t9k0g04Ikdc5n 3IrZD3BzmW4gQizHhZJN3VjmwTTubdZXNiCdQHE00XEtpZywnmhvQpMU7LD66YNAapFE 9P5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=tZz0eXBo; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p29-20020a056a000a1d00b0053e2be48c98si19006623pfh.76.2022.09.26.00.07.04; Mon, 26 Sep 2022 00:07:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=tZz0eXBo; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233846AbiIZHG5 (ORCPT + 99 others); Mon, 26 Sep 2022 03:06:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233625AbiIZHGr (ORCPT ); Mon, 26 Sep 2022 03:06:47 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A9CE26AC3; Mon, 26 Sep 2022 00:06:46 -0700 (PDT) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28Q73uin024562; Mon, 26 Sep 2022 07:06:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=3T8n4DAzpX8976dEkrHYHNj0usjR1dSkjNzRQWeQKjk=; b=tZz0eXBoxcfWJ55abi/B2lftnq7fvhI/igzY5U7v86sEORayyz+BFEWsUr9Dg6iaqux/ qTqaWm7QO67o66o0vA+i2JJ//7GEV510jZTfb7J/i29lUvZDsuuGhapAOP+eu69EQ6sW 734M2EiNTXnTYlzjyMgQfJI5zhoDS/uQKaj1zYqgfWSBL5ByHHT8Dt+R/AHPM7f13qTp FP9LB9l9Gs+jwk7QXxLcqQ5fOVJX1r3mzRGm5AGy/sLPvIts5rnuVOM+u4mK1GZo2SrT Rt/9DlAvH0D0O6JkXJrqKAg42jlDOAbYE5h3fX8EQGEBU7HsTTkSE/zMJR/dCrJtjrju vQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jtb6u5u3q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Sep 2022 07:06:41 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 28Q6PMHx016059; Mon, 26 Sep 2022 07:06:41 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jtb6u5u32-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Sep 2022 07:06:41 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 28Q75a4b024417; Mon, 26 Sep 2022 07:06:38 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma04fra.de.ibm.com with ESMTP id 3jssh91h5d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Sep 2022 07:06:38 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 28Q76aj844761562 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Sep 2022 07:06:36 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E74CF11C04C; Mon, 26 Sep 2022 07:06:35 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3347111C04A; Mon, 26 Sep 2022 07:06:33 +0000 (GMT) Received: from li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com (unknown [9.43.30.221]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 26 Sep 2022 07:06:32 +0000 (GMT) From: Ojaswin Mujoo To: linux-ext4@vger.kernel.org, "Theodore Ts'o" Cc: Ritesh Harjani , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Andreas Dilger , Jan Kara , Ritesh Harjani Subject: [RFC v2 1/8] ext4: Stop searching if PA doesn't satisfy non-extent file Date: Mon, 26 Sep 2022 12:34:52 +0530 Message-Id: <113e30014fdcf409680e20ec1ef4455ace33884d.1664172580.git.ojaswin@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: u4p5KA2iQY4nM0DBaFyolO-g6eJHlDzR X-Proofpoint-GUID: wqpbA6U1hjza_1Lujul9jui8cpi5Oq0b X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-26_04,2022-09-22_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 priorityscore=1501 mlxlogscore=918 spamscore=0 lowpriorityscore=0 suspectscore=0 mlxscore=0 impostorscore=0 phishscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209260043 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org If we come across a PA that matches the logical offset but is unable to satisfy a non-extent file due to its physical start being higher than that supported by non extent files, then simply stop searching for another PA and break out of loop. This is because, since PAs don't overlap, we won't be able to find another inode PA which can satisfy the original request. Signed-off-by: Ojaswin Mujoo Reviewed-by: Ritesh Harjani (IBM) --- fs/ext4/mballoc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 71f5b67d7f28..2e3eb632a216 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4383,8 +4383,13 @@ ext4_mb_use_preallocated(struct ext4_allocation_context *ac) /* non-extent files can't have physical blocks past 2^32 */ if (!(ext4_test_inode_flag(ac->ac_inode, EXT4_INODE_EXTENTS)) && (pa->pa_pstart + EXT4_C2B(sbi, pa->pa_len) > - EXT4_MAX_BLOCK_FILE_PHYS)) - continue; + EXT4_MAX_BLOCK_FILE_PHYS)) { + /* + * Since PAs don't overlap, we won't find any + * other PA to satisfy this. + */ + break; + } /* found preallocated blocks, use them */ spin_lock(&pa->pa_lock); -- 2.31.1