Message ID | 20241002165253.3872513-12-joannelkoong@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | fuse: use folios instead of pages for requests | expand |
On Wed, Oct 02, 2024 at 09:52:51AM -0700, Joanne Koong wrote: > Add a new convenience helper folio_mark_dirty_lock() that grabs the > folio lock before calling folio_mark_dirty(). > > Signed-off-by: Joanne Koong <joannelkoong@gmail.com> > --- > include/linux/mm.h | 1 + > mm/page-writeback.c | 12 ++++++++++++ > 2 files changed, 13 insertions(+) > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index ecf63d2b0582..446d7096c48f 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -2539,6 +2539,7 @@ struct kvec; > struct page *get_dump_page(unsigned long addr); > > bool folio_mark_dirty(struct folio *folio); > +bool folio_mark_dirty_lock(struct folio *folio); > bool set_page_dirty(struct page *page); > int set_page_dirty_lock(struct page *page); > > diff --git a/mm/page-writeback.c b/mm/page-writeback.c > index fcd4c1439cb9..9b1c95dd219c 100644 > --- a/mm/page-writeback.c > +++ b/mm/page-writeback.c > @@ -2913,6 +2913,18 @@ bool folio_mark_dirty(struct folio *folio) > } > EXPORT_SYMBOL(folio_mark_dirty); > I think you should include the comment description from set_page_dirty_lock() as well here, generally good to keep documentation consistent. Thanks, Josef
On Fri, Oct 18, 2024 at 1:01 PM Josef Bacik <josef@toxicpanda.com> wrote: > > On Wed, Oct 02, 2024 at 09:52:51AM -0700, Joanne Koong wrote: > > Add a new convenience helper folio_mark_dirty_lock() that grabs the > > folio lock before calling folio_mark_dirty(). > > > > Signed-off-by: Joanne Koong <joannelkoong@gmail.com> > > --- > > include/linux/mm.h | 1 + > > mm/page-writeback.c | 12 ++++++++++++ > > 2 files changed, 13 insertions(+) > > > > diff --git a/include/linux/mm.h b/include/linux/mm.h > > index ecf63d2b0582..446d7096c48f 100644 > > --- a/include/linux/mm.h > > +++ b/include/linux/mm.h > > @@ -2539,6 +2539,7 @@ struct kvec; > > struct page *get_dump_page(unsigned long addr); > > > > bool folio_mark_dirty(struct folio *folio); > > +bool folio_mark_dirty_lock(struct folio *folio); > > bool set_page_dirty(struct page *page); > > int set_page_dirty_lock(struct page *page); > > > > diff --git a/mm/page-writeback.c b/mm/page-writeback.c > > index fcd4c1439cb9..9b1c95dd219c 100644 > > --- a/mm/page-writeback.c > > +++ b/mm/page-writeback.c > > @@ -2913,6 +2913,18 @@ bool folio_mark_dirty(struct folio *folio) > > } > > EXPORT_SYMBOL(folio_mark_dirty); > > > > I think you should include the comment description from set_page_dirty_lock() as > well here, generally good to keep documentation consistent. Thanks, Looking at this some more, for v2 I am going to replace set_page_dirty_lock() to be a wrapper around folio_mark_dirty_lock(), eg something like +int set_page_dirty_lock(struct page *page) +{ + return folio_mark_dirty_lock(page_folio(page)); +} +EXPORT_SYMBOL(set_page_dirty_lock); so that we have one source of truth for the logic. I'll remove your Reviewed-by for this patch in v2 in case you have disagreements on the newer v2 implementation. Thanks, Joanne > > Josef
diff --git a/include/linux/mm.h b/include/linux/mm.h index ecf63d2b0582..446d7096c48f 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2539,6 +2539,7 @@ struct kvec; struct page *get_dump_page(unsigned long addr); bool folio_mark_dirty(struct folio *folio); +bool folio_mark_dirty_lock(struct folio *folio); bool set_page_dirty(struct page *page); int set_page_dirty_lock(struct page *page); diff --git a/mm/page-writeback.c b/mm/page-writeback.c index fcd4c1439cb9..9b1c95dd219c 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2913,6 +2913,18 @@ bool folio_mark_dirty(struct folio *folio) } EXPORT_SYMBOL(folio_mark_dirty); +bool folio_mark_dirty_lock(struct folio *folio) +{ + bool ret; + + folio_lock(folio); + ret = folio_mark_dirty(folio); + folio_unlock(folio); + + return ret; +} +EXPORT_SYMBOL(folio_mark_dirty_lock); + /* * set_page_dirty() is racy if the caller has no reference against * page->mapping->host, and if the page is unlocked. This is because another
Add a new convenience helper folio_mark_dirty_lock() that grabs the folio lock before calling folio_mark_dirty(). Signed-off-by: Joanne Koong <joannelkoong@gmail.com> --- include/linux/mm.h | 1 + mm/page-writeback.c | 12 ++++++++++++ 2 files changed, 13 insertions(+)