Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1145504rwi; Fri, 14 Oct 2022 13:40:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4/32OcmDDsrfMDQ6StfW0BE8KUA5ujAhkOUMlvvKtJh+97Zgyc5emaYxjKRsdl9+CC0hQd X-Received: by 2002:a63:fd4f:0:b0:45f:d7ef:9f94 with SMTP id m15-20020a63fd4f000000b0045fd7ef9f94mr6295134pgj.137.1665780030302; Fri, 14 Oct 2022 13:40:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665780030; cv=none; d=google.com; s=arc-20160816; b=c97OU7zUp7CGQtMfTxFAwKbqTntdzwlBUQYBR8Rceqb5wkohW1AQRfMUamKEbyq01X RZxuqK8sdiwLA57F4x6Chfx2e00B+o+TXSe1ByOGAmrG1SwfiihzBjNhuq0U1ffV9wYt vmZ2cpjyVgPNVYiCTvZTVLXQgj1mHfe3OMaFXJa2NSDFZX40jjHCXpf5loYJMfLvBI1i nW2DklljZ7IRleLez7mL+40aNPwz96sfy5rxCAtOEI8L9kQ2jM26/uw3BXm/3CMJAI1n PXtrbTYRemXdCu9HIiljZy/btR0QVWc4vAZ5qExEBTBCEn3nlwc9kc9MMuQCBU1UG+iQ FuSQ== 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=xuIGkMtbGcyAU/Mr4jKIpNPZuD6uIExdWpEk0ndUWCY=; b=wnGJw4KrZrbFqeeDL8r+3rXf/iFeMlUuQdXWKlaXJb0YMK9x+ZG0sstGROMnns537G sHJfAcM5LrqRRZsmS1ELH8EfTciqL8Trp23gQCaY0DXezhGG+UF40ZCtQBJfpT3/THPG PpP/3M51Nn1Lpvbtny6huRWa/IydHEnthJo2ywmV2FZAEUN6MTz8915SGuCGoTpDT9cM lQOgNlhwwbzo5a/D2aOd4neL+zxS8BW1mWC3Khy6qBiSv+ZJyjumZxIZ/RigWVQf9XAg 56AL/8adF3BN7Erru/Urk5X1a+ZwQwUhX+2Ub0GUCU5xEY9mdusBUAizNihXADfJozDq 8LTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="El1K/sYT"; 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 y1-20020a63de41000000b00457bc51e1a4si3833378pgi.506.2022.10.14.13.40.16; Fri, 14 Oct 2022 13:40:30 -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="El1K/sYT"; 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 S231484AbiJNUgw (ORCPT + 99 others); Fri, 14 Oct 2022 16:36:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231475AbiJNUgt (ORCPT ); Fri, 14 Oct 2022 16:36:49 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A13EE09DC; Fri, 14 Oct 2022 13:36:47 -0700 (PDT) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29EKHu9p022723; Fri, 14 Oct 2022 20:36:43 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=xuIGkMtbGcyAU/Mr4jKIpNPZuD6uIExdWpEk0ndUWCY=; b=El1K/sYTrnuU4roDBIyA6vjroaja0i7pKUTg9aWsVP8ngIP5aeiSAXhIpdcB8x1Gf2PW J4tcW7/KjJbHNy+up33RznJjcisBlRTUljn+DGhcfP0j+CaOVAdqY2ou8Jd5koKX+F20 fYcVK9Zz/0M9DWq8j3L/e7gyJP1zpRFei+NGTpltUiy8fU3ZuNt4wGhxpEW7Aus+LYoE +t7wn5o3znAC4Q7/2jabk70zntPv9CUV2Kjh8HPFRFIilPiR9CRX5SngbZqNJStpsprh T0UT+0huuypSJDzMqtja56+XGVX8ISAOdPMZEiwfwQEDUmWDrr4dR8uMz7WFwhtwCMC/ KA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3k7c06dkt0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 14 Oct 2022 20:36:43 +0000 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 29EKIBFP023154; Fri, 14 Oct 2022 20:36:42 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3k7c06dks9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 14 Oct 2022 20:36:42 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 29EKZx47024858; Fri, 14 Oct 2022 20:36:40 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03fra.de.ibm.com with ESMTP id 3k30u9fhay-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 14 Oct 2022 20:36:40 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 29EKacBO3736212 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 20:36:38 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1D4904203F; Fri, 14 Oct 2022 20:36:38 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C11DC42041; Fri, 14 Oct 2022 20:36:35 +0000 (GMT) Received: from li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com (unknown [9.43.122.214]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 14 Oct 2022 20:36:35 +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 , rookxu , Ritesh Harjani Subject: [PATCH v2 1/8] ext4: Stop searching if PA doesn't satisfy non-extent file Date: Sat, 15 Oct 2022 02:06:23 +0530 Message-Id: <25807e7e8dfe34c2290a6d472ec6d5cee975b0e9.1665776268.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: 01HGxNg__z3ougdPckPNIHp-EWB5nzyQ X-Proofpoint-ORIG-GUID: m8ZvF5Q7TdSH0kOyG9caaPHWtHQVauYi X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-14_11,2022-10-14_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 mlxlogscore=880 malwarescore=0 clxscore=1015 adultscore=0 spamscore=0 priorityscore=1501 phishscore=0 suspectscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210140112 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 9dad93059945..6fbddabab64f 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