Re: [PATCH] btrfs: fix allocation of bitmap pages.

From: Christoph Hellwig
Date: Mon Aug 19 2019 - 22:30:48 EST


On Mon, Aug 19, 2019 at 07:46:00PM +0200, David Sterba wrote:
> Another thing that is lost is the slub debugging support for all
> architectures, because get_zeroed_pages lacking the red zones and sanity
> checks.
>
> I find working with raw pages in this code a bit inconsistent with the
> rest of btrfs code, but that's rather minor compared to the above.
>
> Summing it up, I think that the proper fix should go to copy_page
> implementation on architectures that require it or make it clear what
> are the copy_page constraints.

The whole point of copy_page is to copy exactly one page and it makes
sense to assume that is aligned. A sane memcpy would use the same
underlying primitives as well after checking they fit. So I think the
prime issue here is btrfs' use of copy_page instead of memcpy. The
secondary issue is slub fucking up alignments for no good reason. We
just got bitten by that crap again in XFS as well :(