Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1962364rwe; Sat, 27 Aug 2022 23:48:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR7FgdyY6cxUDbC1FsXnv/4+AlFp7/Vbaj1IYc+2Lg+h1lJaGFr609EEyToj2SswWxwjkt5l X-Received: by 2002:a17:907:e94:b0:741:6f75:48e4 with SMTP id ho20-20020a1709070e9400b007416f7548e4mr1204994ejc.331.1661669302502; Sat, 27 Aug 2022 23:48:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661669302; cv=none; d=google.com; s=arc-20160816; b=R4DlWzGZCkC/piDMRk4gI7NWGvPt1KkoGORFwjxh4X5QfD+BwvB/ji6fMPz8Feg9Tl jACpEujucBwi3RgwuexxRIacw0qwKIYJ5pMKkZHTo2ApJQ6k0SgMQ5aZKT+f1ZsZsBNB GssT2gg94YALSFZPinbuS+98oM2DJwPLJbWKQK1YP4ZAoQ9kfeuowT3S7uIvXfBa2K5b pMKJbL/R26RPF42H5rXpdxBa5RdohxN0qr+yAYWUQXA2LtC0OWW+A/TWgCSOUS0/U9Tu z++OSHWjVLte2eXyb+gylopoKWSP40JL+6NW5NgBmj3fGCXvG6831UfjmIsc6ug4p3tR E+Yg== 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=fRNQnbWvCi18EfYQniKSbYUbPGaHtNNkKJJHaER1rPo=; b=UXuTve/Fzah3tviz3NL07szVGWNv+/WEZHWJVOTFJYvUsXcnD3th9Ehp4O+vZaE9+4 jLqb0i8k7h53Ui+Bj/pk+TRbUGhFHKy6vvfekdOetkO+UpBWd6wx0j5HjszHHH+QHWfr 2XcFUsoF8YVojz41jLtPmZFc3i2wcfv+PQnI5UppkHt1YN8cu+hFKbaPq3HuQ/MFXkDt Uw3qSm8SuZSmioRNIY0gXaE+mf2cSAQI/5eS9TgfNkvIWWi1Z0lrkFqZqk41bCRv4pj7 Mh9ge4F5s01M7a1wM6fZ7GFkew65+yonHTFFA242JeMYxsL/zVtdyL9lGo09vapSvCAl 9pvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=KJhgS8nM; 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 w20-20020a056402269400b004486b3296aasi259174edd.511.2022.08.27.23.47.41; Sat, 27 Aug 2022 23:48:22 -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=KJhgS8nM; 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 S232402AbiH1Gqv (ORCPT + 99 others); Sun, 28 Aug 2022 02:46:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbiH1Gqn (ORCPT ); Sun, 28 Aug 2022 02:46:43 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAB0B4B0C2; Sat, 27 Aug 2022 23:46:41 -0700 (PDT) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27S4gA8s012040; Sun, 28 Aug 2022 06:46:38 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=fRNQnbWvCi18EfYQniKSbYUbPGaHtNNkKJJHaER1rPo=; b=KJhgS8nMYn2L3uQkJKmh3kedzshc2HBurHefqsN5UOoPtmW7TJws/7i6K3ZyUK/ICDHZ t7D+IbykBjsz8EsyGvQksT5/jaUubwCJAml4pkn5z6+oQsxD/G4NXalL7ZEIZnAVOXk/ ZEvP0e961iNGeOWv558yRAYz6nvlh2IxZ9JVE4fzcV0PtHlF7WjDHEdta9etC3lmr5hk N/3FV6hoQlhe2oMMKPdyb8w1gbYbb4BjncduHJC8H97ZIRafTv38yNhlewQkMSdBt9t/ jNLbSbPEr8sQhsa6/mUUnrmCzPizqzMJfuK3h8Uwl51au6w73RVSN1++jbLqh+1AZ+P7 mQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3j7w9s7s62-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 28 Aug 2022 06:46:38 +0000 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 27S6kbYe008168; Sun, 28 Aug 2022 06:46:37 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 3j7w9s7s50-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 28 Aug 2022 06:46:37 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 27S6ZhlY015426; Sun, 28 Aug 2022 06:46:35 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma04ams.nl.ibm.com with ESMTP id 3j7aw8s16g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 28 Aug 2022 06:46:35 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 27S6kXGQ41550208 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 28 Aug 2022 06:46:33 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5DFEC5204E; Sun, 28 Aug 2022 06:46:33 +0000 (GMT) Received: from li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com (unknown [9.43.118.96]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 714FA5204F; Sun, 28 Aug 2022 06:46:31 +0000 (GMT) From: Ojaswin Mujoo To: linux-ext4@vger.kernel.org Cc: "Theodore Ts'o" , Ritesh Harjani , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Andreas Dilger , Ritesh Harjani Subject: [RFC 1/8] ext4: Stop searching if PA doesn't satisfy non-extent file Date: Sun, 28 Aug 2022 12:16:14 +0530 Message-Id: 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: 2h2lfDvF62ID1BtXMOWz-JKR2ewnlinI X-Proofpoint-ORIG-GUID: QdDBM5DPXefRpuBEzjUul9s2Nz7psYb_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-27_10,2022-08-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 suspectscore=0 mlxlogscore=878 clxscore=1015 bulkscore=0 lowpriorityscore=0 spamscore=0 phishscore=0 priorityscore=1501 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208280025 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, T_SCC_BODY_TEXT_LINE 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 b02f71f07289..17bf71a3b471 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4418,8 +4418,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