Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp628088rwb; Tue, 27 Sep 2022 02:20:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4S/YbmCsQE+tvTgQ1KJsvfeZCxA/jqk4OJChDlOaBWmYqHh6bd+vEErEZ0qxiW/sSCqEQL X-Received: by 2002:a17:902:b20a:b0:178:6f5b:f903 with SMTP id t10-20020a170902b20a00b001786f5bf903mr27007326plr.39.1664270454963; Tue, 27 Sep 2022 02:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664270454; cv=none; d=google.com; s=arc-20160816; b=FuER6Mkd8V7kpCUd1PzrIIL4u1h+9NqGAWWyQ26Q9oEs+26cCB89tZriBZtv2pZa14 KKpZHdtl35QwLAF6JXF+z0450EycaEEL0iZb+7F3hz9PN2gtJoHoUsthA9+E/cHfIXk4 dIG1HO2w86aHkhMqsWXNq0k6DFe+5tCfeS+AneW30gJL9O/CMJFmjAkE/0Eu7RfSr1Qp sKJ1LZTAtNZgpCRlUsUXtdMSHhqiC/wRExt44kOl5L/KEqdHP8aeGENPpDgU5FDGrZx1 u9RFbS2a6/mRIZ6UnHvcM9VP+ry33z7fe67deYKlMFxEkbyZIDQs9j02Aps5SCXib2AZ +OVw== 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=3T8n4DAzpX8976dEkrHYHNj0usjR1dSkjNzRQWeQKjk=; b=fqBe1GYc1Yp2LlJ3xdqvP1+32aRvMRqxjP8ETkKaWzYGBnfepiwwPZmulW1NnhN88Z eeJgLMpv+hNuI+pA8sk3qqHbyVa6O6Z6vOc/7YoibqOeIdG4zg7hDk/xnvTGMRJ8W2BS QGuHOpM9enAmnnjogzaN2hGzqdv9Jf5VOc5dQxFzuDTl7p97pLb47gHWgUc/q210v42n tFAK2E5zgBRujGtzp8S2fUak0J8QUajrSERkuVeFsO+08j9Im8eqNf/eGEekaghRsT4G 640U54BIVhlUOX+I7DcrPA/7lZuxatriMD79flv4UkGxxUYi3QqbdAUVhemmLimwUzOo qPJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=gRadkLVP; 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 t80-20020a635f53000000b0041b64ff7fd9si1284303pgb.517.2022.09.27.02.20.38; Tue, 27 Sep 2022 02:20:54 -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=gRadkLVP; 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 S231443AbiI0JUR (ORCPT + 99 others); Tue, 27 Sep 2022 05:20:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231607AbiI0JT4 (ORCPT ); Tue, 27 Sep 2022 05:19:56 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9A2BD33CF; Tue, 27 Sep 2022 02:18:52 -0700 (PDT) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28R8Noui032801; Tue, 27 Sep 2022 09:18:27 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=3T8n4DAzpX8976dEkrHYHNj0usjR1dSkjNzRQWeQKjk=; b=gRadkLVPYVRIZEtrGmRmQ5poktXRMLx7ZLeg5f84EBrn8jHJNUOQnrDTxEaPNMyJwuGJ eAyNbwxrV9Vk6mArVSgJgGs1Ma3ilbWqr+DZyusDfzpxI4r+tB47JFVU7Pvh0MCIkTjy jIsX3P7FK1XPTpdCxHOd5NYu18AeEeo8+wTWNsmvNsVRhHYeTQS4fEL6qcIpnCW4CH4d y2iGHJDiZ92knZrxsZ2qltnqgNWJB5PPjyge/q9MografJWWcedozpGOh1AMmKvViB9N q0XwPwpc1tv9DPJyH+9/XLazUnQUER/cLkUzgIKdz2J7FiXa/BXKkgv8b+E53P65g2jo 8A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3juwmmsry5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Sep 2022 09:18:27 +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 28R8PGsW038989; Tue, 27 Sep 2022 09:18: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 3juwmmsrx5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Sep 2022 09:18:26 +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 28R95UB3008880; Tue, 27 Sep 2022 09:18:24 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04ams.nl.ibm.com with ESMTP id 3juapuh8tu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Sep 2022 09:18:23 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 28R9Insp32768326 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Sep 2022 09:18:49 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A966C42041; Tue, 27 Sep 2022 09:18:21 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1FC2C4203F; Tue, 27 Sep 2022 09:18:19 +0000 (GMT) Received: from li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com (unknown [9.43.61.44]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 27 Sep 2022 09:18:18 +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: [RFC v3 1/8] ext4: Stop searching if PA doesn't satisfy non-extent file Date: Tue, 27 Sep 2022 14:46:41 +0530 Message-Id: <113e30014fdcf409680e20ec1ef4455ace33884d.1664269665.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: pyBo8hJ_sehz19seRojpMZCKujjzUPXS X-Proofpoint-ORIG-GUID: DUPyLToIthNE97Yc6NeHZbFYflEEOqNh 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-09-27_02,2022-09-22_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 bulkscore=0 mlxscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 mlxlogscore=950 spamscore=0 phishscore=0 priorityscore=1501 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209270053 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) --- 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 71f5b67d7f28..2e3eb632a216 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4383,8 +4383,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