linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: linux-btrfs@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org, Qu Wenruo <wqu@suse.com>
Subject: THP support for btrfs
Date: Thu, 17 Sep 2020 04:30:21 +0100	[thread overview]
Message-ID: <20200917033021.GR5449@casper.infradead.org> (raw)

I was pointed at the patches posted this week for sub-page support in
btrfs, and I thought it might be a good idea to mention that THP support
is going to hit many of the same issues as sub-PAGE_SIZE blocks, so if
you're thinking about sub-page block sizes, it might be a good idea to
add THP support at the same time, or at least be aware of it when you're
working on those patches to make THP work in the future.

While the patches have not entirely landed yet, complete (in that it
passes xfstests on my laptop) support is available here:
http://git.infradead.org/users/willy/pagecache.git

About 40 of the 100 patches are in Andrew Morton's tree or the iomap
tree waiting for the next merge window, and I'd like to get the rest
upstream in the merge window after that.  About 20-25 of the patches are
to iomap/xfs and the rest are generic MM/FS support.

The first difference you'll see after setting the flag indicating
that your filesystem supports THPs is transparent huge pages being
passed to ->readahead().  You should submit I/Os to read every byte
in those pages, not just the first PAGE_SIZE bytes ;-)  Likewise, when
writepages/writepage is called, you'll want to write back every dirty
byte in that page, not just the first PAGE_SIZE bytes.

If there's a page error (I strongly recommend error injection), you'll
also see these pages being passed to ->readpage and ->write_begin
without being PageUptodate, and again, you'll have to handle reads
for the parts of the page which are not Uptodate.

You'll have to handle invalidatepage being called from the truncate /
page split path.

page_mkwrite can be called with a tail page.  You should be sure to mark
the entire page as dirty (we only track dirty state on a per-THP basis,
not per-subpage basis).

---

I see btrfs is switching to iomap for the directIO path.  Has any
consideration been given to switching to iomap for the buffered I/O path?
Or is that just too much work?

             reply	other threads:[~2020-09-17  3:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17  3:30 Matthew Wilcox [this message]
2020-09-17  4:46 ` THP support for btrfs Qu Wenruo
2020-09-17  5:49 ` Christoph Hellwig

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=20200917033021.GR5449@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=wqu@suse.com \
    /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;
as well as URLs for NNTP newsgroup(s).