public inbox for linux-doc@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: Jonathan Corbet <corbet@lwn.net>,
	linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] buffer: Add kernel-doc for block_dirty_folio()
Date: Thu, 4 Jan 2024 22:41:51 +0000	[thread overview]
Message-ID: <ZZc0L9ANGS3z3n7c@casper.infradead.org> (raw)
In-Reply-To: <133cd73f-3080-4362-bc3e-ef4cc8880a20@infradead.org>

On Thu, Jan 04, 2024 at 01:06:10PM -0800, Randy Dunlap wrote:
> > +/**
> > + * block_dirty_folio - Mark a folio as dirty.
> > + * @mapping: The address space containing this folio.
> > + * @folio: The folio to mark dirty.
> > + *
> > + * Filesystems which use buffer_heads can use this function as their
> > + * ->dirty_folio implementation.  Some filesystems need to do a little
> > + * work before calling this function.  Filesystems which do not use
> > + * buffer_heads should call filemap_dirty_folio() instead.
> > + *
> > + * If the folio has buffers, the uptodate buffers are set dirty, to
> > + * preserve dirty-state coherency between the folio and the buffers.
> > + * It the folio does not have buffers then when they are later attached
> > + * they will all be set dirty.
> > + *
> > + * The buffers are dirtied before the folio is dirtied.  There's a small
> > + * race window in which writeback may see the folio cleanness but not the
> > + * buffer dirtiness.  That's fine.  If this code were to set the folio
> > + * dirty before the buffers, writeback could clear the folio dirty flag,
> > + * see a bunch of clean buffers and we'd end up with dirty buffers/clean
> > + * folio on the dirty folio list.
> > + *
> > + * We use private_lock to lock against try_to_free_buffers() while
> > + * using the folio's buffer list.  This also prevents clean buffers
> > + * being added to the folio after it was set dirty.
> > + *
> > + * Context: May only be called from process context.  Does not sleep.
> > + * Caller must ensure that @folio cannot be truncated during this call,
> > + * typically by holding the folio lock or having a page in the folio
> > + * mapped and holding the page table lock.
> 
>  * Return: tbd

+ *
+ * Return: True if the folio was dirtied; false if it was already dirtied.


  reply	other threads:[~2024-01-04 22:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04 16:36 [PATCH 0/5] Improve buffer head documentation Matthew Wilcox (Oracle)
2024-01-04 16:36 ` [PATCH 1/5] doc: Improve the description of __folio_mark_dirty Matthew Wilcox (Oracle)
2024-01-04 21:08   ` Randy Dunlap
2024-01-04 16:36 ` [PATCH 2/5] buffer: Add kernel-doc for block_dirty_folio() Matthew Wilcox (Oracle)
2024-01-04 21:06   ` Randy Dunlap
2024-01-04 22:41     ` Matthew Wilcox [this message]
2024-01-08 13:31   ` Pankaj Raghav (Samsung)
2024-01-08 13:35     ` Matthew Wilcox
2024-01-08 16:32       ` Matthew Wilcox
2024-01-08 17:47         ` Pankaj Raghav (Samsung)
2024-01-04 16:36 ` [PATCH 3/5] buffer: Add kernel-doc for try_to_free_buffers() Matthew Wilcox (Oracle)
2024-01-04 16:36 ` [PATCH 4/5] buffer: Fix __bread() kernel-doc Matthew Wilcox (Oracle)
2024-01-08 14:58   ` Pankaj Raghav (Samsung)
2024-01-08 16:09     ` Matthew Wilcox
2024-01-08 18:53       ` Pankaj Raghav (Samsung)
2024-01-04 16:36 ` [PATCH 5/5] doc: Split buffer.rst out of api-summary.rst Matthew Wilcox (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZZc0L9ANGS3z3n7c@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox