From patchwork Wed Oct 2 15:00:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13819893 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 96B151A08A4; Wed, 2 Oct 2024 15:00:45 +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=1727881247; cv=none; b=cJ3q0gloi9i9ANBGzGdK/dQ3V5ZQt3VQymbkZiHdmLZpMgGqWpdH9dFbT+sBByw48B2rY1/zV8WP5bRF3+dwzxE7fkxUlhTsWeEyq7e5cVr2Bgm1+oQATg6xxs5KO+xRuVxuasNRzIEcSmIoajaO7/G3SxXpHlXtqfoXaRMAnJw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727881247; c=relaxed/simple; bh=hViMZ2sOCvgX1ZFhQXfQUllNq8y39vqkYezX2a9Oj04=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WlG6L4L2wv1OGNua8yFAVBCEEAaERlAp5crGt6jNOqOHNakBwOi+Vo7/BHahQRQmK+7vSull7kd5wffhMXR91JRgEcMkJRCMnSgb0FaFNoV9SzaxI28SwCKcSLk2ioNpLpQo7ERkDbjRZEjVP7eCJd/pAwZsOXHcaaQdXCQAhn8= 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=dZ0BvvvZ; 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="dZ0BvvvZ" 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=G4PuZiCscMW/fPgL88BSGegvJtIPL6ozJhgLT9WDKbI=; b=dZ0BvvvZzFu/fWo6XdZOtkp/ue szguxemI+hkJJ8URxG5UJHQJEfFjHHtj7hVS7tBvSnrPIGNNZpqPZvWi3DWZH0Jq5zEGIv/NKyCXv REN1j8Q2dVcxkkFig32yjf5dQm/1qPKn5paGmeyM+RX5+ICl3QfmHqHBzhOfj8caMNxOMQApUB7Rs UHnlqyl/0CyRqxCAJo19NpQY1s23q7d7MouNepvmtKVShtdR35g5Ad3dSr0gtJWsUT6vyWEFHS2Ox VAJmNLaht6bLIjbcfdDQFeqQcfL5a4ef8DRbVbnSeSAO6mb6ZtGFpFIkvIc79BN1aPQ4TEaHHOFHy XxpDPPzQ==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1sw0qD-00000005cSi-1y6g; Wed, 02 Oct 2024 15:00:37 +0000 From: "Matthew Wilcox (Oracle)" To: Ryusuke Konishi Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, linux-nilfs@vger.kernel.org Subject: [PATCH 1/4] nilfs2: Remove nilfs_writepage Date: Wed, 2 Oct 2024 16:00:31 +0100 Message-ID: <20241002150036.1339475-2-willy@infradead.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241002150036.1339475-1-willy@infradead.org> References: <20241002150036.1339475-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Since nilfs2 has a ->writepages operation already, ->writepage is only called by the migration code. If we add a ->migrate_folio operation, it won't even be used for that and so it can be deleted. Signed-off-by: Matthew Wilcox (Oracle) --- fs/nilfs2/inode.c | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index be6acf6e2bfc..f1b47b655672 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c @@ -170,37 +170,6 @@ static int nilfs_writepages(struct address_space *mapping, return err; } -static int nilfs_writepage(struct page *page, struct writeback_control *wbc) -{ - struct folio *folio = page_folio(page); - struct inode *inode = folio->mapping->host; - int err; - - if (sb_rdonly(inode->i_sb)) { - /* - * It means that filesystem was remounted in read-only - * mode because of error or metadata corruption. But we - * have dirty pages that try to be flushed in background. - * So, here we simply discard this dirty page. - */ - nilfs_clear_folio_dirty(folio); - folio_unlock(folio); - return -EROFS; - } - - folio_redirty_for_writepage(wbc, folio); - folio_unlock(folio); - - if (wbc->sync_mode == WB_SYNC_ALL) { - err = nilfs_construct_segment(inode->i_sb); - if (unlikely(err)) - return err; - } else if (wbc->for_reclaim) - nilfs_flush_segment(inode->i_sb, inode->i_ino); - - return 0; -} - static bool nilfs_dirty_folio(struct address_space *mapping, struct folio *folio) { @@ -295,7 +264,6 @@ nilfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter) } const struct address_space_operations nilfs_aops = { - .writepage = nilfs_writepage, .read_folio = nilfs_read_folio, .writepages = nilfs_writepages, .dirty_folio = nilfs_dirty_folio, @@ -304,6 +272,7 @@ const struct address_space_operations nilfs_aops = { .write_end = nilfs_write_end, .invalidate_folio = block_invalidate_folio, .direct_IO = nilfs_direct_IO, + .migrate_folio = buffer_migrate_folio, .is_partially_uptodate = block_is_partially_uptodate, }; From patchwork Wed Oct 2 15:00:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13819896 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 045AD1D0DD0; Wed, 2 Oct 2024 15:00:50 +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=1727881255; cv=none; b=uzW3mK0eFMyjsp+wNYo4YsOU1MmH50wUSG91Xi3+ITQIwNx+V0PzUczKsw1mL8dbsqexm53SBY9yH4DNkQf4U3MqwrhYdIRt3ih3R644GcIX4mH8uFBw31FC124J4ySlZKBZtHwOKsWmyCscKkC10MgpBU2xrugbbJTEWrszhL8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727881255; c=relaxed/simple; bh=JAR2O8Nw6RSpnDpnDzCBuC+IA99gjgpHcrFqm+KZUpQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JReegRHRWUzbR5k7LO9SC7kL2FwTCTGoa/f8ZCepdiLQJHCVJWU2/3x/Ktjv0gFNFlmIDKhWVZGImMZSzxRzcmYxiFqOm6Jxb6ATmi6D2nNfU52mfuTI7iEo+pSajv/iYTs7dEs870/lp8CTEI/NY5ioM+0oezlAivacOQc0ZOQ= 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=ZbvmhtxO; 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="ZbvmhtxO" 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=tLi2ExInWqFu7Rxgxh74FAPUwKB/d58VQE943Or3afI=; b=ZbvmhtxOrswcow64rYE31AlHZW hMLLgntSPHGUy4ORZozihFa80cGIF0tCUub3j1xva0HgKj2xBzd7A/ppJahk0qzm4G1OLrcOkoE+/ lgWgoSMcNKHobixU4v+crUQagQk9klG8y0zltCZFcNg87BTQ7/IbWJOd/WG9ZhSlaXXmTOolBW9rO JubkkJ8unvOVN7ry+LzsqNsxDXOs604fdSOYt43G5zlmP3YYm/tHuv04ZQgE0G8RPy9CHpHgz/Ywu 99FVzJe1yNdjQZBl7JLcPcDrXvzlD4OETMJeAmw8coHB845pxEg2jDBub1/xrXN7/zO65DC8K6tt7 d0CqwBXQ==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1sw0qD-00000005cSk-2M2J; Wed, 02 Oct 2024 15:00:37 +0000 From: "Matthew Wilcox (Oracle)" To: Ryusuke Konishi Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, linux-nilfs@vger.kernel.org Subject: [PATCH 2/4] nilfs2: Convert nilfs_page_count_clean_buffers() to take a folio Date: Wed, 2 Oct 2024 16:00:32 +0100 Message-ID: <20241002150036.1339475-3-willy@infradead.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241002150036.1339475-1-willy@infradead.org> References: <20241002150036.1339475-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 callers have a folio, so pass it in and use it directly. Signed-off-by: Matthew Wilcox (Oracle) --- fs/nilfs2/dir.c | 2 +- fs/nilfs2/inode.c | 2 +- fs/nilfs2/page.c | 4 ++-- fs/nilfs2/page.h | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c index fe5b1a30c509..b1ad4062bbab 100644 --- a/fs/nilfs2/dir.c +++ b/fs/nilfs2/dir.c @@ -95,7 +95,7 @@ static void nilfs_commit_chunk(struct folio *folio, unsigned int nr_dirty; int err; - nr_dirty = nilfs_page_count_clean_buffers(&folio->page, from, to); + nr_dirty = nilfs_page_count_clean_buffers(folio, from, to); copied = block_write_end(NULL, mapping, pos, len, len, folio, NULL); if (pos + copied > dir->i_size) i_size_write(dir, pos + copied); diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index f1b47b655672..005dfd1f8fec 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c @@ -242,7 +242,7 @@ static int nilfs_write_end(struct file *file, struct address_space *mapping, unsigned int nr_dirty; int err; - nr_dirty = nilfs_page_count_clean_buffers(&folio->page, start, + nr_dirty = nilfs_page_count_clean_buffers(folio, start, start + copied); copied = generic_write_end(file, mapping, pos, len, copied, folio, fsdata); diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c index 16bb82cdbc07..ebd395dd131b 100644 --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c @@ -419,14 +419,14 @@ void nilfs_clear_folio_dirty(struct folio *folio) __nilfs_clear_folio_dirty(folio); } -unsigned int nilfs_page_count_clean_buffers(struct page *page, +unsigned int nilfs_page_count_clean_buffers(struct folio *folio, unsigned int from, unsigned int to) { unsigned int block_start, block_end; struct buffer_head *bh, *head; unsigned int nc = 0; - for (bh = head = page_buffers(page), block_start = 0; + for (bh = head = folio_buffers(folio), block_start = 0; bh != head || !block_start; block_start = block_end, bh = bh->b_this_page) { block_end = block_start + bh->b_size; diff --git a/fs/nilfs2/page.h b/fs/nilfs2/page.h index 64521a03a19e..b6d9301f16ae 100644 --- a/fs/nilfs2/page.h +++ b/fs/nilfs2/page.h @@ -43,8 +43,8 @@ int nilfs_copy_dirty_pages(struct address_space *, struct address_space *); void nilfs_copy_back_pages(struct address_space *, struct address_space *); void nilfs_clear_folio_dirty(struct folio *folio); void nilfs_clear_dirty_pages(struct address_space *mapping); -unsigned int nilfs_page_count_clean_buffers(struct page *, unsigned int, - unsigned int); +unsigned int nilfs_page_count_clean_buffers(struct folio *, + unsigned int from, unsigned int to); unsigned long nilfs_find_uncommitted_extent(struct inode *inode, sector_t start_blk, sector_t *blkoff); From patchwork Wed Oct 2 15:00:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13819892 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 96AC28F5E; Wed, 2 Oct 2024 15:00:45 +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=1727881247; cv=none; b=FWUdTskTuQCyAYDA6fFqvz7HhX+xI+DdSEwQOq/SugDQTTAsIwcPJtnJxmdyHwDhc0pTn+CypE8tDtb24MmbINDzKfHXs1j/F1kKeTH1FPto5SrV2+UaDO5pBX5vWS/OtHGeIb78Uu3npISOeVeM2S2EMDcWFO8VGDE5noflHIg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727881247; c=relaxed/simple; bh=pdGFX7klhO6pZ6Pp8cg70pW+01wCrUJSm/kcUObNjJY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=flEWysuw5/99Vsv6GKCUTxW36/yVF7bMUd2qjmn+M7KAICVsTBGiVIDckgsD39lfG/qKzlulom7vviFGdDlYYPkA5cEJwYWI2cb5/Pb4gErjWyD0NV/2CFpNOGcKPSAXb204u6KfUpriTHWtfhDssv8SaxS3kp4Biy+ZFU0I6A0= 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=ZOASrtwt; 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="ZOASrtwt" 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=Yu4ZieGNRf3kn0Qj1BS/LcZ6auKmIKvgYP3Q70tjnNg=; b=ZOASrtwtKKGUwbREoP5xx8OG7g KTGyhMGoi86nk4ldQ0njlCfTjeOMJEEcrmatkC/5o4zYlTgS3q8bfjN8iVgUAv99kwvg/xmrwgLbY 6jr0ErUtFWuv6lbUpxum6m54QVbo0H0cobK8pL4YXopBoX0bvh/J8Y9GAZGU74csa+aqj5oc4OuTa pu3wx3Nodh4rFWcA0FDQcEWdSCEfPEicecDaaXquaZXQBHZAGldp5nIAUP/WSAbIuqOd1Se2t855E x6K19un6FxXt1OHje4H0TqEOs1v1a77hKVnCXajZXPyGwTsy4QZsjZXTCBi4iGu/Kw0hYh5kqL8yM K0mzYAuw==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1sw0qD-00000005cSm-2jHe; Wed, 02 Oct 2024 15:00:37 +0000 From: "Matthew Wilcox (Oracle)" To: Ryusuke Konishi Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, linux-nilfs@vger.kernel.org Subject: [PATCH 3/4] nilfs2: Convert nilfs_recovery_copy_block() to take a folio Date: Wed, 2 Oct 2024 16:00:33 +0100 Message-ID: <20241002150036.1339475-4-willy@infradead.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241002150036.1339475-1-willy@infradead.org> References: <20241002150036.1339475-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 memcpy_to_folio() instead of open-coding it, and use offset_in_folio() in case anybody wants to use nilfs2 on a device with large blocks. Signed-off-by: Matthew Wilcox (Oracle) --- fs/nilfs2/recovery.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c index 21d81097a89f..1c665a32f002 100644 --- a/fs/nilfs2/recovery.c +++ b/fs/nilfs2/recovery.c @@ -481,19 +481,16 @@ static int nilfs_prepare_segment_for_recovery(struct the_nilfs *nilfs, static int nilfs_recovery_copy_block(struct the_nilfs *nilfs, struct nilfs_recovery_block *rb, - loff_t pos, struct page *page) + loff_t pos, struct folio *folio) { struct buffer_head *bh_org; - size_t from = pos & ~PAGE_MASK; - void *kaddr; + size_t from = offset_in_folio(folio, pos); bh_org = __bread(nilfs->ns_bdev, rb->blocknr, nilfs->ns_blocksize); if (unlikely(!bh_org)) return -EIO; - kaddr = kmap_local_page(page); - memcpy(kaddr + from, bh_org->b_data, bh_org->b_size); - kunmap_local(kaddr); + memcpy_to_folio(folio, from, bh_org->b_data, bh_org->b_size); brelse(bh_org); return 0; } @@ -531,7 +528,7 @@ static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs, goto failed_inode; } - err = nilfs_recovery_copy_block(nilfs, rb, pos, &folio->page); + err = nilfs_recovery_copy_block(nilfs, rb, pos, folio); if (unlikely(err)) goto failed_page; From patchwork Wed Oct 2 15:00:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13819894 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 96B781CF7D4; Wed, 2 Oct 2024 15:00:45 +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=1727881248; cv=none; b=u3hURom9ap04yFTrVGSLOIY0jqCUYaoWXpgoXFw7peS356pGR1HFmVJMqHUR2ulouwrClBmHqpCFi5Z+/W1jJjneCcO/hlWKdPy7kT6EuMJtN3OGjOmEkaAPqT+Hv1TQgq4t1ZITXVBofcu6zmW0DgjSI7WujpvfuBnvY94sE9Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727881248; c=relaxed/simple; bh=7l5Go5t91dE8de6S1Lfp/42RC395bfstA28o3lJZg4Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=luBEkbDUWzT5yQ2tSnKINiO4eZEHWh7ubXyGT3hPnICt66lF+MWnGdd+LzOBKHpJar7lr7RApBWEb9y43WqA35RskOy5BaZzJKmfTrwAt6mab1AYXlWCstvJM/ZM1gCteovzXQwP4mnBxLtExgnKqnUQGosobzfWVHF/Sim7was= 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=vEj4X5/E; 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="vEj4X5/E" 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=ZCxIAb+8r7iTnxFMXmLz+YjJPFISQmqachGJWAZOJPM=; b=vEj4X5/EZJSE8K8Qvc6sjCSTgT HpelyKkmzWbxfJZVZ0rHivBaURE8aaMlcin2IKKyoPuAL86Dm7iANTsn13BiKRAFPd4NpBfOdNRpb P2Z8mJZ3BftEYXat4rkwfwkiD19KfH9ZV9HYDfXOtt+GIMPAMuR99DvSbVFK7sJraPZZqovSaE9Ry zYpWwGhU+s/6ajSGc4Ty/kE1PNW2/hiYbCPeLB1Vmxh9EsyNOd3brKt0D0AWmWYD2dTX7pD4AbZ71 7N4heM3oeetJGLs+6FHEEzxErVyn5x7Q+NhZ0ZqHnIDdy2zmXb/CbwPvtGdZviS4yiCJ3Pr0nmF4A Cw7uCkhg==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1sw0qD-00000005cSr-3Fn5; Wed, 02 Oct 2024 15:00:37 +0000 From: "Matthew Wilcox (Oracle)" To: Ryusuke Konishi Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, linux-nilfs@vger.kernel.org Subject: [PATCH 4/4] nilfs2: Convert metadata aops from writepage to writepages Date: Wed, 2 Oct 2024 16:00:34 +0100 Message-ID: <20241002150036.1339475-5-willy@infradead.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241002150036.1339475-1-willy@infradead.org> References: <20241002150036.1339475-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 By implementing ->writepages instead of ->writepage, we remove a layer of indirect function calls from the writeback path and the last use of struct page in nilfs2. Signed-off-by: Matthew Wilcox (Oracle) --- fs/nilfs2/mdt.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c index ceb7dc0b5bad..4f4a935fcdc5 100644 --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c @@ -396,10 +396,9 @@ int nilfs_mdt_fetch_dirty(struct inode *inode) return test_bit(NILFS_I_DIRTY, &ii->i_state); } -static int -nilfs_mdt_write_page(struct page *page, struct writeback_control *wbc) +static int nilfs_mdt_write_folio(struct folio *folio, + struct writeback_control *wbc) { - struct folio *folio = page_folio(page); struct inode *inode = folio->mapping->host; struct super_block *sb; int err = 0; @@ -432,11 +431,23 @@ nilfs_mdt_write_page(struct page *page, struct writeback_control *wbc) return err; } +static int nilfs_mdt_writeback(struct address_space *mapping, + struct writeback_control *wbc) +{ + struct folio *folio = NULL; + int error; + + while ((folio = writeback_iter(mapping, wbc, folio, &error))) + nilfs_mdt_write_folio(folio, wbc); + + return error; +} static const struct address_space_operations def_mdt_aops = { .dirty_folio = block_dirty_folio, .invalidate_folio = block_invalidate_folio, - .writepage = nilfs_mdt_write_page, + .writepages = nilfs_mdt_writeback, + .migrate_folio = buffer_migrate_folio, }; static const struct inode_operations def_mdt_iops;