Skip to contentSkip to conversation

netfs, ceph: Partially revert "netfs: Replace PG_fscache by setting folio->private and marking dirty"

PATCH Superseded David Howells 4 participants 5 messages Aug 14, 2024 – Aug 20, 2024

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

David Howells

author maintainer
#0 lore raw

PATCH 1/1 netfs, ceph: Partially revert "netfs: Replace PG_fscache by setting folio->private and marking dirty"

This partially reverts commit 2ff1e97587f4d398686f52c07afde3faf3da4e5c.

In addition to reverting the removal of PG_private_2 wrangling from the buffered read code[1][2], the removal of the waits for PG_private_2 from netfs_release_folio() and netfs_invalidate_folio() need reverting too.

It also adds a wait into ceph_evict_inode() to wait for netfs read and copy-to-cache ops to complete.

---
 fs/ceph/inode.c |    1 +
 fs/netfs/misc.c |    7 +++++++
 2 files changed, 8 insertions(+)
fs/ceph/inode.c +1 -0
index 71cd70514efa..4a8eec46254b 100644
@@ -695,6 +695,7 @@ void ceph_evict_inode(struct inode *inode)
 
 	percpu_counter_dec(&mdsc->metric.total_inodes);
 
+	netfs_wait_for_outstanding_io(inode);
 	truncate_inode_pages_final(&inode->i_data);
 	if (inode->i_state & I_PINNING_NETFS_WB)
 		ceph_fscache_unuse_cookie(inode, true);
fs/netfs/misc.c +7 -0
index 83e644bd518f..554a1a4615ad 100644
@@ -101,6 +101,8 @@ void netfs_invalidate_folio(struct folio *folio, size_t offset, size_t length)
 
 	_enter("{%lx},%zx,%zx", folio->index, offset, length);
 
+	folio_wait_private_2(folio); /* [DEPRECATED] */
+
 	if (!folio_test_private(folio))
 		return;
 
@@ -165,6 +167,11 @@ bool netfs_release_folio(struct folio *folio, gfp_t gfp)
 
 	if (folio_test_private(folio))
 		return false;
+	if (unlikely(folio_test_private_2(folio))) { /* [DEPRECATED] */
+		if (current_is_kswapd() || !(gfp & __GFP_FS))
+			return false;
+		folio_wait_private_2(folio);
+	}
 	fscache_note_page_release(netfs_i_cookie(ctx));
 	return true;
 }
#1 lore raw
Quoted 23 lines · David Howells

This partially reverts commit 2ff1e97587f4d398686f52c07afde3faf3da4e5c.

In addition to reverting the removal of PG_private_2 wrangling from the buffered read code[1][2], the removal of the waits for PG_private_2 from netfs_release_folio() and netfs_invalidate_folio() need reverting too.

It also adds a wait into ceph_evict_inode() to wait for netfs read and copy-to-cache ops to complete.

Quoted 1 line

---

Now in vfs.fixes.

@Konstantin, for some reason I keep having issues with this patch series. It confuses b4 to no end. When I try to shazam this single patch here using [email protected] it pull down a 26 patch series. And with -P _ it complains that it can't find the messag id.

#2 lore raw
Quoted 5 lines · Christian Brauner

@Konstantin, for some reason I keep having issues with this patch series. It confuses b4 to no end. When I try to shazam this single patch here using [email protected] it pull down a 26 patch series. And with -P _ it complains that it can't find the messag id.

I cannot reproduce this, which suggests to me that there's something going on with cached data specific to your local content. Can you please run the following:

    b4 -d shazam [email protected] > /tmp/b4-debug.out 2>&1

then gzip and send that to me?

-K

#3 lore raw
In reply to David Howells
Quoted 55 lines · David Howells

This partially reverts commit 2ff1e97587f4d398686f52c07afde3faf3da4e5c.

In addition to reverting the removal of PG_private_2 wrangling from the buffered read code[1][2], the removal of the waits for PG_private_2 from netfs_release_folio() and netfs_invalidate_folio() need reverting too.

It also adds a wait into ceph_evict_inode() to wait for netfs read and copy-to-cache ops to complete.

---
  fs/ceph/inode.c |    1 +
  fs/netfs/misc.c |    7 +++++++
  2 files changed, 8 insertions(+)
fs/ceph/inode.c +1 -0
index 71cd70514efa..4a8eec46254b 100644
@@ -695,6 +695,7 @@ void ceph_evict_inode(struct inode *inode)
 
  	percpu_counter_dec(&mdsc->metric.total_inodes);
 
+	netfs_wait_for_outstanding_io(inode);
  	truncate_inode_pages_final(&inode->i_data);
  	if (inode->i_state & I_PINNING_NETFS_WB)
  		ceph_fscache_unuse_cookie(inode, true);
fs/netfs/misc.c +2 -0
index 83e644bd518f..554a1a4615ad 100644
@@ -101,6 +101,8 @@ void netfs_invalidate_folio(struct folio *folio, size_t offset, size_t length)
 
  	_enter("{%lx},%zx,%zx", folio->index, offset, length);
 
+	folio_wait_private_2(folio); /* [DEPRECATED] */
+
  	if (!folio_test_private(folio))
  		return;
 
@@ -165,6 +167,11 @@ bool netfs_release_folio(struct folio *folio, gfp_t gfp)
 

fs/netfs/misc.c bool netfs_release_folio(struct folio *folio, gfp_t gfp) · line 177

Quoted 10 lines
fs/netfs/misc.c +5 -0
  	if (folio_test_private(folio))
  		return false;
+	if (unlikely(folio_test_private_2(folio))) { /* [DEPRECATED] */
+		if (current_is_kswapd() || !(gfp & __GFP_FS))
+			return false;
+		folio_wait_private_2(folio);
+	}
  	fscache_note_page_release(netfs_i_cookie(ctx));
  	return true;
  }

Just back from PTOs.

This LGTM and I will run the test today locally.

Thanks David.

- Xiubo

Reviewed-by Tested-by on v1 1/1
#4 lore raw
In reply to David Howells
Quoted 56 lines · David Howells

This partially reverts commit 2ff1e97587f4d398686f52c07afde3faf3da4e5c.

In addition to reverting the removal of PG_private_2 wrangling from the buffered read code[1][2], the removal of the waits for PG_private_2 from netfs_release_folio() and netfs_invalidate_folio() need reverting too.

It also adds a wait into ceph_evict_inode() to wait for netfs read and copy-to-cache ops to complete.

---
  fs/ceph/inode.c |    1 +
  fs/netfs/misc.c |    7 +++++++
  2 files changed, 8 insertions(+)
fs/ceph/inode.c +1 -0
index 71cd70514efa..4a8eec46254b 100644
@@ -695,6 +695,7 @@ void ceph_evict_inode(struct inode *inode)
 
  	percpu_counter_dec(&mdsc->metric.total_inodes);
 
+	netfs_wait_for_outstanding_io(inode);
  	truncate_inode_pages_final(&inode->i_data);
  	if (inode->i_state & I_PINNING_NETFS_WB)
  		ceph_fscache_unuse_cookie(inode, true);
fs/netfs/misc.c +2 -0
index 83e644bd518f..554a1a4615ad 100644
@@ -101,6 +101,8 @@ void netfs_invalidate_folio(struct folio *folio, size_t offset, size_t length)
 
  	_enter("{%lx},%zx,%zx", folio->index, offset, length);
 
+	folio_wait_private_2(folio); /* [DEPRECATED] */
+
  	if (!folio_test_private(folio))
  		return;
 
@@ -165,6 +167,11 @@ bool netfs_release_folio(struct folio *folio, gfp_t gfp)
 

fs/netfs/misc.c bool netfs_release_folio(struct folio *folio, gfp_t gfp) · line 177

Quoted 10 lines
fs/netfs/misc.c +5 -0
  	if (folio_test_private(folio))
  		return false;
+	if (unlikely(folio_test_private_2(folio))) { /* [DEPRECATED] */
+		if (current_is_kswapd() || !(gfp & __GFP_FS))
+			return false;
+		folio_wait_private_2(folio);
+	}
  	fscache_note_page_release(netfs_i_cookie(ctx));
  	return true;
  }

Tested it and worked fine.

Thanks