Re: [PATCH v2 1/8] migrate: fix skipping metadata buffer heads on migration

Matthew Wilcox
2025-04-10T03:18:55Z

On Wed, Apr 09, 2025 at 06:49:38PM -0700, Luis Chamberlain wrote:
> +++ b/mm/migrate.c
> @@ -841,6 +841,9 @@ static int __buffer_migrate_folio(struct address_space *mapping,
> if (folio_ref_count(src) != expected_count)
> return -EAGAIN;
>
> + if (buffer_meta(head))
> + return -EAGAIN;

This isn't enough on filesystems with bs<PS. You're only testing the
meta bit on the first buffer_head on the folio and not on the rest of
them. If this is the right approach to take, then we want:

+++ b/mm/migrate.c
@@ -799,6 +799,8 @@ static bool buffer_migrate_lock_buffers(struct buffer_head *head,
struct buffer_head *failed_bh;

do {
+ if (buffer_meta(bh))
+ goto unlock;
if (!trylock_buffer(bh)) {
if (mode == MIGRATE_ASYNC)
goto unlock;