From patchwork Mon Dec 16 16:26:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13910029 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 52DB5E7717F for ; Mon, 16 Dec 2024 16:27:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D35118D0008; Mon, 16 Dec 2024 11:27:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CC2068D0006; Mon, 16 Dec 2024 11:27:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B5CEC8D0008; Mon, 16 Dec 2024 11:27:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 96E4A8D0006 for ; Mon, 16 Dec 2024 11:27:13 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1190A1A11E6 for ; Mon, 16 Dec 2024 16:27:13 +0000 (UTC) X-FDA: 82901350980.23.B1CA753 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf15.hostedemail.com (Postfix) with ESMTP id 97CEEA000F for ; Mon, 16 Dec 2024 16:26:30 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Iae0Cxoi; 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=1734366418; 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:references:dkim-signature; bh=bu2kx5ccarvn3y99Em/U+b3Zlo5ch2td1EQGdKbcf9U=; b=nBSLyXIauT62L0HDeOVsbtDdNToZlXyFZw8FiWaMaMwOMkK++4kmWPz/OFVN5ZZo3vO4oc SQECnZByS/JFPbwTGHa1wJeODVNsLbd/KOkhrMDcw6lsDERh+VbC1n9bG9XAZrGEOqt2Hp S1OTDNjK2E9yC3vQwK+oD9fmAf5BEbA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734366418; a=rsa-sha256; cv=none; b=PwjqerduJJiPNHu07fAWtejCTdwDkCiOWx310g8zvYzLOzpKd9BbYMA8ZQYyj1PwbA+dru wIgplfaq6eL9x0NbMkZ0OYLYIbMDE5J5vT+mHFus2xr7R9MQhoRlUM9EtLHbIZZoqVi5JV iUAshJlZohH/oaU05DUcC07C5mlxxVY= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Iae0Cxoi; 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 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: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=bu2kx5ccarvn3y99Em/U+b3Zlo5ch2td1EQGdKbcf9U=; b=Iae0CxoiKWel5R+U7fAaIhy4Ax klvtGI5sKG/JH98UBdUH5ppXkVkaN7qU1fh1aTHFHnnv6pBSjGEL5MhpQdZiCIOlWZAPDOl1eQ+zo JVIYUbMNPox2hAORb2ZhVp+BwJcrVi8g0MD6w0jC/XoEBFo+lgZ90xVg2EItjjEYFm/3iObigGlPF 5DjLiAp+DL8VQd1kzIpAGVAHgJizLjkOYhaj3y0PBxclJpS8zGZKcEW/K1NjGOzV1uFjT/QlDe7Vb rH6+v5OCv73CBJ8VFVsUmvSN5yTx6lwpyrfjabFajsqhqQVNBjrQEJ+eoaBYrFQCYVfu42RJjEoPs MgxiYB3g==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tNDw0-00000000Eyx-0jWG; 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 1/5] squashfs: Use a folio throughout squashfs_read_folio() Date: Mon, 16 Dec 2024 16:26:55 +0000 Message-ID: <20241216162701.57549-1-willy@infradead.org> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 X-Stat-Signature: z9iz959dqhfstj3ynfukfnwgj6d5jo3r X-Rspamd-Queue-Id: 97CEEA000F X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1734366390-619226 X-HE-Meta: U2FsdGVkX18Yry+E810wmpcDRYz512hzfNpEKaHxsoI6YxdJA6nuVjSH1pRTNw0XjzQzQ5iCzhv6LZgWgmGHjxt/CtYzl6kh/XqpIj6vtSCrduyrNaKTFbzb7EU6AJWOMhn1OMduG+fLdMyug2i4GFKrBC6JPSF6sXNj54EKtra3XYFFHRTFZcM6uK24w9FnE6Z+aKzFY6S1IaY9PC4MGB9l26lHyDRcI/7hGLbWkIlY86hYhEbMDL2PZP1LYtQKxNeU4ddVU5yF77Ul31bYGRtgeiXhHAHXTmhvQSQEe6uPYoKdcWQhH7bnmj7ZsmfCyb1F8N8/U3yJPSqGfGu8lw+wLZ238AX+az9O6Oxp+C9D32KNcj6vzcibW4jhsXTF2i+WUJUOW3kgdwdhXNsKLy7ukFABRfNWzGhU0adm/f54QKMWuId1FpX008240UFRimwsZIoR/q3K9zZzcIS59CxrV2TzmPZ5GGKpfdw2VNVBLFT8rqVqxAdRd4gMSG+2qeH3f9F+E0zUX+f/JouYDxlasKQbFvRjUO/44bcPuVMiRVpfXB2aCcPdz4qFSgcMRV6/C02sGr4te/l69p10wxpjLfb2y6z7eiPI0Dmo1F3REK21/v+f2z67zyHoXRtc+gwIbla7IeecEOv9Ojb3c+DvwCXdYMtVqReHuPMBdCRCRzCZLCYC4lYHBYSEkiKHLcJTDyZtHXMx9aPxz2WKSw3iU9Wqksy0QOGOQnpQ3/B/GUIMTfQbBuklVBTBg+dmvUj+kY2dqggW4DwWRHIgXDcnHvKyHmgTN2oSZoTy+gZaZC1wWBEdJFdMTkOPZLnE90u6FpcBa6bHBgvDYfYBnd7BDnw5918MGqVR5Q2DNihI9LzgjC897bMGobD00fwAv1h4K+o1W0ek/HfEKqI3XAC560dEv+CUms1rlAE8cDb2NGyAEEKG0c3bJxwF+KsXXDB+BieA5fXe7V1pvZd +jktGrLR bIznHQX/E/cO2tWThqjm+k20WjNoW8eD7WhRo4guPjR9e5Yx2GS1DuTGmngeBeMPh8Z/nhFjJMIDQiuzz0esPpASvf/Ckps5OrJR/JC9IsdAWG5UwIwnituMlQOAF/j2x1Be/VVi5Fn8cQR0N1udv4gLOaiJPRQOgT0WF5sydXZHfXSJkp6D1q8Z1jxUuT2LZGZEcea6bQoYGJumd3yjuez5gwfe3hWp7V2XqAnvhRMo325aWtwKnO0sdchzKd8Mc/p3aSk4fP2It4TTbRuuTODAHeMwYNoNAyQ+I 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: Use modern folio APIs where they exist and convert back to struct page for the internal functions. Signed-off-by: Matthew Wilcox (Oracle) --- fs/squashfs/file.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c index 21aaa96856c1..bc6598c3a48f 100644 --- a/fs/squashfs/file.c +++ b/fs/squashfs/file.c @@ -445,21 +445,19 @@ static int squashfs_readpage_sparse(struct page *page, int expected) static int squashfs_read_folio(struct file *file, struct folio *folio) { - struct page *page = &folio->page; - struct inode *inode = page->mapping->host; + struct inode *inode = folio->mapping->host; struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info; - int index = page->index >> (msblk->block_log - PAGE_SHIFT); + int index = folio->index >> (msblk->block_log - PAGE_SHIFT); int file_end = i_size_read(inode) >> msblk->block_log; int expected = index == file_end ? (i_size_read(inode) & (msblk->block_size - 1)) : msblk->block_size; int res = 0; - void *pageaddr; TRACE("Entered squashfs_readpage, page index %lx, start block %llx\n", - page->index, squashfs_i(inode)->start); + folio->index, squashfs_i(inode)->start); - if (page->index >= ((i_size_read(inode) + PAGE_SIZE - 1) >> + if (folio->index >= ((i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT)) goto out; @@ -472,23 +470,18 @@ static int squashfs_read_folio(struct file *file, struct folio *folio) goto out; if (res == 0) - res = squashfs_readpage_sparse(page, expected); + res = squashfs_readpage_sparse(&folio->page, expected); else - res = squashfs_readpage_block(page, block, res, expected); + res = squashfs_readpage_block(&folio->page, block, res, expected); } else - res = squashfs_readpage_fragment(page, expected); + res = squashfs_readpage_fragment(&folio->page, expected); if (!res) return 0; out: - pageaddr = kmap_atomic(page); - memset(pageaddr, 0, PAGE_SIZE); - kunmap_atomic(pageaddr); - flush_dcache_page(page); - if (res == 0) - SetPageUptodate(page); - unlock_page(page); + folio_zero_segment(folio, 0, folio_size(folio)); + folio_end_read(folio, res == 0); return res; }