linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] freevxfs: Convert vxfs_immed_read_folio to the new folio APIs
@ 2023-12-06 20:46 Matthew Wilcox (Oracle)
  2023-12-07  5:24 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox (Oracle) @ 2023-12-06 20:46 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Matthew Wilcox (Oracle), linux-fsdevel

Use folio_fill_tail() and folio_end_read() instead of open-coding them.
Add a sanity check in case a folio is allocated above index 0.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/freevxfs/vxfs_immed.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/fs/freevxfs/vxfs_immed.c b/fs/freevxfs/vxfs_immed.c
index 9b49ec36e667..b9c6c7118e58 100644
--- a/fs/freevxfs/vxfs_immed.c
+++ b/fs/freevxfs/vxfs_immed.c
@@ -28,19 +28,16 @@
  * Locking status:
  *   @folio is locked and will be unlocked.
  */
-static int vxfs_immed_read_folio(struct file *fp, struct folio *folio)
+static int vxfs_immed_read_folio(struct file *file, struct folio *folio)
 {
 	struct vxfs_inode_info *vip = VXFS_INO(folio->mapping->host);
-	void *src = vip->vii_immed.vi_immed + folio_pos(folio);
-	unsigned long i;
+	size_t len = VXFS_NIMMED;
 
-	for (i = 0; i < folio_nr_pages(folio); i++) {
-		memcpy_to_page(folio_page(folio, i), 0, src, PAGE_SIZE);
-		src += PAGE_SIZE;
-	}
+	if (folio->index > 0)
+		len = 0;
 
-	folio_mark_uptodate(folio);
-	folio_unlock(folio);
+	folio_fill_tail(folio, 0, vip->vii_immed.vi_immed, len);
+	folio_end_read(folio, true);
 
 	return 0;
 }
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] freevxfs: Convert vxfs_immed_read_folio to the new folio APIs
  2023-12-06 20:46 [PATCH] freevxfs: Convert vxfs_immed_read_folio to the new folio APIs Matthew Wilcox (Oracle)
@ 2023-12-07  5:24 ` Christoph Hellwig
  2023-12-07 13:22   ` Matthew Wilcox
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2023-12-07  5:24 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: Christoph Hellwig, linux-fsdevel

On Wed, Dec 06, 2023 at 08:46:29PM +0000, Matthew Wilcox (Oracle) wrote:
> Use folio_fill_tail() and folio_end_read() instead of open-coding them.
> Add a sanity check in case a folio is allocated above index 0.

Where do these helpers come from?  Can't find them in Linus' tree.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] freevxfs: Convert vxfs_immed_read_folio to the new folio APIs
  2023-12-07  5:24 ` Christoph Hellwig
@ 2023-12-07 13:22   ` Matthew Wilcox
  2023-12-12  7:44     ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2023-12-07 13:22 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-fsdevel

On Wed, Dec 06, 2023 at 09:24:03PM -0800, Christoph Hellwig wrote:
> On Wed, Dec 06, 2023 at 08:46:29PM +0000, Matthew Wilcox (Oracle) wrote:
> > Use folio_fill_tail() and folio_end_read() instead of open-coding them.
> > Add a sanity check in case a folio is allocated above index 0.
> 
> Where do these helpers come from?  Can't find them in Linus' tree.

Is your tree out of date?

0b237047d5a7 for folio_end_read()
$ git describe --contains 0b237047d5a7
v6.7-rc1~90^2~161

folio_fill_tail() appears to only be in akpm's tree for now.  Looks like
it's still in the 'unstable' part for now, so no sha1 for that.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] freevxfs: Convert vxfs_immed_read_folio to the new folio APIs
  2023-12-07 13:22   ` Matthew Wilcox
@ 2023-12-12  7:44     ` Christoph Hellwig
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2023-12-12  7:44 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Christoph Hellwig, linux-fsdevel

On Thu, Dec 07, 2023 at 01:22:03PM +0000, Matthew Wilcox wrote:
> On Wed, Dec 06, 2023 at 09:24:03PM -0800, Christoph Hellwig wrote:
> > On Wed, Dec 06, 2023 at 08:46:29PM +0000, Matthew Wilcox (Oracle) wrote:
> > > Use folio_fill_tail() and folio_end_read() instead of open-coding them.
> > > Add a sanity check in case a folio is allocated above index 0.
> > 
> > Where do these helpers come from?  Can't find them in Linus' tree.
> 
> Is your tree out of date?
> 
> 0b237047d5a7 for folio_end_read()
> $ git describe --contains 0b237047d5a7
> v6.7-rc1~90^2~161
> 
> folio_fill_tail() appears to only be in akpm's tree for now.  Looks like
> it's still in the 'unstable' part for now, so no sha1 for that.

Heh, I only looked for the first one.  But adding what tree you're
sending a patch against not only makes reviewing possible, but also
helps with the destination.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-12-12  7:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-06 20:46 [PATCH] freevxfs: Convert vxfs_immed_read_folio to the new folio APIs Matthew Wilcox (Oracle)
2023-12-07  5:24 ` Christoph Hellwig
2023-12-07 13:22   ` Matthew Wilcox
2023-12-12  7:44     ` Christoph Hellwig

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).