Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2867987rwb; Mon, 16 Jan 2023 00:04:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXuCP8wDzpvrRu3O2pY0TBMjrZbolarUL7ceCbyITZ1gg42nbRA/POV0wmrDBZX2OMOGuhXi X-Received: by 2002:a17:906:f758:b0:86e:2c11:9bd4 with SMTP id jp24-20020a170906f75800b0086e2c119bd4mr6897776ejb.24.1673856257565; Mon, 16 Jan 2023 00:04:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673856257; cv=none; d=google.com; s=arc-20160816; b=VLy4Z53unzh0f013PqbmMA7dLh8DX0mjBDx+cFFycNWnTYHMwtIU0kVHImIQo4eE4T Wx+DejP3B8+IKBl3qKfCiT1wSyGKccypgOEtg624IejnFCcHqIsjkd/oenesJM5rHYwG MmKl7r2icQqbgyIKqlJkPBuF5c7/jDm8cOXvmV/ho24oBjyfTGr6swkqMIGCu/o11hCJ PlpGyINYXFgWG/Gxt53+Sdyge1RDSA6v+IyUN0Ej3ZqtmHrKQ+kekeN2ROGUz/+zDg0m sZqkfIAnU3AddFH9VI3vpRzUZlrXCpS9GZLxYbs/k/bkiyx8eUIMqYxpgV/mPY2ZcUaw Eqwg== 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=ayErR4z7RU1E0mY4Rl/twITSKE3ULnmDMtZUPIVR9cM=; b=pB4J9d31kHbAuHC3a3jgzjainOBILX3cy1OsSk5wSaxuUhZEr3f3rBMuPbonyK2ym0 OrF/ElTZnUtslHJFTYX0FBcwBksJRY6pQYL2wKRxS9Dju/xyLQdMqM2OKs0sZbOUtL7w uwsjKP+Xu/A8wPIAY/zTzHis59219gmtI8BYvML73Ab9+0pwcu62olm0atKHfcxK2x1y 8VraYiCsepxZmLZh9ayuG148odpOkZWQOQLP9X+BrWoSRwcyUajLR2gTiZMo/4xUZ7Kp 8yYIFI9y/dYkMf/VVaWbYZCPMFrquQcVQqRFS4WQ+sa8RCkLYE+9TDmQNQuax6Vp2wxC vKaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=IdlTGQAb; 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=REJECT 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 z13-20020a056402274d00b0049e26784c0asi353503edd.39.2023.01.16.00.03.49; Mon, 16 Jan 2023 00:04:17 -0800 (PST) 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=IdlTGQAb; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232197AbjAPID1 (ORCPT + 99 others); Mon, 16 Jan 2023 03:03:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232222AbjAPIC4 (ORCPT ); Mon, 16 Jan 2023 03:02:56 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1A324ECF; Mon, 16 Jan 2023 00:02:30 -0800 (PST) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30G5pgkS022686; Mon, 16 Jan 2023 08:02:26 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=ayErR4z7RU1E0mY4Rl/twITSKE3ULnmDMtZUPIVR9cM=; b=IdlTGQAb12cpww1GOvEbO2QKK26pVKFXCOIl9oDj1v24MmggLdr0NeEKhGjJY20t3iEG f6ZAinRpe3e/kFEIjaqdFJEtrafGhBlaWgZIeVZQ4Udql9nIwW0PtqyJrQR50y4B0vvP TU/SWMfn5LDZ6vXgGI/Vrvr0u659xZUv3eGdF2aHnBPn3ii2ocMVQz3q8MvIqMbedkKQ 2mjZVK7Umu0fSV8l6NBhg3tWy1n/8RiWRKGbXMC4OqpsjwfThLsSH6C6PcGeCGLdbPey MTChvqynSRbJ+HrF25aGnSBSjWyhKbc3BWO1Dn7MR0qhjZHNyil5e7giHYO27AfQdCRo WQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3n4g07saxc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 Jan 2023 08:02:26 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 30G7wBFJ011899; Mon, 16 Jan 2023 08:02:26 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3n4g07sawb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 Jan 2023 08:02:25 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 30G1V8TP004735; Mon, 16 Jan 2023 08:02:24 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma04ams.nl.ibm.com (PPS) with ESMTPS id 3n3m16j3t9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 Jan 2023 08:02:24 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 30G82L5k47645034 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Jan 2023 08:02:21 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B3F4A2004B; Mon, 16 Jan 2023 08:02:21 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F20C020040; Mon, 16 Jan 2023 08:02:19 +0000 (GMT) Received: from li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.in.ibm.com (unknown [9.109.253.169]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 16 Jan 2023 08:02:19 +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, Jan Kara , rookxu , Ritesh Harjani Subject: [PATCH v3 1/8] ext4: Stop searching if PA doesn't satisfy non-extent file Date: Mon, 16 Jan 2023 13:32:09 +0530 Message-Id: <20230116080216.249195-2-ojaswin@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230116080216.249195-1-ojaswin@linux.ibm.com> References: <20230116080216.249195-1-ojaswin@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: WHRdd5FuSeXn01mX9O2E5XXj1X49gC-X X-Proofpoint-GUID: BuRvIj6G13_uT54NYjYRNp2nmO1CrYE_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-16_06,2023-01-13_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 malwarescore=0 spamscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=934 clxscore=1011 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301160055 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) Reviewed-by: Jan Kara --- 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 5b2ae37a8b80..e0bbca523b4b 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4382,8 +4382,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