* [merged mm-stable] gfs2-convert-gfs2_write_cache_jdata-to-use-filemap_get_folios_tag.patch removed from -mm tree
@ 2023-02-03 6:37 Andrew Morton
2023-02-03 10:54 ` Andreas Gruenbacher
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2023-02-03 6:37 UTC (permalink / raw)
To: mm-commits, agruenba, vishal.moola, akpm
The quilt patch titled
Subject: gfs2: convert gfs2_write_cache_jdata() to use filemap_get_folios_tag()
has been removed from the -mm tree. Its filename was
gfs2-convert-gfs2_write_cache_jdata-to-use-filemap_get_folios_tag.patch
This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>
Subject: gfs2: convert gfs2_write_cache_jdata() to use filemap_get_folios_tag()
Date: Wed, 4 Jan 2023 13:14:42 -0800
Convert function to use folios throughout. This is in preparation for the
removal of find_get_pgaes_range_tag(). This change removes 8 calls to
compound_head().
Also had to modify and rename gfs2_write_jdata_pagevec() to take in and
utilize folio_batch rather than pagevec and use folios rather than pages.
gfs2_write_jdata_batch() now supports large folios.
Link: https://lkml.kernel.org/r/20230104211448.4804-18-vishal.moola@gmail.com
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Reviewed-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
--- a/fs/gfs2/aops.c~gfs2-convert-gfs2_write_cache_jdata-to-use-filemap_get_folios_tag
+++ a/fs/gfs2/aops.c
@@ -195,67 +195,71 @@ static int gfs2_writepages(struct addres
}
/**
- * gfs2_write_jdata_pagevec - Write back a pagevec's worth of pages
+ * gfs2_write_jdata_batch - Write back a folio batch's worth of folios
* @mapping: The mapping
* @wbc: The writeback control
- * @pvec: The vector of pages
- * @nr_pages: The number of pages to write
+ * @fbatch: The batch of folios
* @done_index: Page index
*
* Returns: non-zero if loop should terminate, zero otherwise
*/
-static int gfs2_write_jdata_pagevec(struct address_space *mapping,
+static int gfs2_write_jdata_batch(struct address_space *mapping,
struct writeback_control *wbc,
- struct pagevec *pvec,
- int nr_pages,
+ struct folio_batch *fbatch,
pgoff_t *done_index)
{
struct inode *inode = mapping->host;
struct gfs2_sbd *sdp = GFS2_SB(inode);
- unsigned nrblocks = nr_pages * (PAGE_SIZE >> inode->i_blkbits);
+ unsigned nrblocks;
int i;
int ret;
+ int nr_pages = 0;
+ int nr_folios = folio_batch_count(fbatch);
+
+ for (i = 0; i < nr_folios; i++)
+ nr_pages += folio_nr_pages(fbatch->folios[i]);
+ nrblocks = nr_pages * (PAGE_SIZE >> inode->i_blkbits);
ret = gfs2_trans_begin(sdp, nrblocks, nrblocks);
if (ret < 0)
return ret;
- for(i = 0; i < nr_pages; i++) {
- struct page *page = pvec->pages[i];
+ for (i = 0; i < nr_folios; i++) {
+ struct folio *folio = fbatch->folios[i];
- *done_index = page->index;
+ *done_index = folio->index;
- lock_page(page);
+ folio_lock(folio);
- if (unlikely(page->mapping != mapping)) {
+ if (unlikely(folio->mapping != mapping)) {
continue_unlock:
- unlock_page(page);
+ folio_unlock(folio);
continue;
}
- if (!PageDirty(page)) {
+ if (!folio_test_dirty(folio)) {
/* someone wrote it for us */
goto continue_unlock;
}
- if (PageWriteback(page)) {
+ if (folio_test_writeback(folio)) {
if (wbc->sync_mode != WB_SYNC_NONE)
- wait_on_page_writeback(page);
+ folio_wait_writeback(folio);
else
goto continue_unlock;
}
- BUG_ON(PageWriteback(page));
- if (!clear_page_dirty_for_io(page))
+ BUG_ON(folio_test_writeback(folio));
+ if (!folio_clear_dirty_for_io(folio))
goto continue_unlock;
trace_wbc_writepage(wbc, inode_to_bdi(inode));
- ret = __gfs2_jdata_writepage(page, wbc);
+ ret = __gfs2_jdata_writepage(&folio->page, wbc);
if (unlikely(ret)) {
if (ret == AOP_WRITEPAGE_ACTIVATE) {
- unlock_page(page);
+ folio_unlock(folio);
ret = 0;
} else {
@@ -268,7 +272,8 @@ continue_unlock:
* not be suitable for data integrity
* writeout).
*/
- *done_index = page->index + 1;
+ *done_index = folio->index +
+ folio_nr_pages(folio);
ret = 1;
break;
}
@@ -305,8 +310,8 @@ static int gfs2_write_cache_jdata(struct
{
int ret = 0;
int done = 0;
- struct pagevec pvec;
- int nr_pages;
+ struct folio_batch fbatch;
+ int nr_folios;
pgoff_t writeback_index;
pgoff_t index;
pgoff_t end;
@@ -315,7 +320,7 @@ static int gfs2_write_cache_jdata(struct
int range_whole = 0;
xa_mark_t tag;
- pagevec_init(&pvec);
+ folio_batch_init(&fbatch);
if (wbc->range_cyclic) {
writeback_index = mapping->writeback_index; /* prev offset */
index = writeback_index;
@@ -341,17 +346,18 @@ retry:
tag_pages_for_writeback(mapping, index, end);
done_index = index;
while (!done && (index <= end)) {
- nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, end,
- tag);
- if (nr_pages == 0)
+ nr_folios = filemap_get_folios_tag(mapping, &index, end,
+ tag, &fbatch);
+ if (nr_folios == 0)
break;
- ret = gfs2_write_jdata_pagevec(mapping, wbc, &pvec, nr_pages, &done_index);
+ ret = gfs2_write_jdata_batch(mapping, wbc, &fbatch,
+ &done_index);
if (ret)
done = 1;
if (ret > 0)
ret = 0;
- pagevec_release(&pvec);
+ folio_batch_release(&fbatch);
cond_resched();
}
_
Patches currently in -mm which might be from vishal.moola@gmail.com are
mm-add-folio_estimated_sharers.patch
mm-mempolicy-convert-queue_pages_pmd-to-queue_folios_pmd.patch
mm-mempolicy-convert-queue_pages_pte_range-to-queue_folios_pte_range.patch
mm-mempolicy-convert-queue_pages_hugetlb-to-queue_folios_hugetlb.patch
mm-mempolicy-convert-queue_pages_required-to-queue_folio_required.patch
mm-mempolicy-convert-migrate_page_add-to-migrate_folio_add.patch
mm-add-folio_get_nontail_page.patch
mm-migrate-add-folio_movable_ops.patch
mm-migrate-convert-isolate_movable_page-to-use-folios.patch
mm-migrate-convert-putback_movable_pages-to-use-folios.patch
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [merged mm-stable] gfs2-convert-gfs2_write_cache_jdata-to-use-filemap_get_folios_tag.patch removed from -mm tree
2023-02-03 6:37 [merged mm-stable] gfs2-convert-gfs2_write_cache_jdata-to-use-filemap_get_folios_tag.patch removed from -mm tree Andrew Morton
@ 2023-02-03 10:54 ` Andreas Gruenbacher
2023-02-21 22:52 ` Andreas Gruenbacher
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Gruenbacher @ 2023-02-03 10:54 UTC (permalink / raw)
To: Andrew Morton; +Cc: Andreas Gruenbacher, mm-commits, Matthew Wilcox
Hi Andrew,
On Fri, Feb 3, 2023 at 7:37 AM Andrew Morton <akpm@linux-foundation.org> wrote:
> The quilt patch titled
> Subject: gfs2: convert gfs2_write_cache_jdata() to use filemap_get_folios_tag()
> has been removed from the -mm tree. Its filename was
> gfs2-convert-gfs2_write_cache_jdata-to-use-filemap_get_folios_tag.patch
>
> This patch was dropped because it was merged into the mm-stable branch
> of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
note that there now is a conflict between the following commit in v6.2-rc6:
95ecbd0f162f ("Revert "gfs2: stop using generic_writepages in gfs2_ail1_start_one"")
and this commit in mm-stable:
d585bdbeb79a ("fs: convert writepage_t callback to pass a folio")
Trivial resolution below.
Thanks,
Andreas
---
fs/gfs2/log.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 25fd21a9dec8..807daaeb4153 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -80,11 +80,11 @@ void gfs2_remove_from_ail(struct gfs2_bufdata *bd)
brelse(bd->bd_bh);
}
-static int __gfs2_writepage(struct page *page, struct writeback_control *wbc,
- void *data)
+static int __gfs2_writepage(struct folio *folio, struct writeback_control *wbc,
+ void *data)
{
struct address_space *mapping = data;
- int ret = mapping->a_ops->writepage(page, wbc);
+ int ret = mapping->a_ops->writepage(&folio->page, wbc);
mapping_set_error(mapping, ret);
return ret;
}
--
2.39.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [merged mm-stable] gfs2-convert-gfs2_write_cache_jdata-to-use-filemap_get_folios_tag.patch removed from -mm tree
2023-02-03 10:54 ` Andreas Gruenbacher
@ 2023-02-21 22:52 ` Andreas Gruenbacher
2023-02-21 23:19 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Gruenbacher @ 2023-02-21 22:52 UTC (permalink / raw)
To: Andrew Morton; +Cc: mm-commits, Matthew Wilcox
Hi again,
the following conflict on mm-stable still hasn't been fixed.
Thanks,
Andreas
On Fri, Feb 3, 2023 at 11:54 AM Andreas Gruenbacher <agruenba@redhat.com> wrote:
> Hi Andrew,
>
> On Fri, Feb 3, 2023 at 7:37 AM Andrew Morton <akpm@linux-foundation.org> wrote:
> > The quilt patch titled
> > Subject: gfs2: convert gfs2_write_cache_jdata() to use filemap_get_folios_tag()
> > has been removed from the -mm tree. Its filename was
> > gfs2-convert-gfs2_write_cache_jdata-to-use-filemap_get_folios_tag.patch
> >
> > This patch was dropped because it was merged into the mm-stable branch
> > of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
>
> note that there now is a conflict between the following commit in v6.2-rc6:
>
> 95ecbd0f162f ("Revert "gfs2: stop using generic_writepages in gfs2_ail1_start_one"")
>
> and this commit in mm-stable:
>
> d585bdbeb79a ("fs: convert writepage_t callback to pass a folio")
>
> Trivial resolution below.
>
> Thanks,
> Andreas
>
> ---
> fs/gfs2/log.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
> index 25fd21a9dec8..807daaeb4153 100644
> --- a/fs/gfs2/log.c
> +++ b/fs/gfs2/log.c
> @@ -80,11 +80,11 @@ void gfs2_remove_from_ail(struct gfs2_bufdata *bd)
> brelse(bd->bd_bh);
> }
>
> -static int __gfs2_writepage(struct page *page, struct writeback_control *wbc,
> - void *data)
> +static int __gfs2_writepage(struct folio *folio, struct writeback_control *wbc,
> + void *data)
> {
> struct address_space *mapping = data;
> - int ret = mapping->a_ops->writepage(page, wbc);
> + int ret = mapping->a_ops->writepage(&folio->page, wbc);
> mapping_set_error(mapping, ret);
> return ret;
> }
> --
> 2.39.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [merged mm-stable] gfs2-convert-gfs2_write_cache_jdata-to-use-filemap_get_folios_tag.patch removed from -mm tree
2023-02-21 22:52 ` Andreas Gruenbacher
@ 2023-02-21 23:19 ` Andrew Morton
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2023-02-21 23:19 UTC (permalink / raw)
To: Andreas Gruenbacher; +Cc: mm-commits, Matthew Wilcox
On Tue, 21 Feb 2023 23:52:02 +0100 Andreas Gruenbacher <agruenba@redhat.com> wrote:
> Hi again,
>
> the following conflict on mm-stable still hasn't been fixed.
>
> ...
>
> > --- a/fs/gfs2/log.c
> > +++ b/fs/gfs2/log.c
> > @@ -80,11 +80,11 @@ void gfs2_remove_from_ail(struct gfs2_bufdata *bd)
> > brelse(bd->bd_bh);
> > }
> >
> > -static int __gfs2_writepage(struct page *page, struct writeback_control *wbc,
> > - void *data)
> > +static int __gfs2_writepage(struct folio *folio, struct writeback_control *wbc,
> > + void *data)
> > {
> > struct address_space *mapping = data;
> > - int ret = mapping->a_ops->writepage(page, wbc);
> > + int ret = mapping->a_ops->writepage(&folio->page, wbc);
> > mapping_set_error(mapping, ret);
> > return ret;
> > }
Ah. When you said "conflict" I expected an actual patch reject.
Thanks, I'll put something together for Linus.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-21 23:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-03 6:37 [merged mm-stable] gfs2-convert-gfs2_write_cache_jdata-to-use-filemap_get_folios_tag.patch removed from -mm tree Andrew Morton
2023-02-03 10:54 ` Andreas Gruenbacher
2023-02-21 22:52 ` Andreas Gruenbacher
2023-02-21 23:19 ` Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.