linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	ceph-devel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	David Howells <dhowells@redhat.com>
Subject: [PATCH v3 1/9] ceph: Remove ceph_writepage()
Date: Mon, 17 Feb 2025 18:51:09 +0000	[thread overview]
Message-ID: <20250217185119.430193-2-willy@infradead.org> (raw)
In-Reply-To: <20250217185119.430193-1-willy@infradead.org>

Ceph already has a writepages operation which is preferred over writepage
in all situations except for page migration.  By adding a migrate_folio
operation, there will be no situations in which ->writepage should
be called.  filemap_migrate_folio() is an appropriate operation to use
because the ceph data stored in folio->private does not contain any
reference to the memory address of the folio.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/ceph/addr.c | 28 +---------------------------
 1 file changed, 1 insertion(+), 27 deletions(-)

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index f4e43fe5bb5e..200dca1ff2d6 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -862,32 +862,6 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
 	return err;
 }
 
-static int ceph_writepage(struct page *page, struct writeback_control *wbc)
-{
-	int err;
-	struct inode *inode = page->mapping->host;
-	BUG_ON(!inode);
-	ihold(inode);
-
-	if (wbc->sync_mode == WB_SYNC_NONE &&
-	    ceph_inode_to_fs_client(inode)->write_congested) {
-		redirty_page_for_writepage(wbc, page);
-		return AOP_WRITEPAGE_ACTIVATE;
-	}
-
-	folio_wait_private_2(page_folio(page)); /* [DEPRECATED] */
-
-	err = writepage_nounlock(page, wbc);
-	if (err == -ERESTARTSYS) {
-		/* direct memory reclaimer was killed by SIGKILL. return 0
-		 * to prevent caller from setting mapping/page error */
-		err = 0;
-	}
-	unlock_page(page);
-	iput(inode);
-	return err;
-}
-
 /*
  * async writeback completion handler.
  *
@@ -1954,7 +1928,6 @@ static int ceph_write_end(struct file *file, struct address_space *mapping,
 const struct address_space_operations ceph_aops = {
 	.read_folio = netfs_read_folio,
 	.readahead = netfs_readahead,
-	.writepage = ceph_writepage,
 	.writepages = ceph_writepages_start,
 	.write_begin = ceph_write_begin,
 	.write_end = ceph_write_end,
@@ -1962,6 +1935,7 @@ const struct address_space_operations ceph_aops = {
 	.invalidate_folio = ceph_invalidate_folio,
 	.release_folio = netfs_release_folio,
 	.direct_IO = noop_direct_IO,
+	.migrate_folio = filemap_migrate_folio,
 };
 
 static void ceph_block_sigs(sigset_t *oldset)
-- 
2.47.2


  reply	other threads:[~2025-02-17 18:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-17 18:51 [PATCH v3 0/9] Remove accesses to page->index from ceph Matthew Wilcox (Oracle)
2025-02-17 18:51 ` Matthew Wilcox (Oracle) [this message]
2025-02-17 18:51 ` [PATCH v3 2/9] ceph: Use a folio in ceph_page_mkwrite() Matthew Wilcox (Oracle)
2025-02-17 18:51 ` [PATCH v3 3/9] ceph: Convert ceph_find_incompatible() to take a folio Matthew Wilcox (Oracle)
2025-02-17 18:51 ` [PATCH v3 4/9] ceph: Convert ceph_readdir_cache_control to store " Matthew Wilcox (Oracle)
2025-02-17 18:51 ` [PATCH v3 5/9] ceph: Convert writepage_nounlock() to write_folio_nounlock() Matthew Wilcox (Oracle)
2025-02-17 18:51 ` [PATCH v3 6/9] ceph: Convert ceph_check_page_before_write() to use a folio Matthew Wilcox (Oracle)
2025-02-17 18:51 ` [PATCH v3 7/9] ceph: Remove uses of page from ceph_process_folio_batch() Matthew Wilcox (Oracle)
2025-02-17 18:51 ` [PATCH v3 8/9] ceph: Convert ceph_move_dirty_page_in_page_array() to move_dirty_folio_in_page_array() Matthew Wilcox (Oracle)
2025-02-17 18:51 ` [PATCH v3 9/9] ceph: Pass a folio to ceph_allocate_page_array() Matthew Wilcox (Oracle)
2025-02-18  0:34 ` [PATCH v3 0/9] Remove accesses to page->index from ceph Viacheslav Dubeyko
2025-02-21 20:44 ` [PATCH v3 10/9] fs: Remove page_mkwrite_check_truncate() Matthew Wilcox (Oracle)
2025-02-21 20:45   ` Matthew Wilcox
2025-02-24 20:11     ` Viacheslav Dubeyko
2025-02-24 20:19       ` Matthew Wilcox
2025-02-24 20:39         ` Viacheslav Dubeyko
2025-02-24 22:24   ` Viacheslav Dubeyko
2025-02-28 10:22 ` [PATCH v3 0/9] Remove accesses to page->index from ceph Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250217185119.430193-2-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=Slava.Dubeyko@ibm.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).