Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3954660rdh; Fri, 29 Sep 2023 07:15:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFWA/t5xFjN2zM6qzsWyjTNnNyjIjjzUl2ej6SatR7D9xfFEoLGjn9dQA1OZsYZLBiuPEw3 X-Received: by 2002:a17:90a:e503:b0:26b:56fa:87d3 with SMTP id t3-20020a17090ae50300b0026b56fa87d3mr4272831pjy.31.1695996921653; Fri, 29 Sep 2023 07:15:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695996921; cv=none; d=google.com; s=arc-20160816; b=o5cD1KWXA+cxo1obV71PG6etpkbu8hsvroY3HZj9nRQMezZ8rtABJAdPF0hihSnOkX uo9/RT9iLsWD+v+3azfSSQIkGctnl+Nuk+fawAqooWt22dhrPHJjZTagviHj5ocNVhN0 1Mz0W0OM5kjFf0wHuQMy++sjCwJuwsXGfNwVelNwv8gux+WK8aYuvrZSt103g4NOMu7S xCFvACSdT1cqJ3dQXwAFRe4XyFq5S1sCQuZyE/XCALvRhURrAUj+ybuLiXklRGQsXEBZ ei21JS+Dq0XIQFA/2AU/ZVJLkexSUDObDk0fH4B1OOLFGNy3p0JiSajvomol2COrB64/ blug== 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=/MJo3EBySglF0dpjswUzhDX1+E3ul8XFL5YMWvHDjOE=; fh=PJMzc3Hp2p3Dvzr5TvkhdjVsfQ/xiDeCtVytQiIqKjY=; b=qhwNlGyoSsEbxnvDRr4+AothkAws+BoIq3T227PlmZ7T5DCprIlibQM3FADSIEwqLy HrVPw5IKah2BlKQqtcO/mnGZcPuFOdlMwCeXHqz8iyiZTocvugJ/9ZkURY26Mbz+qSbU ZGg8Vs7RkYYbXoo3OjtsSl6cNM3G4hg/9uOBUDw4GqAH/epnunOLfcRCF2l45h2xmo2M ClrG5Z+o2DmQeB+q2zYZW8gd2Pv3sDPnAUhbPecmMtb4puoD8467A1KnaMt9kIkGxnqA ksS4NGrqEYCTmQuDuD/pWXlW14qsp6r7Kw99M1Slt25aXlsfACcsY+e2p+StTkKWDXBh HGyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=ClyEUSuk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id g14-20020a17090a67ce00b002746ab58dfcsi1634683pjm.18.2023.09.29.07.15.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 07:15:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=ClyEUSuk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 744F88058B53; Fri, 29 Sep 2023 07:11:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233253AbjI2OLO (ORCPT + 99 others); Fri, 29 Sep 2023 10:11:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233149AbjI2OLJ (ORCPT ); Fri, 29 Sep 2023 10:11:09 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D61931B2; Fri, 29 Sep 2023 07:11:05 -0700 (PDT) Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38TE9vFa031221; Fri, 29 Sep 2023 14:11:00 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=/MJo3EBySglF0dpjswUzhDX1+E3ul8XFL5YMWvHDjOE=; b=ClyEUSukJLtC8MQucAef2XrzV2fJ8q+8J5uJPcHkN16d9LRJA6fIi137AkPzXT/bMl5w KCWBtCWUE3xJoBUAX5SUXFj8fyjO1n622C1IH/+nO4O+YozI2C24Zton7ywUOt8X6V1W tubiPsytmqZlQGcLCMIfmi79CWWeflaPUL4yF0uLh/G0CaBb9DDPdLWOLvtLQdB75jKn zWgZpNtFpI1lvMd29/eRNkEK9N5xEhy9gW80/rdRLm+ArQltVKpf8VQAA8hlj+1Gw+t5 KskR0fi12+LdWRyiE6AchhcY9DfC7db+T/yO93DNwDBLmVRiP+y68O+hty5kNSx8zQlx fA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tdw5uvyp2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 Sep 2023 14:10:59 +0000 Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 38TEAxuN003610; Fri, 29 Sep 2023 14:10:59 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tdw5uvynp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 Sep 2023 14:10:59 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 38TCOnKK008234; Fri, 29 Sep 2023 14:10:58 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3tabbnw47r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 Sep 2023 14:10:58 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 38TEAutc19399208 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 Sep 2023 14:10:56 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 596D42004B; Fri, 29 Sep 2023 14:10:56 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C46E320040; Fri, 29 Sep 2023 14:10:54 +0000 (GMT) Received: from li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com.com (unknown [9.43.84.228]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 29 Sep 2023 14:10:54 +0000 (GMT) From: Ojaswin Mujoo To: linux-ext4@vger.kernel.org, "Theodore Ts'o" Cc: Ritesh Harjani , linux-kernel@vger.kernel.org, Jan Kara Subject: [PATCH 3/3] ext4: Skip unwritten buffers in __ext4_block_zero_page_range() Date: Fri, 29 Sep 2023 19:40:45 +0530 Message-Id: <143d41362a57e453f5a2cb00dc71e38e020c1c20.1695987265.git.ojaswin@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 3cq2_C6yRHtd3NCt_JcnXW6tzwBTPs7a X-Proofpoint-ORIG-GUID: tlX1vHivoJaFdXqACsLF9u4Od2_qYlOg X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-29_11,2023-09-28_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 mlxscore=0 bulkscore=0 impostorscore=0 clxscore=1015 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309290120 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 29 Sep 2023 07:11:51 -0700 (PDT) If the buffer is unwritten then the underlying block should already return zero for reads. Further, if it is not dirty then we can be sure that there is no data on the folio that might get written back later. Hence we skip zeroing out the folio and underlying block in this case. Suggested-by: Jan Kara Signed-off-by: Ojaswin Mujoo --- fs/ext4/inode.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index de8ea8430d30..75a951ffa3cb 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3659,6 +3659,10 @@ static int __ext4_block_zero_page_range(handle_t *handle, BUFFER_TRACE(bh, "freed: skip"); goto unlock; } + if (buffer_unwritten(bh) && !buffer_dirty(bh)) { + BUFFER_TRACE(bh, "unwritten and non-dirty: skip"); + goto unlock; + } if (!buffer_mapped(bh)) { BUFFER_TRACE(bh, "unmapped"); ext4_get_block(inode, iblock, bh, 0); -- 2.39.3