From patchwork Sat Jan 21 06:50:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13110954 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB297C38141 for ; Sat, 21 Jan 2023 06:51:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229672AbjAUGvM (ORCPT ); Sat, 21 Jan 2023 01:51:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229902AbjAUGvJ (ORCPT ); Sat, 21 Jan 2023 01:51:09 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62C276AF7A; Fri, 20 Jan 2023 22:51:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=39g0q2GMkNoet87PSAKRXEi57Kz06JxJxed5jImNYqs=; b=scfHmbkpJOLfYvXGcV6I2DfMd5 LQrdEvNfU1eTndGNfskx0pdds1Y8ipWwDFlDGycNthu5iQxk/ouyFBjyIFk9CZKS0+WonU45VfqeY m+VdmxOOfOu10RfWw+Q1f0xfKdK0eJ4MtHEWVpeooo7lDwTXU9Fwmz6jqqJNfJZ6qaggD2B/mmA1P bwOdrDKGn6U898zPnaX2DY+/mIqCVO6Pv50PB11E6vNIt3PfnHI4DMFmVNv0iCYL9fQ04x1I3Yfot IwtTxanUk8Z5nf63xKby5Ut3gcNr2yqeAWkWTYsd+2fH/W/yl596Z+cQhjqgD+Qf9afLeXEKZNG9a E/4WCpTg==; Received: from [2001:4bb8:19a:2039:6754:cc81:9ace:36fc] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pJ7iQ-00DROU-Jz; Sat, 21 Jan 2023 06:51:03 +0000 From: Christoph Hellwig To: Chris Mason , Josef Bacik , David Sterba Cc: Damien Le Moal , Naohiro Aota , Johannes Thumshirn , Qu Wenruo , Jens Axboe , "Darrick J. Wong" , linux-block@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 11/34] btrfs: remove btrfs_bio_free_csum Date: Sat, 21 Jan 2023 07:50:08 +0100 Message-Id: <20230121065031.1139353-12-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121065031.1139353-1-hch@lst.de> References: <20230121065031.1139353-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org btrfs_bio_free_csum has only one caller left, and that calle is always for an data inode and doesn't need zeroing of the csum pointer as that pointer will never be touched again. Just open code the conditional kfree there. Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn --- fs/btrfs/bio.c | 3 ++- fs/btrfs/bio.h | 10 ---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index d1a545158bb0a0..cdee76e3a6121a 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -226,7 +226,8 @@ static void btrfs_check_read_bio(struct btrfs_bio *bbio, offset += sectorsize; } - btrfs_bio_free_csum(bbio); + if (bbio->csum != bbio->csum_inline) + kfree(bbio->csum); if (unlikely(fbio)) btrfs_repair_done(fbio); diff --git a/fs/btrfs/bio.h b/fs/btrfs/bio.h index 8d69d0b226d99b..996275eb106260 100644 --- a/fs/btrfs/bio.h +++ b/fs/btrfs/bio.h @@ -94,16 +94,6 @@ static inline void btrfs_bio_end_io(struct btrfs_bio *bbio, blk_status_t status) bbio->end_io(bbio); } -static inline void btrfs_bio_free_csum(struct btrfs_bio *bbio) -{ - if (bbio->is_metadata) - return; - if (bbio->csum != bbio->csum_inline) { - kfree(bbio->csum); - bbio->csum = NULL; - } -} - /* * Iterate through a btrfs_bio (@bbio) on a per-sector basis. *