Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp18639rwb; Thu, 6 Oct 2022 13:47:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7A9pjD+g4kz7pqhn/ijrYZFpbCUeCsD9Ndx0bPqc7GA17Z6QcYxy9uBLLpq2BbA9/2lAGj X-Received: by 2002:a63:4042:0:b0:43b:ddc8:235 with SMTP id n63-20020a634042000000b0043bddc80235mr1490168pga.498.1665089241301; Thu, 06 Oct 2022 13:47:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665089241; cv=none; d=google.com; s=arc-20160816; b=cK4AZClso3dHtVPi5fXx4YyAxDDeOlpFGNvLZYytFdY828ZWbUtMpjYFqNVzIQb22f RvNPQYiDWtSrYhg276N3uD3uNu5kSjnpaX6uNj58cRfqitNeHmWxQVMbVOiP9/2MQ3Xp ibNBLSGV33wIqA36flxP03FL+19CHYGg1/m5Aq9Vu58Qcsz9m4rLJKqy2zs3YRbsZfpa fj+jV3PAYPB3/ieblj9AmiwcAP4WKE1TyJuwyjr+C0gEwDIG/nsI+AQjbTHv1S0Eiubc 2RATcjvJnbEMlK4gpAhP69NAAUjGni93IFEJ8exHdEl7fIvy3DdoEEE1qwev8hZFHRmR bPog== 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=auELQM2GIqy4COe7ErQkyGQDVlCTr6Vd03++wnP/qZzCIAzm27D8uQZHDLcBW/bk8a mOjwB3AiU5IZg1n2tllYLUzh1/Qox5263rZ0H4+wC0KgREpaSuDu8ophn7Ig0z3xJ4h2 lZUhdnFoeEBR4QnhhKMUQ1oFxgKcH00wlYOwMlvavo28qvOTwzk0FqByvg2IA19PM08S Z0G6vwbBTP2PtLYR22V5cdLCHnX9W2UYpqj9dcH/MmWLUTF85fUcxj4idf2GyxAuJe6x USiwSCOqfro6f0hvvjX17TC/LmWb0BYo/L2LJqwMqjUJ43NZX+sKrLB8qsatjIB1jX4W l77A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="dw/xTEuI"; 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 b1-20020a056a000a8100b0052daa005a8asi48873pfl.374.2022.10.06.13.46.59; Thu, 06 Oct 2022 13:47: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="dw/xTEuI"; 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 S232294AbiJFUqt (ORCPT + 99 others); Thu, 6 Oct 2022 16:46:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229540AbiJFUqk (ORCPT ); Thu, 6 Oct 2022 16:46:40 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D843C34C1; Thu, 6 Oct 2022 13:46:39 -0700 (PDT) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 296Jg7Mn028945; Thu, 6 Oct 2022 20:46:34 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=dw/xTEuIBhJzuBTsWasZr95H7yxzSgZ+Oqt2Z0o8Kqlb/+7Eal/ne8v+dLuy0pmVQm30 K4opuMPhwu3wEx2wNAjJZYY4NbVPNBrGXAXh1EUnX4W9KE3rKXbunJv2TGxsxsdP9G3c 1GZJjVhMjUIzut1NnHT0ToTiCEDI1WHWbO3FMr+ZsPM3Z4pcgjmQWYwFMVBIaq2iYzGZ 3uq10CGdr6+17dfrHWxmXL4+y+0/148x1ZDCTEIIfP95/RXaYkMWxnYEf9qXy+rIApsm 7fGQZqkCPZGQB3NVRJdTi7v5ONqq3pf9KZVyAHSWX09ZtaN7nO62Oyj0bS+4kmljuBLS 9g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3k25db1sbt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Oct 2022 20:46:34 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 296JqwCE011082; Thu, 6 Oct 2022 20:46:33 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3k25db1saw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Oct 2022 20:46:33 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 296KaMrd016508; Thu, 6 Oct 2022 20:46:31 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma01fra.de.ibm.com with ESMTP id 3jxd68wm57-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Oct 2022 20:46:30 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 296KkSRY3342950 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 6 Oct 2022 20:46:28 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A1F4FA405F; Thu, 6 Oct 2022 20:46:28 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9AD2EA4054; Thu, 6 Oct 2022 20:46:25 +0000 (GMT) Received: from li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com (unknown [9.43.110.181]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 6 Oct 2022 20:46:25 +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 1/8] ext4: Stop searching if PA doesn't satisfy non-extent file Date: Fri, 7 Oct 2022 02:16:12 +0530 Message-Id: <25807e7e8dfe34c2290a6d472ec6d5cee975b0e9.1665088164.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: HE3DgdXNx67ILzfEtqQoebNchbVI472H X-Proofpoint-ORIG-GUID: QdxlAS92YOepPO_ouB-CH4avg84TToQG 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-10-06_04,2022-10-06_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=883 mlxscore=0 priorityscore=1501 impostorscore=0 adultscore=0 bulkscore=0 suspectscore=0 clxscore=1015 spamscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210060121 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