From patchwork Mon Dec 16 16:26:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 13910028 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A874DE77180 for ; Mon, 16 Dec 2024 16:27:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B1678D0007; Mon, 16 Dec 2024 11:27:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 038118D0006; Mon, 16 Dec 2024 11:27:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD0C98D0007; Mon, 16 Dec 2024 11:27:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B71288D0006 for ; Mon, 16 Dec 2024 11:27:10 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 60DB843422 for ; Mon, 16 Dec 2024 16:27:10 +0000 (UTC) X-FDA: 82901350896.30.2285F98 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf15.hostedemail.com (Postfix) with ESMTP id C72ECA0029 for ; Mon, 16 Dec 2024 16:26:27 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=cSLKXi1s; dmarc=none; spf=none (imf15.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734366414; a=rsa-sha256; cv=none; b=Dw9d+X/CMfC+BtNS4B5Lrz8nqF9F2X1cfjPEneqiCqBvLgpF0uUORToQMks6aVXLPvZtYU q0A0qHXDB1Ib9CvzO9y4Qfhn5I+APV7g0DXLipwxCv0cid9Qwc0FZbmPvqEE4QPz1T8i6k Nzun1NEwOVsyF/PDA0Q3KfmjDagLliE= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=cSLKXi1s; dmarc=none; spf=none (imf15.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734366414; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=eJNIAPCs4sCCfLCR9H+1hO5eJPipcnwMIjpH52PWdqw=; b=2CCLUUfp43jYHr9i52ecVu5S28+2gE5o9/GVA+PQGuhGif6N6m+CInV+5Fy30uy35nxim9 4cNTp+jmYszLeNIF/I6rtD3Lc5moM2JV7m3s77Xf0EBeKRy+QT3bUTKWgt+d2kBUBoE1oA +V51ZvWtIbkkdFxZdc2Nh1i1+ne6n3w= 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=eJNIAPCs4sCCfLCR9H+1hO5eJPipcnwMIjpH52PWdqw=; b=cSLKXi1s8DTi76DX8gfpVDVSTG AzIw47Kh5ZgM9gEFS8i5m8QBRVW/wnLhZhvzeEpIdleQHB8vxJTFk14KyTREU4j8QLFfyPWwCjSZ/ 7obrL9TFnSR2SgJoVBpV4EPUo6jRY6YG3ykDvlCt10aC5Lk7q30HRYYrAyAMCKREdNOhiAwAD2jh2 dm80yONFjz+H564LYoouh/Dcjjr2zo8YbIURUTgVBgs8Sgv/EknPtbrb3XclpnEr87p6gQT1wnH+P cBGPvSUekJx51BONpHZu2vZ+u/vSoHN59DYLjHGqVXHogVKQ16UsPY7iI4xhOi1ayfsQRIfWZGrvt FS6qwIzQ==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tNDw0-00000000Ez6-1WMW; Mon, 16 Dec 2024 16:27:04 +0000 From: "Matthew Wilcox (Oracle)" To: Phillip Lougher Cc: "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 3/5] squashfs: Convert squashfs_readpage_block() to take a folio Date: Mon, 16 Dec 2024 16:26:57 +0000 Message-ID: <20241216162701.57549-3-willy@infradead.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241216162701.57549-1-willy@infradead.org> References: <20241216162701.57549-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: C72ECA0029 X-Stat-Signature: 987kge6sgixeadniae1ye8yr6iqaum5y X-HE-Tag: 1734366387-669240 X-HE-Meta: U2FsdGVkX1/vAmZ24vbogYTfm2WxCFrYoqPuXcc+S0fn5+pkK6Hon5SQmTU0rccKiJLXZoc16ImGY/JGKgJ5txIVe/Zou/Kk6KIhwkNrfxdLNEJsDD8ubSVSS/HV10xakIgRVB7o3ga1S8OPc25OD8E8pXIBSl9XT2IyZ7asbj6I98U8NUWOkIKlpjrf6Yy4isKzfWC2r2pyAyyKG2bFP6kKp7ltKz3t9rzAtjf/gmMrErJt+aBXSI6tkbqExoSi3ehttai6MxPMykmwRQwH9DWP3r5ovYNNTNNhGG2cjDbE18rrINDNlBM+CWm6sn5FG2E85O47dBQKDzbf4r+lXMc567L67yOncVNmJvUGHPLkpQKgtP2SDPPnIkm2ct/DDQ/IUQULwLnoD2m9addDD6QFsHmlRAoIqe/whTU1lPGo2HSha0DURoAgSFyx4rqrupOPmhLIMIFk7PUiSsjapLRcu1RPv3i6PLD0gFEEJCgxoMIm3wXbeoi94VfvH4JHHcV7MZnI7l802AiFRVRwWbVZaPl/BolqGUR6V6xeFWmeofg3WNM5Q50Cc02FtO9nCUF3KccL4PXlEde6VSjBgAGoCrp91VSpYvmhsmrh9H+799sfvG+0XsuPwyiXFobY8uytQ8ejxac+v6VcrXhcc6NVFIE9rov5VWOh9KXFHK97NoQ7Co8CKAN05zUlLU4jhrCl3mM9Zd7QnoJfya0hN6XyWbMvAgFpPM2f2eK4VJu513YyJoW3qzba649PI2p3227skhOXo4GRi78EJKxqaPGMsagm4M1zUCBaq2hMS8F5XC7OE+dqejIQ96p374IjxzgeQ947rqRxgbWe8FU/Xk0lelboDf52ZP/0CVU4inhOk+d9FqAOluDt6zxWS+hpRqMKGIFLMLEpDSP6XU0s4X1svOIlTsc4RAbGfiW82Wy4jyjyiGhvv4nr1F+AFTXwiFZIR3XKyhVSLoHYWhv J52M6tth /8gh4KzYlaE377yNdOSkvQBVATBy9fvqCuWmINyKiPZOE2XEkVknXqUpUe/Hn/8PwoJEbdhywaOu60M1dCcKbSeNgTzq6I2Ut6jjEns3YW6CYz9tdXNUKInk06RiNKJfXVA3+bf1uP2Xr9/oNZOZj9LUxyQHUSqcIXes3v27NAu3uzHoLyGE80Rqj5c2Evx76qsRNYWXTwYBEYQeZInNMNmBTMuD4nv4OGYiTDmkZMx8M/P1DU9jkgoouMJ8Y0ODRzXqCNnJHzfWzGkYJaQdM9KsmzPu6zvKaLTwZ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Remove a few accesses to page->mapping. Signed-off-by: Matthew Wilcox (Oracle) --- fs/squashfs/file.c | 2 +- fs/squashfs/file_cache.c | 6 +++--- fs/squashfs/file_direct.c | 11 +++++------ fs/squashfs/squashfs.h | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c index 6bd16e12493b..5b81e26b1226 100644 --- a/fs/squashfs/file.c +++ b/fs/squashfs/file.c @@ -472,7 +472,7 @@ static int squashfs_read_folio(struct file *file, struct folio *folio) if (res == 0) res = squashfs_readpage_sparse(&folio->page, expected); else - res = squashfs_readpage_block(&folio->page, block, res, expected); + res = squashfs_readpage_block(folio, block, res, expected); } else res = squashfs_readpage_fragment(folio, expected); diff --git a/fs/squashfs/file_cache.c b/fs/squashfs/file_cache.c index 54c17b7c85fd..0360d22a77d4 100644 --- a/fs/squashfs/file_cache.c +++ b/fs/squashfs/file_cache.c @@ -18,9 +18,9 @@ #include "squashfs.h" /* Read separately compressed datablock and memcopy into page cache */ -int squashfs_readpage_block(struct page *page, u64 block, int bsize, int expected) +int squashfs_readpage_block(struct folio *folio, u64 block, int bsize, int expected) { - struct inode *i = page->mapping->host; + struct inode *i = folio->mapping->host; struct squashfs_cache_entry *buffer = squashfs_get_datablock(i->i_sb, block, bsize); int res = buffer->error; @@ -29,7 +29,7 @@ int squashfs_readpage_block(struct page *page, u64 block, int bsize, int expecte ERROR("Unable to read page, block %llx, size %x\n", block, bsize); else - squashfs_copy_cache(page, buffer, expected, 0); + squashfs_copy_cache(&folio->page, buffer, expected, 0); squashfs_cache_put(buffer); return res; diff --git a/fs/squashfs/file_direct.c b/fs/squashfs/file_direct.c index d19d4db74af8..2c3e809d6891 100644 --- a/fs/squashfs/file_direct.c +++ b/fs/squashfs/file_direct.c @@ -19,12 +19,11 @@ #include "page_actor.h" /* Read separately compressed datablock directly into page cache */ -int squashfs_readpage_block(struct page *target_page, u64 block, int bsize, - int expected) - +int squashfs_readpage_block(struct folio *folio, u64 block, int bsize, + int expected) { - struct folio *folio = page_folio(target_page); - struct inode *inode = target_page->mapping->host; + struct page *target_page = &folio->page; + struct inode *inode = folio->mapping->host; struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info; loff_t file_end = (i_size_read(inode) - 1) >> PAGE_SHIFT; int mask = (1 << (msblk->block_log - PAGE_SHIFT)) - 1; @@ -48,7 +47,7 @@ int squashfs_readpage_block(struct page *target_page, u64 block, int bsize, /* Try to grab all the pages covered by the Squashfs block */ for (i = 0, index = start_index; index <= end_index; index++) { page[i] = (index == folio->index) ? target_page : - grab_cache_page_nowait(target_page->mapping, index); + grab_cache_page_nowait(folio->mapping, index); if (page[i] == NULL) continue; diff --git a/fs/squashfs/squashfs.h b/fs/squashfs/squashfs.h index 5a756e6790b5..0f5373479516 100644 --- a/fs/squashfs/squashfs.h +++ b/fs/squashfs/squashfs.h @@ -72,7 +72,7 @@ void squashfs_copy_cache(struct page *, struct squashfs_cache_entry *, int, int); /* file_xxx.c */ -extern int squashfs_readpage_block(struct page *, u64, int, int); +int squashfs_readpage_block(struct folio *, u64 block, int bsize, int expected); /* id.c */ extern int squashfs_get_id(struct super_block *, unsigned int, unsigned int *);