Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp240760rwl; Sat, 25 Mar 2023 01:14:43 -0700 (PDT) X-Google-Smtp-Source: AKy350bs63VpJ1Vepim3TUeNW9f5LnrElq9BcdMM4f63lfe3+nDQv2LLY4+MHj1KebmtqHdrLw45 X-Received: by 2002:a17:906:1685:b0:930:660d:8f92 with SMTP id s5-20020a170906168500b00930660d8f92mr5822924ejd.52.1679732083045; Sat, 25 Mar 2023 01:14:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679732083; cv=none; d=google.com; s=arc-20160816; b=1KnH/IaFgGx3wq4DNQIUe63H1pxNGA439cmmxNlx+gp3UBGoZ3j7xuCaSplxnpnsLh cl7PzxZi1myXSioh6DoCYPJjQN9ZXhvBDnOgoUJSigS6ZnMU6sONz0CPez82zSwpBO7k EO5TN5kIuN8QEz0nP0+IVC+u8OawcLR6qYtXpDshjaf9CeqdR20CjBzKVZDlo5Aspe9J 6GW1jta6m9SOg9RN4B2TjWvlRJlE+4+mPcq654oTo9H4nCBmluXh3I6o7AB0+BHKFClC z58He2SfacfMpU8Sld1fyHIB4PYZJB6JoV99a9+KkZf5lwx1fM5M8aIuHyB6sMJxoOQ+ 4aGw== 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=Ce8f9KNGW5979wm/oVAOBIBZYIcLX/tzeGhMWRBko+8=; b=HiCL6gdC+e0ba2HAX/cW5F9KTpQ27wQ7jx/0shQGJsi2JIKDX88D6TKFjs8TcOR98d pFglFcWkZhBNI9bakeAW4WGvS6YSzBcj23UhcHJ/emcKJYcTdhYMT9IXwKZC6NxveAnl AcB8EYBz4uEVJ+T2EKeU8pUK6fJ1/5fcpy30vhVhLaIUFHnnySEO20IqdRBJ2y+Gjlso 9/VJufcRq9c0f7aFdzWoc87m5+n3m8Bp51CMFDCRxrd693cXWl+Z3GnI4g1rLkMqJBpO ZXmMgJbjtZN6fNfPmwyalHQDbVkMypWkR4Z3gk2CYbPMqLxCHI9xFD9CCMNGYeLt3CDi CM1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=oeA1CvbY; 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 la17-20020a170907781100b009300276cb0dsi22095769ejc.720.2023.03.25.01.14.19; Sat, 25 Mar 2023 01:14:43 -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=oeA1CvbY; 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 S231737AbjCYIOK (ORCPT + 99 others); Sat, 25 Mar 2023 04:14:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231704AbjCYIOB (ORCPT ); Sat, 25 Mar 2023 04:14:01 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AB09F75C; Sat, 25 Mar 2023 01:14:00 -0700 (PDT) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32P5HtmX025281; Sat, 25 Mar 2023 08:13:55 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=Ce8f9KNGW5979wm/oVAOBIBZYIcLX/tzeGhMWRBko+8=; b=oeA1CvbYjlbxMjeqHAfz3jFRhrFPieEE+4t/xgxVNLaYTv2l8fRQXVHl1KSf80+1I5Ft UM69Ykfsc5lRiAYlIdTNHvmYsP25+MgiwOzSltyMc/xUqrqHxFLiMvG8MnTSy5wVLtZM GiF0BQTr2GNj3ZbNJBBTsl+X56SuQ35JBiAHiHH6Ixr3ASRGVJ98sG4CAKRCB6ueIelX VjAM3/wnybX1t13dtlHnGUO0yZkUmNvdUSU0ObDB92FOzSYQd3H/fkvaFypoWoeHjUro WyHKoBP9NFxKUEZG/lmE2QWNWuNZuYTjycyXd3C5qBGBehuW/ihKK5XbIipzIWm/98lX OQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3phtpg25nr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 25 Mar 2023 08:13:55 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 32P8CGYu029481; Sat, 25 Mar 2023 08:13:54 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3phtpg25nf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 25 Mar 2023 08:13:54 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 32P2tdSw007652; Sat, 25 Mar 2023 08:13:52 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma05fra.de.ibm.com (PPS) with ESMTPS id 3phrk6g71f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 25 Mar 2023 08:13:52 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 32P8DnkX17039976 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 25 Mar 2023 08:13:49 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1DCE720043; Sat, 25 Mar 2023 08:13:49 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1D45720040; Sat, 25 Mar 2023 08:13:47 +0000 (GMT) Received: from li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com (unknown [9.43.63.61]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Sat, 25 Mar 2023 08:13:46 +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 v6 1/9] ext4: Stop searching if PA doesn't satisfy non-extent file Date: Sat, 25 Mar 2023 13:43:34 +0530 Message-Id: <42404ca29bd304ae2c962184c3c32a02e8eefcd0.1679731817.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-GUID: XU9Rmc49QvfNIP3yOpCjeZypVZ1OKELJ X-Proofpoint-ORIG-GUID: o5SIVKgONGFKdKFVDG3Z-kUBkAqZ5wpQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-24_11,2023-03-24_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 adultscore=0 clxscore=1015 bulkscore=0 spamscore=0 suspectscore=0 mlxlogscore=969 mlxscore=0 phishscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2303250065 X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 63a68cee36c6..ed58cefed7fa 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4379,8 +4379,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