From patchwork Fri Aug 21 12:46:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 11729381 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB96A739 for ; Fri, 21 Aug 2020 12:46:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A833A207DA for ; Fri, 21 Aug 2020 12:46:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="QGRpdUwh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728648AbgHUMqU (ORCPT ); Fri, 21 Aug 2020 08:46:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727837AbgHUMqT (ORCPT ); Fri, 21 Aug 2020 08:46:19 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC5E5C061386; Fri, 21 Aug 2020 05:46:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=Vi3dyhpPSVNnBr48T2kaEEh7Qye4Ig7BISvbjHctEw0=; b=QGRpdUwhth/vk2kfzS4El5ylUD BkM9qk50FGJKptB4nhswOJaFrLDBMi9mG0s5ej6AgGVhkfhvVO0Fvkav9WvB1c0xezl7xAZmdWvXd c8R88e5DcqFIkvzSHbRCCZWxXjmLqT07FU5slIVOcC341Bx292RRrXd6XL7mWYu7sauFZi/WzIDNh YaTbsADUP9MuAKWNuU8N1jckWml7VqzWECPW4c2qskYhgiqPZ7yFpVAvrohjQ3kMkUs0DfcnedVr2 dBXGC9CVs46HsbPXb4kFggl9ycKDGEWTqbo8AMmgxA+tRJuaUt+//27YAYIxOh5IkognmSvm/Ekcd 630iIJ1A==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1k96Qt-0002hM-TT; Fri, 21 Aug 2020 12:46:12 +0000 From: "Matthew Wilcox (Oracle)" To: Yu Kuai , hch@infradead.org, darrick.wong@oracle.com, david@fromorbit.com, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, yi.zhang@huawei.com Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 1/3] iomap: Use kzalloc to allocate iomap_page Date: Fri, 21 Aug 2020 13:46:04 +0100 Message-Id: <20200821124606.10165-1-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200821124424.GQ17456@casper.infradead.org> References: <20200821124424.GQ17456@casper.infradead.org> MIME-Version: 1.0 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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 --- 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 13d5cdab8dcd..639d54a4177e 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_blocks_per_page(inode, page) <= 1) 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; }