From patchwork Thu Feb 1 22:45:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13541882 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B21445C06 for ; Thu, 1 Feb 2024 22:46:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827573; cv=none; b=rWegABiGtYdx7nYyk5TOoeqySTObU3h4KGfKiI+ILzwksnxQHcrFQWT+G2Dc1WEk9WVpBKo3V6Vz2jOkCqTHM4OTavHEYIFybfjz9gAFWnklt4mO6u3uzibd/0njZtcTp9g7SNikAiomNPYjXl2W0An6vzoPTSSpCNC+lFlLhz4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827573; c=relaxed/simple; bh=0pgZAWjuqFQyQjPX6F27SlJdStSQ28iBvPXL+HBVAnQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b2btL50HG1KAgcp1kQtK/Sj9ESG0S4dJ8Qubl/FhHRO0iFSlPnkeD15kVcqJWBxLjznATEattyYcrR6RgOPawOE2rmPHAwSGNkNkGR08sa9q+RwtrIEzCRirqhuuMGymXq36YXa95931004HPLawZ8+dW1eVnnJDvboohZrDkfg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=GzlACinS; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="GzlACinS" 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=tuAP8Pj11A6vSLLksQ3sdzEDeykXyvIK9phb2ySpPEM=; b=GzlACinSFCeCGzFag6Heiw3MTU Bw6zuKdIx7FQshrTq8nsfUA9nPCUXmIkBcgGTQH39UH8Iqq+HG2rglvmNTfcmShGyd/dHEhtqxIjp nBv2ECH2AfhURNHF2VOJ46iI8Ufz/CV1dN0V2uPyF06efE+6gi57Nk1rm9UicLybLHF0l+h24Scly KrR2GQd5QrIo2Vx9pLjYgc/QSp+1D1HR/gFa/H+JWZkBwAcueujMXz0VEpN+K37jNr40rq60VTg+y TVZ7yQIbf+GEeXIz0uwkl/PH4rcCc8TqcUuupiujfSDwe5Yt1PRKLCV5HJOjD952Rg1LXBj4SVEwn q9zZLIkg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVfot-0000000H17x-0L7o; Thu, 01 Feb 2024 22:46:07 +0000 From: "Matthew Wilcox (Oracle)" To: Dave Kleikamp Cc: "Matthew Wilcox (Oracle)" , jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: [PATCH 01/13] jfs: Convert metapage_read_folio to use folio APIs Date: Thu, 1 Feb 2024 22:45:50 +0000 Message-ID: <20240201224605.4055895-2-willy@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201224605.4055895-1-willy@infradead.org> References: <20240201224605.4055895-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use bio_add_folio_nofail() as we just allocated the bio and know it cannot fail. Other than that, this is a 1:1 conversion from page APIs to folio APIs. Signed-off-by: Matthew Wilcox (Oracle) --- fs/jfs/jfs_metapage.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 961569c11159..8266c43ec728 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c @@ -266,14 +266,14 @@ static void last_read_complete(struct page *page) static void metapage_read_end_io(struct bio *bio) { - struct page *page = bio->bi_private; + struct folio *folio = bio->bi_private; if (bio->bi_status) { printk(KERN_ERR "metapage_read_end_io: I/O error\n"); - SetPageError(page); + folio_set_error(folio); } - dec_io(page, last_read_complete); + dec_io(&folio->page, last_read_complete); bio_put(bio); } @@ -469,20 +469,18 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc) static int metapage_read_folio(struct file *fp, struct folio *folio) { - struct page *page = &folio->page; - struct inode *inode = page->mapping->host; + struct inode *inode = folio->mapping->host; struct bio *bio = NULL; int block_offset; - int blocks_per_page = i_blocks_per_page(inode, page); + int blocks_per_page = i_blocks_per_folio(inode, folio); sector_t page_start; /* address of page in fs blocks */ sector_t pblock; int xlen; unsigned int len; int offset; - BUG_ON(!PageLocked(page)); - page_start = (sector_t)page->index << - (PAGE_SHIFT - inode->i_blkbits); + BUG_ON(!folio_test_locked(folio)); + page_start = folio_pos(folio) >> inode->i_blkbits; block_offset = 0; while (block_offset < blocks_per_page) { @@ -490,9 +488,9 @@ static int metapage_read_folio(struct file *fp, struct folio *folio) pblock = metapage_get_blocks(inode, page_start + block_offset, &xlen); if (pblock) { - if (!PagePrivate(page)) - insert_metapage(page, NULL); - inc_io(page); + if (!folio->private) + insert_metapage(&folio->page, NULL); + inc_io(&folio->page); if (bio) submit_bio(bio); @@ -501,11 +499,10 @@ static int metapage_read_folio(struct file *fp, struct folio *folio) bio->bi_iter.bi_sector = pblock << (inode->i_blkbits - 9); bio->bi_end_io = metapage_read_end_io; - bio->bi_private = page; + bio->bi_private = folio; len = xlen << inode->i_blkbits; offset = block_offset << inode->i_blkbits; - if (bio_add_page(bio, page, len, offset) < len) - goto add_failed; + bio_add_folio_nofail(bio, folio, len, offset); block_offset += xlen; } else block_offset++; @@ -513,15 +510,9 @@ static int metapage_read_folio(struct file *fp, struct folio *folio) if (bio) submit_bio(bio); else - unlock_page(page); + folio_unlock(folio); return 0; - -add_failed: - printk(KERN_ERR "JFS: bio_add_page failed unexpectedly\n"); - bio_put(bio); - dec_io(page, last_read_complete); - return -EIO; } static bool metapage_release_folio(struct folio *folio, gfp_t gfp_mask) From patchwork Thu Feb 1 22:45:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13541875 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5638A45BED for ; Thu, 1 Feb 2024 22:46:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827572; cv=none; b=R4rc1pEjU3w0SRjtZYJLELxKRNehUwwF7owPEMXv1oH8EVxtx4YZwMn8XNHqbIhXv8XySSZoShzLIlFBYzKf2VAZzAHcoeCNFPMNIqmGZWfOY8NuBmBgZkg/NweLdwV/+5oCg+zaJKJ+NaKW3EGR+6dC28MvDZZru5kZX7kQOrA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827572; c=relaxed/simple; bh=rcIr+B8qxMx5VK8mCQlDbMP5/vYU2Si+NvCCLWlbMy8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CeYcZujegdAanaIqQblMv3ELepRfUJtWT7m1xlF6i12sk8L2/RYhFZKGF1tLtCpjWeIl5i7gtFZ7V83bheidnUgmvsp0d8sqnsbMnCz9YmO+Wc+E0rTScodAWFPWzkeUrAiHWPU6PWsoBMCbfZ8wWn8LvJv0KW3cNsvn97U5ICQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=I0KMcAuw; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="I0KMcAuw" 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=6SLAbvmsJojxx3vTYw3U/xZYbOr7sG7SZmWvTEYqw5I=; b=I0KMcAuw7Cb0GRzNwfTPSgu1EI yPKz7YDuHNv5W/N+WH1i6yh0DfvZ20yShoUfclzKT4j5GZ8fIavHxAxSTpwe4A7ycYoHTF4vqmAZn pRnO5VvL6AvXoX3LRQq8fMPbXA6tiWtFMpzI3ZW5Wno666ZLcgjXup8qcw6v7c8J/Wfg7zNrqyRY2 G7FukhoT3tcOyb6PuBijn9HSY+06CSknJoh2p3iyy/0qklenhsl1jOLNnlj0WZ2yNlGVCLZGePPMI 3beQBhzG61i2VY7YtS+ZQvQc2dn5Upp2wJRuJD5b/0nlIhg3Svhs76A844UD6ck36ohetlZJVNcLe S4Sl5dIA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVfot-0000000H17z-0hMY; Thu, 01 Feb 2024 22:46:07 +0000 From: "Matthew Wilcox (Oracle)" To: Dave Kleikamp Cc: "Matthew Wilcox (Oracle)" , jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: [PATCH 02/13] jfs: Convert metapage_writepage to metapage_write_folio Date: Thu, 1 Feb 2024 22:45:51 +0000 Message-ID: <20240201224605.4055895-3-willy@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201224605.4055895-1-willy@infradead.org> References: <20240201224605.4055895-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Implement writepages rather than writepage by using write_cache_pages() to call metapage_write_folio(). Use bio_add_folio_nofail() as we know we just allocated the bio. Replace the call to SetPageError (which is never checked) with a call to mapping_set_error (which ... might be checked somewhere?) Signed-off-by: Matthew Wilcox (Oracle) --- fs/jfs/jfs_metapage.c | 75 +++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 34 deletions(-) diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 8266c43ec728..beecc9ad656e 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c @@ -4,6 +4,7 @@ * Portions Copyright (C) Christoph Hellwig, 2001-2002 */ +#include #include #include #include @@ -321,23 +322,25 @@ static void last_write_complete(struct page *page) static void metapage_write_end_io(struct bio *bio) { - struct page *page = bio->bi_private; + struct folio *folio = bio->bi_private; - BUG_ON(!PagePrivate(page)); + BUG_ON(!folio->private); if (bio->bi_status) { + int err = blk_status_to_errno(bio->bi_status); printk(KERN_ERR "metapage_write_end_io: I/O error\n"); - SetPageError(page); + mapping_set_error(folio->mapping, err); } - dec_io(page, last_write_complete); + dec_io(&folio->page, last_write_complete); bio_put(bio); } -static int metapage_writepage(struct page *page, struct writeback_control *wbc) +static int metapage_write_folio(struct folio *folio, + struct writeback_control *wbc, void *unused) { struct bio *bio = NULL; int block_offset; /* block offset of mp within page */ - struct inode *inode = page->mapping->host; + struct inode *inode = folio->mapping->host; int blocks_per_mp = JFS_SBI(inode->i_sb)->nbperpage; int len; int xlen; @@ -353,14 +356,13 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc) int offset; int bad_blocks = 0; - page_start = (sector_t)page->index << - (PAGE_SHIFT - inode->i_blkbits); - BUG_ON(!PageLocked(page)); - BUG_ON(PageWriteback(page)); - set_page_writeback(page); + page_start = folio_pos(folio) >> inode->i_blkbits; + BUG_ON(!folio_test_locked(folio)); + BUG_ON(folio_test_writeback(folio)); + folio_start_writeback(folio); for (offset = 0; offset < PAGE_SIZE; offset += PSIZE) { - mp = page_to_mp(page, offset); + mp = page_to_mp(&folio->page, offset); if (!mp || !test_bit(META_dirty, &mp->flag)) continue; @@ -389,22 +391,20 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc) continue; } /* Not contiguous */ - if (bio_add_page(bio, page, bio_bytes, bio_offset) < - bio_bytes) - goto add_failed; + bio_add_folio_nofail(bio, folio, bio_bytes, bio_offset); /* * Increment counter before submitting i/o to keep * count from hitting zero before we're through */ - inc_io(page); + inc_io(&folio->page); if (!bio->bi_iter.bi_size) goto dump_bio; submit_bio(bio); nr_underway++; bio = NULL; } else - inc_io(page); - xlen = (PAGE_SIZE - offset) >> inode->i_blkbits; + inc_io(&folio->page); + xlen = (folio_size(folio) - offset) >> inode->i_blkbits; pblock = metapage_get_blocks(inode, lblock, &xlen); if (!pblock) { printk(KERN_ERR "JFS: metapage_get_blocks failed\n"); @@ -420,7 +420,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc) bio = bio_alloc(inode->i_sb->s_bdev, 1, REQ_OP_WRITE, GFP_NOFS); bio->bi_iter.bi_sector = pblock << (inode->i_blkbits - 9); bio->bi_end_io = metapage_write_end_io; - bio->bi_private = page; + bio->bi_private = folio; /* Don't call bio_add_page yet, we may add to this vec */ bio_offset = offset; @@ -430,8 +430,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc) next_block = lblock + len; } if (bio) { - if (bio_add_page(bio, page, bio_bytes, bio_offset) < bio_bytes) - goto add_failed; + bio_add_folio_nofail(bio, folio, bio_bytes, bio_offset); if (!bio->bi_iter.bi_size) goto dump_bio; @@ -439,34 +438,42 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc) nr_underway++; } if (redirty) - redirty_page_for_writepage(wbc, page); + folio_redirty_for_writepage(wbc, folio); - unlock_page(page); + folio_unlock(folio); if (bad_blocks) goto err_out; if (nr_underway == 0) - end_page_writeback(page); + folio_end_writeback(folio); return 0; -add_failed: - /* We should never reach here, since we're only adding one vec */ - printk(KERN_ERR "JFS: bio_add_page failed unexpectedly\n"); - goto skip; dump_bio: print_hex_dump(KERN_ERR, "JFS: dump of bio: ", DUMP_PREFIX_ADDRESS, 16, 4, bio, sizeof(*bio), 0); -skip: bio_put(bio); - unlock_page(page); - dec_io(page, last_write_complete); + folio_unlock(folio); + dec_io(&folio->page, last_write_complete); err_out: while (bad_blocks--) - dec_io(page, last_write_complete); + dec_io(&folio->page, last_write_complete); return -EIO; } +static int metapage_writepages(struct address_space *mapping, + struct writeback_control *wbc) +{ + struct blk_plug plug; + int err; + + blk_start_plug(&plug); + err = write_cache_pages(mapping, wbc, metapage_write_folio, NULL); + blk_finish_plug(&plug); + + return err; +} + static int metapage_read_folio(struct file *fp, struct folio *folio) { struct inode *inode = folio->mapping->host; @@ -556,7 +563,7 @@ static void metapage_invalidate_folio(struct folio *folio, size_t offset, const struct address_space_operations jfs_metapage_aops = { .read_folio = metapage_read_folio, - .writepage = metapage_writepage, + .writepages = metapage_writepages, .release_folio = metapage_release_folio, .invalidate_folio = metapage_invalidate_folio, .dirty_folio = filemap_dirty_folio, @@ -698,7 +705,7 @@ static int metapage_write_one(struct page *page) if (folio_clear_dirty_for_io(folio)) { folio_get(folio); - ret = metapage_writepage(page, &wbc); + ret = metapage_write_folio(folio, &wbc, NULL); if (ret == 0) folio_wait_writeback(folio); folio_put(folio); From patchwork Thu Feb 1 22:45:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13541872 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DE1645018 for ; Thu, 1 Feb 2024 22:46:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827571; cv=none; b=Ym0y4QS7YEF8yPBiQRvDKQf6SHTs7xxPqtoFSNcHS0O+agOBEjU9Z/42O2fVlurRSpbfYHcEZhFOn2JikuV/jPC35a9m2/ib0QMBTszVaOmGSAi2U797spbCIRx7xwL45rmkC5AqlP43QqEFV+8ZMKL4Q3NCwmYA3OMLmDq5a5c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827571; c=relaxed/simple; bh=4b3G/+T3wt+YVnTF1aSwniBeH1KOIEVwE1fET7SzUXI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cEnmH2jrRQWCYVzHyIvgs+bajzzvS/WtWoZiBE4+QXLxwa49sJKAV+Yg+NCFRKifY2XWECIXucsKaF0X8fSEYXojGRqpGBk4/NG9EjALJFwxZyCi/r3nPBs1E2UL+L80orKe51RfvdTrG7MQ46WX3isCgVpby7IJAkAvOsIWh2s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=QgrQ+9Ua; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="QgrQ+9Ua" 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=1hiBfCsxHjQnrQb499TeqPNt73gL1h2Ah7TqxU7+CxY=; b=QgrQ+9Ua/rVGJWmUFecax/c262 ZKtbBOnzKWcouuoFucyUucJfo5V56z3Y43FnHhVCoc5ryno/fTQ+JIIj76nJAcNRTSxlHC3PDR+gz GPkpwBtv+UTwBBIXmrXTB4aEp1pxdAQKp+BLNnSwBOyhU0FXion8MQ4CuDbLNefDvfqAU4fmpMdaT AY7vRX1LiUzpEaL248+e65+N/AELgnVct/SdIn6akFYrKXADP/iv32l+JwBa+rcKEXk+Bh3fUVg4V rqwgRDgmXjxxncF4a3M9HeQOAaYcmK+2XiDe3v007u0dxwTBkHl5FxiQrYbLpuaVLq9eb0bnjJeIf rHKJVQtg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVfot-0000000H187-1EK8; Thu, 01 Feb 2024 22:46:07 +0000 From: "Matthew Wilcox (Oracle)" To: Dave Kleikamp Cc: "Matthew Wilcox (Oracle)" , jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: [PATCH 03/13] jfs: Convert __get_metapage to use a folio Date: Thu, 1 Feb 2024 22:45:52 +0000 Message-ID: <20240201224605.4055895-4-willy@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201224605.4055895-1-willy@infradead.org> References: <20240201224605.4055895-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove four hidden calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/jfs/jfs_metapage.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index beecc9ad656e..4ef85e264f51 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c @@ -577,7 +577,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock, int l2bsize; struct address_space *mapping; struct metapage *mp = NULL; - struct page *page; + struct folio *folio; unsigned long page_index; unsigned long page_offset; @@ -608,22 +608,22 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock, } if (new && (PSIZE == PAGE_SIZE)) { - page = grab_cache_page(mapping, page_index); - if (!page) { - jfs_err("grab_cache_page failed!"); + folio = filemap_grab_folio(mapping, page_index); + if (IS_ERR(folio)) { + jfs_err("filemap_grab_folio failed!"); return NULL; } - SetPageUptodate(page); + folio_mark_uptodate(folio); } else { - page = read_mapping_page(mapping, page_index, NULL); - if (IS_ERR(page)) { + folio = read_mapping_folio(mapping, page_index, NULL); + if (IS_ERR(folio)) { jfs_err("read_mapping_page failed!"); return NULL; } - lock_page(page); + folio_lock(folio); } - mp = page_to_mp(page, page_offset); + mp = page_to_mp(&folio->page, page_offset); if (mp) { if (mp->logical_size != size) { jfs_error(inode->i_sb, @@ -649,16 +649,16 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock, mp = alloc_metapage(GFP_NOFS); if (!mp) goto unlock; - mp->page = page; + mp->page = &folio->page; mp->sb = inode->i_sb; mp->flag = 0; mp->xflag = COMMIT_PAGE; mp->count = 1; mp->nohomeok = 0; mp->logical_size = size; - mp->data = page_address(page) + page_offset; + mp->data = folio_address(folio) + page_offset; mp->index = lblock; - if (unlikely(insert_metapage(page, mp))) { + if (unlikely(insert_metapage(&folio->page, mp))) { free_metapage(mp); goto unlock; } @@ -670,12 +670,12 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock, memset(mp->data, 0, PSIZE); } - unlock_page(page); + folio_unlock(folio); jfs_info("__get_metapage: returning = 0x%p data = 0x%p", mp, mp->data); return mp; unlock: - unlock_page(page); + folio_unlock(folio); return NULL; } From patchwork Thu Feb 1 22:45:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13541873 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7917346435 for ; Thu, 1 Feb 2024 22:46:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827571; cv=none; b=SvgppewZtSJck/9xDptqMlQB32WQ+mK9GWzSjsRhe3dcogxBvtMTIRS23+WjJkpYjEBl3/pi3c/4ubSWWw1tIxPovIX/4ujuzqeTUha7DJEeirbIKuzLZXzIpQykppCROCbvjRU/lVBD7YKOBtQhh9mmO2ngUrcNAJrRreQClIM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827571; c=relaxed/simple; bh=9UfGXYFJaXiX/QPVwGbZJBnefvErg/xze3xXY2rgbts=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a/Nhi2z65+puAIYY1ZdoDyPICSqI050C/KthQKD9+WmHNzi9XCvAGLFE5SBfHDjjtfKq/QxeCX9K9gZy3Zc6JeIAmANHKYZ8OEXqadbe7XVWqXduYZmrEliv8sfXRIC1Xi/O+eR6/QR2psifMzVbPuyrWxbwvJUyyuxD8HdlNZo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=V7kqggJW; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="V7kqggJW" 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=0PCgY0pKLRJKEtVUcAJOm71vipyZh1XinEayZbDdllk=; b=V7kqggJWTFobmagcdS+o+4XOKy t+Jaj1dMmUDxBHQJjWW6icjRRreB/Mw81Na/4njTF+pItVYvn04w817e4CyKKzVLU7tvvFJCs0vWo a5hZ4CVsT7szRfZMKDMWJq+/6tv+auUlQx+Sek3L1lDy//bt59b2CHBurLlVODSLzUtb9YpvgsaVn xC3UOHdvselrCjxm5yNOgtem/kQkcCTBEcVofTq295SjsfaZUAeL2Gix7fm12Bkn6U03uWiPGfp6q 5lKyt7VuTdZAXJwHDseLApqiWTMvYnTdsmf8TlXOVmaajJ+m7RefDgMMPckgIAc4Kj7ZcJzUxPp83 nwczSmJw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVfot-0000000H18E-1lCB; Thu, 01 Feb 2024 22:46:07 +0000 From: "Matthew Wilcox (Oracle)" To: Dave Kleikamp Cc: "Matthew Wilcox (Oracle)" , jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: [PATCH 04/13] jfs: Convert insert_metapage() to take a folio Date: Thu, 1 Feb 2024 22:45:53 +0000 Message-ID: <20240201224605.4055895-5-willy@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201224605.4055895-1-willy@infradead.org> References: <20240201224605.4055895-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Both of its callers now have a folio, so convert this function. Use folio_attach_private() instead of manually setting folio->private. This also gets the expected refcount of the folio correct. Signed-off-by: Matthew Wilcox (Oracle) --- fs/jfs/jfs_metapage.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 4ef85e264f51..6fa7023f5bc9 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c @@ -87,25 +87,23 @@ static inline struct metapage *page_to_mp(struct page *page, int offset) return mp_anchor(page)->mp[offset >> L2PSIZE]; } -static inline int insert_metapage(struct page *page, struct metapage *mp) +static inline int insert_metapage(struct folio *folio, struct metapage *mp) { struct meta_anchor *a; int index; int l2mp_blocks; /* log2 blocks per metapage */ - if (PagePrivate(page)) - a = mp_anchor(page); - else { + a = folio->private; + if (!a) { a = kzalloc(sizeof(struct meta_anchor), GFP_NOFS); if (!a) return -ENOMEM; - set_page_private(page, (unsigned long)a); - SetPagePrivate(page); - kmap(page); + folio_attach_private(folio, a); + kmap(&folio->page); } if (mp) { - l2mp_blocks = L2PSIZE - page->mapping->host->i_blkbits; + l2mp_blocks = L2PSIZE - folio->mapping->host->i_blkbits; index = (mp->index >> l2mp_blocks) & (MPS_PER_PAGE - 1); a->mp_count++; a->mp[index] = mp; @@ -127,8 +125,7 @@ static inline void remove_metapage(struct page *page, struct metapage *mp) a->mp[index] = NULL; if (--a->mp_count == 0) { kfree(a); - set_page_private(page, 0); - ClearPagePrivate(page); + detach_page_private(page); kunmap(page); } } @@ -150,20 +147,18 @@ static inline struct metapage *page_to_mp(struct page *page, int offset) return PagePrivate(page) ? (struct metapage *)page_private(page) : NULL; } -static inline int insert_metapage(struct page *page, struct metapage *mp) +static inline int insert_metapage(struct folio *folio, struct metapage *mp) { if (mp) { - set_page_private(page, (unsigned long)mp); - SetPagePrivate(page); - kmap(page); + folio_attach_private(folio, mp); + kmap(&folio->page); } return 0; } static inline void remove_metapage(struct page *page, struct metapage *mp) { - set_page_private(page, 0); - ClearPagePrivate(page); + detach_page_private(page); kunmap(page); } @@ -496,7 +491,7 @@ static int metapage_read_folio(struct file *fp, struct folio *folio) &xlen); if (pblock) { if (!folio->private) - insert_metapage(&folio->page, NULL); + insert_metapage(folio, NULL); inc_io(&folio->page); if (bio) submit_bio(bio); @@ -658,7 +653,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock, mp->logical_size = size; mp->data = folio_address(folio) + page_offset; mp->index = lblock; - if (unlikely(insert_metapage(&folio->page, mp))) { + if (unlikely(insert_metapage(folio, mp))) { free_metapage(mp); goto unlock; } From patchwork Thu Feb 1 22:45:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13541874 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 803D846439 for ; Thu, 1 Feb 2024 22:46:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827571; cv=none; b=n0cfgUkwoAmtfk+TGnGBEtPr2kOloiSDvuY90jRpA3vJowFPhCC/AUwDpKJSY4uxwuIiBVO73GZP0p4K/ii8ap99LiDdn+i1C3LwN9trFpg2RZnEEeUFh1JK2IIdGM22LXkyOp4km6jn/NOC06ICh7fUKDlIQ0Bg1VuHKkoamMQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827571; c=relaxed/simple; bh=KnJJCpTcdUhV3W47B8I2pmRC5IRBCRmUcD0PS4pSasY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mVObidYaR7awPDAHnIhnmQuYJtHYvBZFwLhTtUwcCCtMsd4Dr0U2yXF2fw1M1K44k5sctmgPhRQyLqdCmu0E1cGGkGQP1JC7o6nZkeG0E16reD5wXjhui1ljHqiOC1eaV7diRHjxw1utxdmzuzA8sXiuvjqqPbevg/+DHU+MSSE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=BNo3y0s8; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="BNo3y0s8" 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=D9EBnQ6ShJLhbDLeJCMWhwk0es97hySDrklC2B03Dko=; b=BNo3y0s812ggs9a+/zqw96bcKO qcO8ok3ZvxEu5/6tZ4ajf5XB9SA/BDPF6qtgOyAtDX42jYBMSQHQYBSqGTZimg6CyvCRHbFQ8uRos FcEkIU7FcDBRVGBw9qBdayGgWTW7VUupim93zEHvoiRu2a24TWYJcXBRgsC32qVnOAMMGsYSwrks9 dwciRqnj26MyZaX+hTEN3R+CgU2wLNerLRg7XRN+e1Uf/qK8N76aRcoa5Swh1QzDQf55yttYY9gRs Jf/0JXj0c5LEikKnfYA+QQ9+xBEKcBp2N/9ae8CI7eb95W3BKBnGM6pJCOZ/2DFYy+a7vNb66S1Zj a3tu8ESg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVfot-0000000H18L-2BVO; Thu, 01 Feb 2024 22:46:07 +0000 From: "Matthew Wilcox (Oracle)" To: Dave Kleikamp Cc: "Matthew Wilcox (Oracle)" , jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: [PATCH 05/13] jfs; Convert release_metapage to use a folio Date: Thu, 1 Feb 2024 22:45:54 +0000 Message-ID: <20240201224605.4055895-6-willy@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201224605.4055895-1-willy@infradead.org> References: <20240201224605.4055895-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Convert mp->page to a folio and remove 7 hidden calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/jfs/jfs_metapage.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 6fa7023f5bc9..4515dc1ac40e 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c @@ -749,37 +749,35 @@ void put_metapage(struct metapage *mp) void release_metapage(struct metapage * mp) { - struct page *page = mp->page; + struct folio *folio = page_folio(mp->page); jfs_info("release_metapage: mp = 0x%p, flag = 0x%lx", mp, mp->flag); - BUG_ON(!page); - - lock_page(page); + folio_lock(folio); unlock_metapage(mp); assert(mp->count); if (--mp->count || mp->nohomeok) { - unlock_page(page); - put_page(page); + folio_unlock(folio); + folio_put(folio); return; } if (test_bit(META_dirty, &mp->flag)) { - set_page_dirty(page); + folio_mark_dirty(folio); if (test_bit(META_sync, &mp->flag)) { clear_bit(META_sync, &mp->flag); - if (metapage_write_one(page)) + if (metapage_write_one(&folio->page)) jfs_error(mp->sb, "metapage_write_one() failed\n"); - lock_page(page); + folio_lock(folio); } } else if (mp->lsn) /* discard_metapage doesn't remove it */ remove_from_logsync(mp); /* Try to keep metapages from using up too much memory */ - drop_metapage(page, mp); + drop_metapage(&folio->page, mp); - unlock_page(page); - put_page(page); + folio_unlock(folio); + folio_put(folio); } void __invalidate_metapages(struct inode *ip, s64 addr, int len) From patchwork Thu Feb 1 22:45: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: 13541883 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 969D745BF8 for ; Thu, 1 Feb 2024 22:46:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827574; cv=none; b=YqeSLkmLCQfoWDjqSY5Dyvygn8nf7IHdZ9ru4WyWP9V/bB1+zaIGyeUr1/bMx82INbolhrDCgunmPKXCysWW4C5sNhZ4RjGTs/h1hpc+3KLmyF+8bApQWynT5DeTqtZ5wBWToMLvxleemMAGbK6FBAY/RthBvDXQ1gKms2RAiio= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827574; c=relaxed/simple; bh=TsPz2rBrbm7DLppgXoS0Fk86EHiRFuhHEKiyL4l81SE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hzZmpbZ1IfXoQ1a21Tfl9FtTAjl+11eFzPcWQQV8LfSFyz3h6tGiT4ZlI2wg8FQ8/xQQnnAZwPMrzVoS55ejJU7Oj2c/vyS/KkdR/8nWnCBonEIGiC4Zx9Pj6npU1wsdQOszDsUQUeB5lTyPp6+nvPgfvRtMW1/5id+fQGpzpfs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=rgaVwvnQ; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="rgaVwvnQ" 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=sE/YQ5G34kCC0ntB4hwruHztmMrVkvB6/wZslSYOwFA=; b=rgaVwvnQo8pRztT4oviAFnMDdq njyPDWS/GlDj8yL86ODrgSAmQsa2ZwNde3ebCd+1DIlHOA0oki22/vpQ86xeNz2h1lPB+gworl2km R9iF8maNxq8Fai60JKgByrekYgBcZWT1MM2VBC7z2WCV8vQLaNtH1gZT85P1mQvzO4ZSLxXxQ5Z8X WdZL7IfG41wHrFg7eva9sDgg/4hiK7VhnB2gku0OWX8HHc7pvE7DR4HM1CQ44PyNJ5SVgHsgfa3h6 8J+xJ+m/8c6SVTzFgV0e9MkmPc0m4PXRlkkYeDXPCs4dSIDhvP1ldE4kx58ViFi7EcrVVolQglWS5 2OeG68PQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVfot-0000000H18S-2dzi; Thu, 01 Feb 2024 22:46:07 +0000 From: "Matthew Wilcox (Oracle)" To: Dave Kleikamp Cc: "Matthew Wilcox (Oracle)" , jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: [PATCH 06/13] jfs: Convert drop_metapage and remove_metapage to take a folio Date: Thu, 1 Feb 2024 22:45:55 +0000 Message-ID: <20240201224605.4055895-7-willy@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201224605.4055895-1-willy@infradead.org> References: <20240201224605.4055895-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 All callers now have a folio, so pass it in instead of the page. Removes a couple of calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/jfs/jfs_metapage.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 4515dc1ac40e..56bd11f9ded5 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c @@ -112,10 +112,10 @@ static inline int insert_metapage(struct folio *folio, struct metapage *mp) return 0; } -static inline void remove_metapage(struct page *page, struct metapage *mp) +static inline void remove_metapage(struct folio *folio, struct metapage *mp) { - struct meta_anchor *a = mp_anchor(page); - int l2mp_blocks = L2PSIZE - page->mapping->host->i_blkbits; + struct meta_anchor *a = mp_anchor(&folio->page); + int l2mp_blocks = L2PSIZE - folio->mapping->host->i_blkbits; int index; index = (mp->index >> l2mp_blocks) & (MPS_PER_PAGE - 1); @@ -125,8 +125,8 @@ static inline void remove_metapage(struct page *page, struct metapage *mp) a->mp[index] = NULL; if (--a->mp_count == 0) { kfree(a); - detach_page_private(page); - kunmap(page); + folio_detach_private(&folio->page); + kunmap(&folio->page); } } @@ -156,10 +156,10 @@ static inline int insert_metapage(struct folio *folio, struct metapage *mp) return 0; } -static inline void remove_metapage(struct page *page, struct metapage *mp) +static inline void remove_metapage(struct folio *folio, struct metapage *mp) { - detach_page_private(page); - kunmap(page); + folio_detach_private(folio); + kunmap(&folio->page); } #define inc_io(page) do {} while(0) @@ -214,12 +214,12 @@ void metapage_exit(void) kmem_cache_destroy(metapage_cache); } -static inline void drop_metapage(struct page *page, struct metapage *mp) +static inline void drop_metapage(struct folio *folio, struct metapage *mp) { if (mp->count || mp->nohomeok || test_bit(META_dirty, &mp->flag) || test_bit(META_io, &mp->flag)) return; - remove_metapage(page, mp); + remove_metapage(folio, mp); INCREMENT(mpStat.pagefree); free_metapage(mp); } @@ -539,7 +539,7 @@ static bool metapage_release_folio(struct folio *folio, gfp_t gfp_mask) } if (mp->lsn) remove_from_logsync(mp); - remove_metapage(&folio->page, mp); + remove_metapage(folio, mp); INCREMENT(mpStat.pagefree); free_metapage(mp); } @@ -774,7 +774,7 @@ void release_metapage(struct metapage * mp) remove_from_logsync(mp); /* Try to keep metapages from using up too much memory */ - drop_metapage(&folio->page, mp); + drop_metapage(folio, mp); folio_unlock(folio); folio_put(folio); From patchwork Thu Feb 1 22:45:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13541880 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D4A746436 for ; Thu, 1 Feb 2024 22:46:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827573; cv=none; b=pZGjZWP8e0omO2mbBvcEWfuqAddzMSOeUjH9ydZgZa1EnjURT2fDOKOIEtH0CUq+AVZwlJMPZL6XMh/Fs8iOCFZAEBAG1LETr6ys1pn/1CSpl/CWITuAKxRBPuw/fHKqF834XcFWJyUH1XYMlrPkj9w3qb/Zm9hj4jwNA9RhtgU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827573; c=relaxed/simple; bh=R/j/mpy5FYdaCA6f5XT3xRhtd4gggV1Y5ODCj9J9xh0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZXZ/SQvCV1+rGjHgLFmCrpZfQU4wSNLVHmJhWqG861UxGoBLWzqTl34LWtRiadczbHDAEMctFzK/EH6heAxjfwwaiPF0LGej6vIPjpvX6IPViq2trEwb18sv/gXXuC7YTBzIVWBrSmyEpjYZv2/aM4aKN0foaWjwlNPH+sipc2o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=WInZvy/F; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="WInZvy/F" 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=4QSquTYLKHZMdgXIzTVuP0S/DNZqzdRCkwu58GLEUNk=; b=WInZvy/F19WIn97ASCVykcpWnn mjVvuK0kcL7GRkldeTFI94ooH0Ii+xvAkgkYFkUn2RMNtmxAqOBlLZDQ3x4tRqmtCOxb33ccEyaae Xpw9tL12OaTnKStVxtgDBPUnU2lVST1OEKAGUisMAFNpiCbPqD5lv6ICBjje5dlwYa1+QYPdnRaTQ ufh/5hqxIlCmp1BHPE6BFaf04Fb+ErpYU1m26VI/crO/xYYj6Cg8c3RYoEhyn85J2napRQETS4XyI 3OB1x+Mqn3ScyAhwvxveG0XQBJ2X1fN3bPGQTm3RqRDnQNRCdy2M+4prX9Q2ihD7K+0JiN/k2aSQq 6VQeJtcg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVfot-0000000H18Z-38fm; Thu, 01 Feb 2024 22:46:07 +0000 From: "Matthew Wilcox (Oracle)" To: Dave Kleikamp Cc: "Matthew Wilcox (Oracle)" , jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: [PATCH 07/13] jfs: Convert dec_io to take a folio Date: Thu, 1 Feb 2024 22:45:56 +0000 Message-ID: <20240201224605.4055895-8-willy@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201224605.4055895-1-willy@infradead.org> References: <20240201224605.4055895-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This means also converting the two handlers to take a folio. Saves four calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/jfs/jfs_metapage.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 56bd11f9ded5..552e6e97537c 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c @@ -135,10 +135,12 @@ static inline void inc_io(struct page *page) atomic_inc(&mp_anchor(page)->io_count); } -static inline void dec_io(struct page *page, void (*handler) (struct page *)) +static inline void dec_io(struct folio *folio, void (*handler) (struct folio *)) { - if (atomic_dec_and_test(&mp_anchor(page)->io_count)) - handler(page); + struct meta_anchor *anchor = folio->private; + + if (atomic_dec_and_test(&anchor->io_count)) + handler(folio); } #else @@ -163,7 +165,7 @@ static inline void remove_metapage(struct folio *folio, struct metapage *mp) } #define inc_io(page) do {} while(0) -#define dec_io(page, handler) handler(page) +#define dec_io(folio, handler) handler(folio) #endif @@ -253,11 +255,11 @@ static sector_t metapage_get_blocks(struct inode *inode, sector_t lblock, return lblock; } -static void last_read_complete(struct page *page) +static void last_read_complete(struct folio *folio) { - if (!PageError(page)) - SetPageUptodate(page); - unlock_page(page); + if (!folio_test_error(folio)) + folio_mark_uptodate(folio); + folio_unlock(folio); } static void metapage_read_end_io(struct bio *bio) @@ -269,7 +271,7 @@ static void metapage_read_end_io(struct bio *bio) folio_set_error(folio); } - dec_io(&folio->page, last_read_complete); + dec_io(folio, last_read_complete); bio_put(bio); } @@ -295,13 +297,13 @@ static void remove_from_logsync(struct metapage *mp) LOGSYNC_UNLOCK(log, flags); } -static void last_write_complete(struct page *page) +static void last_write_complete(struct folio *folio) { struct metapage *mp; unsigned int offset; for (offset = 0; offset < PAGE_SIZE; offset += PSIZE) { - mp = page_to_mp(page, offset); + mp = page_to_mp(&folio->page, offset); if (mp && test_bit(META_io, &mp->flag)) { if (mp->lsn) remove_from_logsync(mp); @@ -312,7 +314,7 @@ static void last_write_complete(struct page *page) * safe unless I have the page locked */ } - end_page_writeback(page); + folio_end_writeback(folio); } static void metapage_write_end_io(struct bio *bio) @@ -326,7 +328,7 @@ static void metapage_write_end_io(struct bio *bio) printk(KERN_ERR "metapage_write_end_io: I/O error\n"); mapping_set_error(folio->mapping, err); } - dec_io(&folio->page, last_write_complete); + dec_io(folio, last_write_complete); bio_put(bio); } @@ -449,10 +451,10 @@ static int metapage_write_folio(struct folio *folio, 4, bio, sizeof(*bio), 0); bio_put(bio); folio_unlock(folio); - dec_io(&folio->page, last_write_complete); + dec_io(folio, last_write_complete); err_out: while (bad_blocks--) - dec_io(&folio->page, last_write_complete); + dec_io(folio, last_write_complete); return -EIO; } From patchwork Thu Feb 1 22:45:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13541884 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65CFC405CF for ; Thu, 1 Feb 2024 22:46:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827574; cv=none; b=sr1BVI8Z07PeiBVDvCrZf05uduFG562dC7QGtVpe2IWHgg+FdoCCqR+D3otStJYCgDMfMR1YURSsMXQyKXJYC6vJa3Y/ZUbnM9C4aJArT7zOLEmvfPO7LeqfLxmwJFMYWEaLV91u5K8TXkJov+cQnW3IZZYtyZ6BgHsGNESixD4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827574; c=relaxed/simple; bh=e6P1wMHtswPqTsN1jezfotusjcw5ZXEf1LNdqHUQhM0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VnWCx2Bs2Ff/myjXTxO9GEKPD2J8iECpkcnvLUGxReoFigYGQdUhiUcnClFdqgqH0JCQy0Eok6oE2PA3i3DlRV7JIiSnUNOVp0U7xpTv4PvrtezMvFiGAUkQt8q2vBJweq7yCXMAGHcUyYhH9kC2Abgyb9IAVLu7QG1MSVCDucQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=qfnHg624; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="qfnHg624" 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=LToxImH7Ggtjf8LnUXIYlXIE9yIbwLP7ppNPw0lx91E=; b=qfnHg624No/qd5VmwS6PL8PMQs 0TwpPi/IAjClOPJSeqjHcwm3JKYrXfQO2suiDu/AEnAdeXNOonwTM7NMZtuuAVd1P6OBnGEvTSEJ/ myx1Z0plxW0QxVPVXYyyQzGGhc8LWfIINcKKqqe0wIA20UuuR1FHBp/cuQ4Iga18Ttcy+YECX7aHU zucWkEAYJ9E5NslQYYeOYRV/+K9gtYH8e1BLUC+9/KqMu2tE9iHvp0kBj5tQ0aN9xN9eoSu3NOKt1 3RpWGdk1PexYY6ONm3I9a65rrleLLFDAgzAijZcZH68J3EogBktep4t5T+IoExuDyxpWozRHbNwn7 k05HmS2w==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVfot-0000000H18g-3hdA; Thu, 01 Feb 2024 22:46:07 +0000 From: "Matthew Wilcox (Oracle)" To: Dave Kleikamp Cc: "Matthew Wilcox (Oracle)" , jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: [PATCH 08/13] jfs; Convert __invalidate_metapages to use a folio Date: Thu, 1 Feb 2024 22:45:57 +0000 Message-ID: <20240201224605.4055895-9-willy@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201224605.4055895-1-willy@infradead.org> References: <20240201224605.4055895-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Retrieve a folio from the page cache instead of a page. Saves a couple of calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/jfs/jfs_metapage.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 552e6e97537c..2eb9db0184c1 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c @@ -791,7 +791,6 @@ void __invalidate_metapages(struct inode *ip, s64 addr, int len) struct address_space *mapping = JFS_SBI(ip->i_sb)->direct_inode->i_mapping; struct metapage *mp; - struct page *page; unsigned int offset; /* @@ -800,11 +799,12 @@ void __invalidate_metapages(struct inode *ip, s64 addr, int len) */ for (lblock = addr & ~(BlocksPerPage - 1); lblock < addr + len; lblock += BlocksPerPage) { - page = find_lock_page(mapping, lblock >> l2BlocksPerPage); - if (!page) + struct folio *folio = filemap_lock_folio(mapping, + lblock >> l2BlocksPerPage); + if (IS_ERR(folio)) continue; for (offset = 0; offset < PAGE_SIZE; offset += PSIZE) { - mp = page_to_mp(page, offset); + mp = page_to_mp(&folio->page, offset); if (!mp) continue; if (mp->index < addr) @@ -817,8 +817,8 @@ void __invalidate_metapages(struct inode *ip, s64 addr, int len) if (mp->lsn) remove_from_logsync(mp); } - unlock_page(page); - put_page(page); + folio_unlock(folio); + folio_put(folio); } } From patchwork Thu Feb 1 22:45:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13541881 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E29653EA78 for ; Thu, 1 Feb 2024 22:46:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827573; cv=none; b=AlKulZpuIBw00peMtJzTYt4MDIhWzRe+vCZ6ombhzHcJhSNFrTwwR5f9xVwL2hNzK/vtlVROL5TbHHp+BOdedj2jWDq9yZ4bBJpphIVfvnp2PMqn0fzLZ6CCFNhE0NEnGa3yBCY2crNioS9RVoHdBXa+XPJkCHMT15RZFNWl6OI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827573; c=relaxed/simple; bh=UfB2rawQ7HEUon+lcJIiNCRfQbmpfq4wBW48ha0bjbs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gjN4FVGXrJ5crTYzwb7oFvwAkyuDcam7Enw7+4In+HROMhM6Ac8PO1SGqJLCLJIp2H/yo8SpF/ZuSxvC7a0kjKOuMZ7P4PeD5ieMjFJgpHGHPgTF6G4ZN9zTYrCYoVBvkwxsiLfpf8Ha68fbYOWgoe8kTHFxrioC6uUhZRFxAIA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=LuQf5K9s; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="LuQf5K9s" 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=+rP5ICDvTbI5VMpwtdpo9Ahba8V0v3bnPU9bI2PfmdQ=; b=LuQf5K9sX8Wddic2BnkR8LyutS QMn3xXje4s4ytgkA3VZR0S+IKrEg6lT+uO4AJL4vt5n+r8gAopg1zh8iAHnPljjjFdCl7HrMYjNDr sTMf8EGriFTi8RvvdH7wRixB8xGZVM6QQK7hibunj/O8tDm/okVMZXgjTlLduRO5/fHO83bJKQd0d uU6oEGiMPiuQhPmsJKLFjGsBpiar0YsHYliSkUJGe5BC3N8xGVLsFi7F8uvrC8du8MAhOP9NfPgUn NRynQRPykut9sQReT5HQd6zCBNQdPN0SiqP8h2lz6ureumaR9bcPKESJwoNMiLswQJrTTohkU7wqx sM7hf1+Q==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVfou-0000000H18n-00M3; Thu, 01 Feb 2024 22:46:08 +0000 From: "Matthew Wilcox (Oracle)" To: Dave Kleikamp Cc: "Matthew Wilcox (Oracle)" , jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: [PATCH 09/13] jfs: Convert page_to_mp to folio_to_mp Date: Thu, 1 Feb 2024 22:45:58 +0000 Message-ID: <20240201224605.4055895-10-willy@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201224605.4055895-1-willy@infradead.org> References: <20240201224605.4055895-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Access folio->private directly instead of testing the page private flag. Signed-off-by: Matthew Wilcox (Oracle) --- fs/jfs/jfs_metapage.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 2eb9db0184c1..59729b9dd76f 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c @@ -80,11 +80,13 @@ struct meta_anchor { }; #define mp_anchor(page) ((struct meta_anchor *)page_private(page)) -static inline struct metapage *page_to_mp(struct page *page, int offset) +static inline struct metapage *folio_to_mp(struct folio *folio, int offset) { - if (!PagePrivate(page)) + struct meta_anchor *anchor = folio->private; + + if (!anchor) return NULL; - return mp_anchor(page)->mp[offset >> L2PSIZE]; + return anchor->mp[offset >> L2PSIZE]; } static inline int insert_metapage(struct folio *folio, struct metapage *mp) @@ -144,9 +146,9 @@ static inline void dec_io(struct folio *folio, void (*handler) (struct folio *)) } #else -static inline struct metapage *page_to_mp(struct page *page, int offset) +static inline struct metapage *folio_to_mp(struct folio *folio, int offset) { - return PagePrivate(page) ? (struct metapage *)page_private(page) : NULL; + return folio->private; } static inline int insert_metapage(struct folio *folio, struct metapage *mp) @@ -303,7 +305,7 @@ static void last_write_complete(struct folio *folio) unsigned int offset; for (offset = 0; offset < PAGE_SIZE; offset += PSIZE) { - mp = page_to_mp(&folio->page, offset); + mp = folio_to_mp(folio, offset); if (mp && test_bit(META_io, &mp->flag)) { if (mp->lsn) remove_from_logsync(mp); @@ -359,7 +361,7 @@ static int metapage_write_folio(struct folio *folio, folio_start_writeback(folio); for (offset = 0; offset < PAGE_SIZE; offset += PSIZE) { - mp = page_to_mp(&folio->page, offset); + mp = folio_to_mp(folio, offset); if (!mp || !test_bit(META_dirty, &mp->flag)) continue; @@ -526,7 +528,7 @@ static bool metapage_release_folio(struct folio *folio, gfp_t gfp_mask) int offset; for (offset = 0; offset < PAGE_SIZE; offset += PSIZE) { - mp = page_to_mp(&folio->page, offset); + mp = folio_to_mp(folio, offset); if (!mp) continue; @@ -620,7 +622,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock, folio_lock(folio); } - mp = page_to_mp(&folio->page, page_offset); + mp = folio_to_mp(folio, page_offset); if (mp) { if (mp->logical_size != size) { jfs_error(inode->i_sb, @@ -804,7 +806,7 @@ void __invalidate_metapages(struct inode *ip, s64 addr, int len) if (IS_ERR(folio)) continue; for (offset = 0; offset < PAGE_SIZE; offset += PSIZE) { - mp = page_to_mp(&folio->page, offset); + mp = folio_to_mp(folio, offset); if (!mp) continue; if (mp->index < addr) From patchwork Thu Feb 1 22:45:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13541885 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 903804176C for ; Thu, 1 Feb 2024 22:46:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827575; cv=none; b=ekYVnt+u3fwtqKyS9TszMqky+xzrzZDwdVyCbczRGynP0lBTUJfFcf3V4E4AceXNN25sF0aA8fHO1aX1zdVB5kWxxaSY0MngLyHZRgXLQF4WNBoBZJH239XHDfVnXBweS4O21lqwhqi5+y/n9ybT/2oHw79jqXj4zRwaSZwNKHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827575; c=relaxed/simple; bh=+6CnVkVPs4+OQiStkQMP9qnRiIsj0LqX8bNkXkpK6pI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LGF2I1MwQZgbdRa1goCbyNUfcGmAcR7pgUETma52MjYk6P3JdqJJbF3Sd2RQxEg1q55gh+f3GXFNnpUp/phrC7J+UfIhO1MPRR520+FpRRQT5fOm4VKiLFto+d1qi1ttbWEWUKMafjGg+ta/L3CSbkXyvhl1lIBl5L1wTKQNUFA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=AuLYAqHH; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="AuLYAqHH" 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=OML5TsEvwXZSkzwoDqzVRJxgBN9HbIljp99tCJ6zNuY=; b=AuLYAqHHohrWlddGwzulHeIkod rsUSrMtsA05ay8ScxkHnSq6J3M0iZaVpsxLIFP3iPFmvyB0Eq/4z0rueqcT/UutG7pXgzLUokEnyG o8z0HvtALHO+pBLBIcurdJde0chmSYFjM8QGYhKltK7EV9lnxCA4T2fDBbSbj1ZR/nLwU1PwEmBRt kLy8g2htvrz0rZzkN4n4iMcvhbQiSS+XbVFhM6m/ADD7CNP5F5n9ZygupBkPSPO1Wohp758prmqa4 teULjD0tYghDzR5BtcJOlmdqlb/7Ty2HoGvn6QMatOkCY9SViqnLsiM69qqJAaxVp270AYdBztr8+ fmBIM3tA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVfou-0000000H18u-0XJQ; Thu, 01 Feb 2024 22:46:08 +0000 From: "Matthew Wilcox (Oracle)" To: Dave Kleikamp Cc: "Matthew Wilcox (Oracle)" , jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: [PATCH 10/13] jfs: Convert inc_io and mp_anchor to take a folio Date: Thu, 1 Feb 2024 22:45:59 +0000 Message-ID: <20240201224605.4055895-11-willy@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201224605.4055895-1-willy@infradead.org> References: <20240201224605.4055895-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 All their callers now have a folio, so pass it in. No savings here, just cleaning up some remnants. Signed-off-by: Matthew Wilcox (Oracle) --- fs/jfs/jfs_metapage.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 59729b9dd76f..bc62d4bb4712 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c @@ -78,7 +78,7 @@ struct meta_anchor { atomic_t io_count; struct metapage *mp[MPS_PER_PAGE]; }; -#define mp_anchor(page) ((struct meta_anchor *)page_private(page)) +#define mp_anchor(folio) (folio->private) static inline struct metapage *folio_to_mp(struct folio *folio, int offset) { @@ -116,7 +116,7 @@ static inline int insert_metapage(struct folio *folio, struct metapage *mp) static inline void remove_metapage(struct folio *folio, struct metapage *mp) { - struct meta_anchor *a = mp_anchor(&folio->page); + struct meta_anchor *a = mp_anchor(folio); int l2mp_blocks = L2PSIZE - folio->mapping->host->i_blkbits; int index; @@ -132,9 +132,9 @@ static inline void remove_metapage(struct folio *folio, struct metapage *mp) } } -static inline void inc_io(struct page *page) +static inline void inc_io(struct folio *folio) { - atomic_inc(&mp_anchor(page)->io_count); + atomic_inc(&mp_anchor(folio)->io_count); } static inline void dec_io(struct folio *folio, void (*handler) (struct folio *)) @@ -166,7 +166,7 @@ static inline void remove_metapage(struct folio *folio, struct metapage *mp) kunmap(&folio->page); } -#define inc_io(page) do {} while(0) +#define inc_io(folio) do {} while(0) #define dec_io(folio, handler) handler(folio) #endif @@ -395,14 +395,14 @@ static int metapage_write_folio(struct folio *folio, * Increment counter before submitting i/o to keep * count from hitting zero before we're through */ - inc_io(&folio->page); + inc_io(folio); if (!bio->bi_iter.bi_size) goto dump_bio; submit_bio(bio); nr_underway++; bio = NULL; } else - inc_io(&folio->page); + inc_io(folio); xlen = (folio_size(folio) - offset) >> inode->i_blkbits; pblock = metapage_get_blocks(inode, lblock, &xlen); if (!pblock) { @@ -496,7 +496,7 @@ static int metapage_read_folio(struct file *fp, struct folio *folio) if (pblock) { if (!folio->private) insert_metapage(folio, NULL); - inc_io(&folio->page); + inc_io(folio); if (bio) submit_bio(bio); From patchwork Thu Feb 1 22:46:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13541877 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01A0941236 for ; Thu, 1 Feb 2024 22:46:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827572; cv=none; b=ElQE4VTlpCBReOmGQYPbFK9jL0Sd/T9ck8eiy5OcrjnkaGAG162RItVm6+/+BxDNTWKJFCJW2U+e/jCFftBdVPp72kqJ5LK/z3I4KyO3VeyaFkNjy8LB82v2v+qN4xtWhpxc8KkBCJ7/f2YOufEkixTPsdi3JPPCci8A09IM0kg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827572; c=relaxed/simple; bh=JzGSwdb5fhgSdCrU9j5WulRWL7FiCQUVqemfXjOCT6Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z0iMmjX9/oQe3VCPXdJ2tVo1PNeHXReG5xQTyd2rd2Eg9ah/8F0CLJVNgHJFO0STMHvP/xdCdmAdif2r3fzvzaNZQK5Mpd42hsaUpWu7dMSwnctnnz5HGzZCuiS7OfMoL94rt6Zw/59PjohH4NsrmlyVzQ+jzhHHjph32oUjGVw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=T6Cz7rsx; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="T6Cz7rsx" 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=OTufa8taMJlZYmWBs6HvMsiwrkZelXub51uPI5R94M4=; b=T6Cz7rsxNF0Zrez6iJziDt4OwS SMMCR59woXJ6MGYGSYtJXYyixcQKIkeoDQPVS/H8ifPWmIc3zbks4jQpfiWk4UqpthLHS4L6ogKR0 jXj30yjrojdgX9u5pZi82+P1JyuaVavThYO6kCD6nV0K1EvIhjgAwL8nPdcCn7VYIJk6j7XdSk0qa sbnSaWSj9f7fgAxkHRYiBKyGeze/XG79dq8oKUklw0EcAEKs8k7erlOrX/ebMUTWF9Q3CSfINpVOq DtlcMduDp+Q4fgJ8qrjQws0CMV29ZxfEQPvpNLwb5h4eEGaryeVyQxjd9P9W11dxWvcTDIktl+eHL zUj9l9oA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVfou-0000000H191-12DU; Thu, 01 Feb 2024 22:46:08 +0000 From: "Matthew Wilcox (Oracle)" To: Dave Kleikamp Cc: "Matthew Wilcox (Oracle)" , jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: [PATCH 11/13] jfs: Convert force_metapage to use a folio Date: Thu, 1 Feb 2024 22:46:00 +0000 Message-ID: <20240201224605.4055895-12-willy@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201224605.4055895-1-willy@infradead.org> References: <20240201224605.4055895-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Convert the mp->page to a folio and operate on it. That lets us convert metapage_write_one() to take a folio. Replaces five calls to compound_head() with one. Signed-off-by: Matthew Wilcox (Oracle) --- fs/jfs/jfs_metapage.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index bc62d4bb4712..23e81d713c62 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c @@ -688,9 +688,8 @@ void grab_metapage(struct metapage * mp) unlock_page(mp->page); } -static int metapage_write_one(struct page *page) +static int metapage_write_one(struct folio *folio) { - struct folio *folio = page_folio(page); struct address_space *mapping = folio->mapping; struct writeback_control wbc = { .sync_mode = WB_SYNC_ALL, @@ -719,17 +718,17 @@ static int metapage_write_one(struct page *page) void force_metapage(struct metapage *mp) { - struct page *page = mp->page; + struct folio *folio = page_folio(mp->page); jfs_info("force_metapage: mp = 0x%p", mp); set_bit(META_forcewrite, &mp->flag); clear_bit(META_sync, &mp->flag); - get_page(page); - lock_page(page); - set_page_dirty(page); - if (metapage_write_one(page)) + folio_get(folio); + folio_lock(folio); + folio_mark_dirty(folio); + if (metapage_write_one(folio)) jfs_error(mp->sb, "metapage_write_one() failed\n"); clear_bit(META_forcewrite, &mp->flag); - put_page(page); + folio_put(folio); } void hold_metapage(struct metapage *mp) @@ -770,7 +769,7 @@ void release_metapage(struct metapage * mp) folio_mark_dirty(folio); if (test_bit(META_sync, &mp->flag)) { clear_bit(META_sync, &mp->flag); - if (metapage_write_one(&folio->page)) + if (metapage_write_one(folio)) jfs_error(mp->sb, "metapage_write_one() failed\n"); folio_lock(folio); } From patchwork Thu Feb 1 22:46:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13541876 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FAFD45BF3 for ; Thu, 1 Feb 2024 22:46:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827572; cv=none; b=mrn/GM9MlXDk0rS2iGdWuUVtZKMA0C1fPArRHmuSxqVvboqRjj+zt6B+wUwleBkfKsMl3hbHMlT3QIb2CSidd28d2YMmnBgnNnBMU3lLsx7ay/HD5Y2u/+6ocPBc6a9pFaX0S+wKsyAe/lJeQJXJnT4TTJhyL63a3TT4yow0jmU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827572; c=relaxed/simple; bh=cURxK2KUshULHqrONMckeuplfDrRc1Fmb34cL83urOA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GiJ8YfqgrszWThg9by9MrFXNLG1HyrPxghZB4RBE9sN89DJ8GbFhwswetLpp9Q33JhRMwIh8G9kYfxBgC3+rZ9E+OroLIASpG5fyLHR65FvAKskFrdYgckPMc3D4RMByDi5Vbj/1/fIcw8VC5aWHbA/ux3MpT/W6UUHl38jA0Yk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=bjawtGmG; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="bjawtGmG" 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=SEpa6480I+pdiTlB5C3vLDzZUjMsrv32xMAaAlalAus=; b=bjawtGmGb34tM5sVRDqHL+w8q4 TvczJWUJXrGM/KJMcNTq28RvhuxlhnSWTRSVIuxe7uu+/5PElWli9PuatNUxe6uYy5zqtUjyOfxJT PmXvc7a1w5pTg0ONF4f3V+eb+1yJjBX2Y/yNIAvbTaCUVe8+I6MFinY/u1UMt8nAvDInQl8GWj7O2 d+fsxzIhZFDpR3HQ8GwxB57J4rZshhgFZEWKi4I+BZhNgDPYOkLZx5vlyy3podanMjlEt3s+FVJqM 6UtjXXGkgMvSBIuuQKYFFbFBdpQK9ZVjPMZX4zGrckrX2C+u76LmtsiF1mcwPAnlabdoAu86fE4bR F8LQlgCg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVfou-0000000H198-1YSo; Thu, 01 Feb 2024 22:46:08 +0000 From: "Matthew Wilcox (Oracle)" To: Dave Kleikamp Cc: "Matthew Wilcox (Oracle)" , jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: [PATCH 12/13] jfs: Change metapage->page to metapage->folio Date: Thu, 1 Feb 2024 22:46:01 +0000 Message-ID: <20240201224605.4055895-13-willy@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201224605.4055895-1-willy@infradead.org> References: <20240201224605.4055895-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Convert all the users to operate on a folio. Saves sixteen calls to compound_head(). We still use sizeof(struct page) in print_hex_dump, otherwise it will go into the second and third pages of the folio which won't exist for jfs folios (since they are not large). This needs a better solution, but finding it can be postponed. Signed-off-by: Matthew Wilcox (Oracle) --- fs/jfs/jfs_logmgr.c | 2 +- fs/jfs/jfs_metapage.c | 26 +++++++++++++------------- fs/jfs/jfs_metapage.h | 16 ++++++++-------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index cb6d1fda66a7..985486aa7abf 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c @@ -1600,7 +1600,7 @@ void jfs_flush_journal(struct jfs_log *log, int wait) mp, sizeof(struct metapage), 0); print_hex_dump(KERN_ERR, "page: ", DUMP_PREFIX_ADDRESS, 16, - sizeof(long), mp->page, + sizeof(long), mp->folio, sizeof(struct page), 0); } else print_hex_dump(KERN_ERR, "tblock:", diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 23e81d713c62..d2578860b630 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c @@ -47,9 +47,9 @@ static inline void __lock_metapage(struct metapage *mp) do { set_current_state(TASK_UNINTERRUPTIBLE); if (metapage_locked(mp)) { - unlock_page(mp->page); + folio_unlock(mp->folio); io_schedule(); - lock_page(mp->page); + folio_lock(mp->folio); } } while (trylock_metapage(mp)); __set_current_state(TASK_RUNNING); @@ -57,7 +57,7 @@ static inline void __lock_metapage(struct metapage *mp) } /* - * Must have mp->page locked + * Must have mp->folio locked */ static inline void lock_metapage(struct metapage *mp) { @@ -648,7 +648,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock, mp = alloc_metapage(GFP_NOFS); if (!mp) goto unlock; - mp->page = &folio->page; + mp->folio = folio; mp->sb = inode->i_sb; mp->flag = 0; mp->xflag = COMMIT_PAGE; @@ -681,11 +681,11 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock, void grab_metapage(struct metapage * mp) { jfs_info("grab_metapage: mp = 0x%p", mp); - get_page(mp->page); - lock_page(mp->page); + folio_get(mp->folio); + folio_lock(mp->folio); mp->count++; lock_metapage(mp); - unlock_page(mp->page); + folio_unlock(mp->folio); } static int metapage_write_one(struct folio *folio) @@ -718,7 +718,7 @@ static int metapage_write_one(struct folio *folio) void force_metapage(struct metapage *mp) { - struct folio *folio = page_folio(mp->page); + struct folio *folio = mp->folio; jfs_info("force_metapage: mp = 0x%p", mp); set_bit(META_forcewrite, &mp->flag); clear_bit(META_sync, &mp->flag); @@ -733,26 +733,26 @@ void force_metapage(struct metapage *mp) void hold_metapage(struct metapage *mp) { - lock_page(mp->page); + folio_lock(mp->folio); } void put_metapage(struct metapage *mp) { if (mp->count || mp->nohomeok) { /* Someone else will release this */ - unlock_page(mp->page); + folio_unlock(mp->folio); return; } - get_page(mp->page); + folio_get(mp->folio); mp->count++; lock_metapage(mp); - unlock_page(mp->page); + folio_unlock(mp->folio); release_metapage(mp); } void release_metapage(struct metapage * mp) { - struct folio *folio = page_folio(mp->page); + struct folio *folio = mp->folio; jfs_info("release_metapage: mp = 0x%p, flag = 0x%lx", mp, mp->flag); folio_lock(folio); diff --git a/fs/jfs/jfs_metapage.h b/fs/jfs/jfs_metapage.h index 4179f9df4deb..2e5015c2705b 100644 --- a/fs/jfs/jfs_metapage.h +++ b/fs/jfs/jfs_metapage.h @@ -24,7 +24,7 @@ struct metapage { wait_queue_head_t wait; /* implementation */ - struct page *page; + struct folio *folio; struct super_block *sb; unsigned int logical_size; @@ -90,14 +90,14 @@ static inline void discard_metapage(struct metapage *mp) static inline void metapage_nohomeok(struct metapage *mp) { - struct page *page = mp->page; - lock_page(page); + struct folio *folio = mp->folio; + folio_lock(folio); if (!mp->nohomeok++) { mark_metapage_dirty(mp); - get_page(page); - wait_on_page_writeback(page); + folio_get(folio); + folio_wait_writeback(folio); } - unlock_page(page); + folio_unlock(folio); } /* @@ -107,7 +107,7 @@ static inline void metapage_nohomeok(struct metapage *mp) static inline void metapage_wait_for_io(struct metapage *mp) { if (test_bit(META_io, &mp->flag)) - wait_on_page_writeback(mp->page); + folio_wait_writeback(mp->folio); } /* @@ -116,7 +116,7 @@ static inline void metapage_wait_for_io(struct metapage *mp) static inline void _metapage_homeok(struct metapage *mp) { if (!--mp->nohomeok) - put_page(mp->page); + folio_put(mp->folio); } static inline void metapage_homeok(struct metapage *mp) From patchwork Thu Feb 1 22:46:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13541878 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7434545C14 for ; Thu, 1 Feb 2024 22:46:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827572; cv=none; b=iNHhjrmJEa3UV7QCB/RE0gsPkrGV1K4cxS46Kk4RXV+xVGa6noISlZ7dgDA9hY9HANahG3uRriMJ3oJgTYQkLQmgs/zgTGjtTRgQeLLJpBMkfnE8Uy2HgkbdCrCn8stfwykGZTynBsWq3WaUgpGrp/ICie9nO22ZksuY2N4OQuE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706827572; c=relaxed/simple; bh=OVPeEFLCpx6xGvib1I1i/DO171ij4Lze5tqqB1wGrjg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Zw4a72/sLCP72HU6CtwJGzP1QLSPI6qh/mBBFyI5Nk2UuXPB1cJY9ZVvc3ynHKVUS9nNQzQOWGeWQDu2HmrWniImwcMeOqz6ksgTJPIQgTT0VkJcvGEVf1EdtC/P6MdEFbfVTjWIeqtU3Mx4ta7UAPF+oXiJyliIJ13bbTxxSzI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=vS/jQ5T+; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="vS/jQ5T+" 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=W4VqD8jq2dSVicm/surzXwnOz2JGwjwbYjUpLghwCiE=; b=vS/jQ5T+YNnpZm+KPgzE7k0M4g 8A2BoR3mAssqfH3JJ9AmKaIB2RCq1D7A3KNc18V1MVoiJXElM1VNAoKXC3MdHnj9MdovbPfo8D8Lf 9PjiLFWeW9qD/1cbovDMK2U/qvB7lD35tLajc7MM77eZ9jejcrrpw8PnqPzZjI6AGngDKiPLTps9e D45+VcLZjWJ+OlML3z3RcAwJ4mY03UnEytHfpE8kX4vT7/L9lsgLSN44OFKBxpXe/vHUkX6PL6m/p 2iVFOJpiF+mb35oPYOkWASi+5ARulQ4VWFgy68DahpCJZY9+EcP/sKc38vszWgVGzDT8kck8xU78k R7f5UwcQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVfou-0000000H19F-20f0; Thu, 01 Feb 2024 22:46:08 +0000 From: "Matthew Wilcox (Oracle)" To: Dave Kleikamp Cc: "Matthew Wilcox (Oracle)" , jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: [PATCH 13/13] fs: Remove i_blocks_per_page Date: Thu, 1 Feb 2024 22:46:02 +0000 Message-ID: <20240201224605.4055895-14-willy@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201224605.4055895-1-willy@infradead.org> References: <20240201224605.4055895-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The last caller has been converted to i_blocks_per_folio() so we can remove this wrapper. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 431b12a23299..66fb5924dc53 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -1556,10 +1556,4 @@ unsigned int i_blocks_per_folio(struct inode *inode, struct folio *folio) { return folio_size(folio) >> inode->i_blkbits; } - -static inline -unsigned int i_blocks_per_page(struct inode *inode, struct page *page) -{ - return i_blocks_per_folio(inode, page_folio(page)); -} #endif /* _LINUX_PAGEMAP_H */