[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <249863ea-8b4b-df38-545a-5f083502270d@suse.cz>
Date: Thu, 12 Aug 2021 18:30:51 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: "Matthew Wilcox (Oracle)" <willy@...radead.org>,
linux-kernel@...r.kernel.org
Cc: linux-mm@...ck.org, linux-fsdevel@...r.kernel.org,
Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v14 076/138] mm/writeback: Add
folio_redirty_for_writepage()
On 7/15/21 5:36 AM, Matthew Wilcox (Oracle) wrote:
> Reimplement redirty_page_for_writepage() as a wrapper around
> folio_redirty_for_writepage(). Account the number of pages in the
> folio, add kernel-doc and move the prototype to writeback.h.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
> Reviewed-by: Christoph Hellwig <hch@....de>
Acked-by: Vlastimil Babka <vbabka@...e.cz>
Nit:
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -2558,21 +2558,31 @@ void folio_account_redirty(struct folio *folio)
> }
> EXPORT_SYMBOL(folio_account_redirty);
>
> -/*
> - * When a writepage implementation decides that it doesn't want to write this
> - * page for some reason, it should redirty the locked page via
> - * redirty_page_for_writepage() and it should then unlock the page and return 0
> +/**
> + * folio_redirty_for_writepage - Decline to write a dirty folio.
> + * @wbc: The writeback control.
> + * @folio: The folio.
> + *
> + * When a writepage implementation decides that it doesn't want to write
> + * @folio for some reason, it should call this function, unlock @folio and
> + * return 0.
s/0/false
> + *
> + * Return: True if we redirtied the folio. False if someone else dirtied
> + * it first.
> */
> -int redirty_page_for_writepage(struct writeback_control *wbc, struct page *page)
> +bool folio_redirty_for_writepage(struct writeback_control *wbc,
> + struct folio *folio)
> {
> - int ret;
> + bool ret;
> + unsigned nr = folio_nr_pages(folio);
> +
> + wbc->pages_skipped += nr;
> + ret = filemap_dirty_folio(folio->mapping, folio);
> + folio_account_redirty(folio);
>
> - wbc->pages_skipped++;
> - ret = __set_page_dirty_nobuffers(page);
> - account_page_redirty(page);
> return ret;
> }
> -EXPORT_SYMBOL(redirty_page_for_writepage);
> +EXPORT_SYMBOL(folio_redirty_for_writepage);
>
> /**
> * folio_mark_dirty - Mark a folio as being modified.
>
Powered by blists - more mailing lists