From patchwork Thu Mar 16 20:48:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rix X-Patchwork-Id: 70971 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp703558wrt; Thu, 16 Mar 2023 14:06:03 -0700 (PDT) X-Google-Smtp-Source: AK7set/pJvDRmnmGUO7lMbBRs/6XTNBf+9C0UjLt9V1FjjmlUECf67VVpHHMAVXPMYdL7TZ1/ECe X-Received: by 2002:a9d:7116:0:b0:686:b1e5:6e93 with SMTP id n22-20020a9d7116000000b00686b1e56e93mr24340726otj.30.1679000763504; Thu, 16 Mar 2023 14:06:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679000763; cv=none; d=google.com; s=arc-20160816; b=cDUnwiG5nPoAxDxw/w/Ihv+PInAozjpFOjo91kpHOApl5v8N86K8J28VhMrFnCYd94 OLIpyT7UUWSv29/VEIPEe+7ZpTzUsjGWedORHEPVgpph39O7k+tojTRD5Yrw++t4cNK6 PBU0kHDHSjNus1UIjqgiSq42wrw8ldo//j9/6/nTCs2RwdfB4YSolT+lcTPFvQyGnwxK ww13zID0C/bTe0sjXHZPaMRfWvmN4tmWyaMv2XD/6VJxJaE85J6i1hSn8dVU55UpbQsw J1OWk9EmAsbv2v5ImR+in+Mu9D3lwcGfgf4PSSJLK6V/pZJEvHvd9gPY+5RNWXxhU40j WsaA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=so3qFG339eU0WcPzgjTpfG6EeynpQDYCHVF6oNptDps=; b=Vx2Cjak2IX3a0oVTS3KZOoHFTvCYMBCH3P5DFwUfSn5lSpY2OePdAn287enguEb1DN X3tV4lt9mgl1oE3FfS8YjC1gW4vi1v89nR/ruiCvP8WTD3GY5/csqybWzCgsS5XT8kw/ lMKOd8XFpWZHfHxU2jw/OxZQC87hx0UYiID9M0tl7zhV/6up7VIVbXhsNZkl3Ni4+0eS yBcClDJ6ZNc91nDSfWqb8emglwKx1Q9bGqPRRvBBksAOOYxOFwQGmziBVeaZzie9Q3cq m6U4MohD0kzSKXbzouhNYDuBMRtPMjpyCLcdoyg0rq3weqekDYxuBXjqHWThbyas0Esc U9Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="c0mD5/l+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v15-20020a9d4e8f000000b006943dbd130bsi501894otk.294.2023.03.16.14.05.49; Thu, 16 Mar 2023 14:06:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@redhat.com header.s=mimecast20190719 header.b="c0mD5/l+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229521AbjCPUth (ORCPT + 99 others); Thu, 16 Mar 2023 16:49:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229693AbjCPUtf (ORCPT ); Thu, 16 Mar 2023 16:49:35 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1088B2B281 for ; Thu, 16 Mar 2023 13:48:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678999723; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=so3qFG339eU0WcPzgjTpfG6EeynpQDYCHVF6oNptDps=; b=c0mD5/l+s2c6i1G0PymBAEeLo2uD0+3Yykx1lyQPWtaQa+/pHfgJa3CSggI6512ao/Wr6q 6C8BUUQ64SuJ3Zjn8yFwIThUnnnONFv0iTB25gOM5g7PVN+f0ydDZLYzpkJFfyKET+DwhK Olps8576E/WiU+9xRBu9ZxyD+bUiUMw= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-650-JyKTu_U5M4anpXKgAQ2tig-1; Thu, 16 Mar 2023 16:48:42 -0400 X-MC-Unique: JyKTu_U5M4anpXKgAQ2tig-1 Received: by mail-qv1-f70.google.com with SMTP id a15-20020a0562140c2f00b005ad28a23cffso1723897qvd.6 for ; Thu, 16 Mar 2023 13:48:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678999721; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=so3qFG339eU0WcPzgjTpfG6EeynpQDYCHVF6oNptDps=; b=DPBsD6utEvwH6RYTKBbw/z06U+sPfLcGlqkYSfP4DkD26MhqxDLgdZlxGeAdFzRFTB G8iRflEvtJKTOlIJoA6QjM4WNtTT3fWOVDHZbf8uHEe9PhzvRx7C1Ez4q+aHQ40LyF/N pvd7mLn7Ah8ycTUktrVTv8wY4DxutifOm7BgXiMtVcOR3ItMu7f1VAz0OyDttZA2Tb2f 7xSZmEgLq/RKMQAk+oSLR/PZj3vq/W8Oh/HW9Zda0jK0vXEhK0NS2Qeliq+Te4XSqEKg ksjHqrGOmMBjX3SSrNFzFKmjWbWeHuRttnVUxOn4xXSvkjS8aeScvQfbib4SVajLbLAl lodQ== X-Gm-Message-State: AO0yUKWM14qL51TaXxFkw90uGs73oTiGRxrIyLrGSaZ50YVGyLVUqeyb uxP6YCscNmFZKQ5xq3FcijCF4vTVJ83Z1iKPtLvL8QRVbwS1c3Nzrlp54v+JQCAhIWUcQvCtz52 PlJ2Ocv37BJzutfQ62U8PisBeJvUHq+Fc X-Received: by 2002:ac8:5e0f:0:b0:3bf:be7d:b3e5 with SMTP id h15-20020ac85e0f000000b003bfbe7db3e5mr9466326qtx.41.1678999721610; Thu, 16 Mar 2023 13:48:41 -0700 (PDT) X-Received: by 2002:ac8:5e0f:0:b0:3bf:be7d:b3e5 with SMTP id h15-20020ac85e0f000000b003bfbe7db3e5mr9466304qtx.41.1678999721376; Thu, 16 Mar 2023 13:48:41 -0700 (PDT) Received: from dell-per740-01.7a2m.lab.eng.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id n185-20020a3740c2000000b007402fdda195sm236462qka.123.2023.03.16.13.48.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 13:48:40 -0700 (PDT) From: Tom Rix To: tytso@mit.edu, adilger.kernel@dilger.ca Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, Tom Rix Subject: [PATCH] ext4: remove unneeded check of nr_to_submit Date: Thu, 16 Mar 2023 16:48:31 -0400 Message-Id: <20230316204831.2472537-1-trix@redhat.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760559904679054727?= X-GMAIL-MSGID: =?utf-8?q?1760559904679054727?= cppcheck reports fs/ext4/page-io.c:516:51: style: Condition 'nr_to_submit' is always true [knownConditionTrueFalse] if (fscrypt_inode_uses_fs_layer_crypto(inode) && nr_to_submit) { ^ This earlier check to bail, makes this check unncessary /* Nothing to submit? Just unlock the page... */ if (!nr_to_submit) return 0; Signed-off-by: Tom Rix Reviewed-by: Eric Biggers --- fs/ext4/page-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 8703fd732abb..b847131bc958 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c @@ -513,7 +513,7 @@ int ext4_bio_write_page(struct ext4_io_submit *io, * (e.g. holes) to be unnecessarily encrypted, but this is rare and * can't happen in the common case of blocksize == PAGE_SIZE. */ - if (fscrypt_inode_uses_fs_layer_crypto(inode) && nr_to_submit) { + if (fscrypt_inode_uses_fs_layer_crypto(inode)) { gfp_t gfp_flags = GFP_NOFS; unsigned int enc_bytes = round_up(len, i_blocksize(inode));