From patchwork Tue Oct 27 13:50:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 307223 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 876A4C4363A for ; Tue, 27 Oct 2020 17:02:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 37A0720725 for ; Tue, 27 Oct 2020 17:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603818168; bh=+i3BGoxjVCqCb0gEy5xTlqSvHEIsYk8F5FOJZD8JAUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=PbZ9judYYlu+sSktJRkJsqfkR5Vernr8c+iGY/6fC3PO1CQxtAH/HdAmR8a7Lh3V5 3rjpnnPtqUPd5uks89/IFkBHyKZ9X/cpPc5aVW9/NypUMJ+5nBlqHA02ULVw/gsMqJ tqbG1yXsjqB3A2Mnm5k6OhnoYkZKcH37Y95h1620= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1793694AbgJ0PHu (ORCPT ); Tue, 27 Oct 2020 11:07:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:35168 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1788930AbgJ0PBX (ORCPT ); Tue, 27 Oct 2020 11:01:23 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4478E20714; Tue, 27 Oct 2020 15:01:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810882; bh=+i3BGoxjVCqCb0gEy5xTlqSvHEIsYk8F5FOJZD8JAUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cohELadqZlfmJuHV7Mv3erCw5RTxlG0Dlw57MnyaUZfp7PV/Gxu+OIj9JBEDffjLi yzC3DDEkamzLmBu8ZH3FYa+YGiDEYcbANjDr2hpWH/RtJE7gfRf5G5S0ES6fAcrmND ahaqJdTFyySZGp/buNlwJd2iKTObmMwJJmAl9gPM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Matthew Wilcox (Oracle)" , Christoph Hellwig , Dave Chinner , "Darrick J. Wong" , Sasha Levin Subject: [PATCH 5.8 279/633] iomap: Use kzalloc to allocate iomap_page Date: Tue, 27 Oct 2020 14:50:22 +0100 Message-Id: <20201027135535.759658308@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Matthew Wilcox (Oracle) [ Upstream commit a6901d4d148dcbad7efb3174afbdf68c995618c2 ] We can skip most of the initialisation, although spinlocks still need explicit initialisation as architectures may use a non-zero value to indicate unlocked. The comment is no longer useful as attach_page_private() handles the refcount now. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Reviewed-by: Dave Chinner Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Sasha Levin --- fs/iomap/buffered-io.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 897ab9a26a74c..b115e7d47fcec 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -49,16 +49,8 @@ iomap_page_create(struct inode *inode, struct page *page) if (iop || i_blocksize(inode) == PAGE_SIZE) return iop; - iop = kmalloc(sizeof(*iop), GFP_NOFS | __GFP_NOFAIL); - atomic_set(&iop->read_count, 0); - atomic_set(&iop->write_count, 0); + iop = kzalloc(sizeof(*iop), GFP_NOFS | __GFP_NOFAIL); spin_lock_init(&iop->uptodate_lock); - bitmap_zero(iop->uptodate, PAGE_SIZE / SECTOR_SIZE); - - /* - * migrate_page_move_mapping() assumes that pages with private data have - * their count elevated by 1. - */ attach_page_private(page, iop); return iop; }