2024-05-03 01:00:18

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: manual merge of the vfs-brauner tree with the btrfs tree

Hi all,

Today's linux-next merge of the vfs-brauner tree got a conflict in:

fs/btrfs/disk-io.c

between commits:

4a63bd0ffbd2 ("btrfs: convert super block writes to folio in wait_dev_supers()")
545799bb1bb9 ("btrfs: count super block write errors in device instead of tracking folio error state")

from the btrfs tree and commit:

db3102368e1b ("use ->bd_mapping instead of ->bd_inode->i_mapping")

from the vfs-brauner tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

--
Cheers,
Stephen Rothwell

diff --cc fs/btrfs/disk-io.c
index e8aca9f0e692,f10e894b0bf5..000000000000
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@@ -3739,9 -3738,10 +3739,9 @@@ static int write_dev_supers(struct btrf
struct btrfs_super_block *sb, int max_mirrors)
{
struct btrfs_fs_info *fs_info = device->fs_info;
- struct address_space *mapping = device->bdev->bd_inode->i_mapping;
+ struct address_space *mapping = device->bdev->bd_mapping;
SHASH_DESC_ON_STACK(shash, fs_info->csum_shash);
int i;
- int errors = 0;
int ret;
u64 bytenr, bytenr_orig;

@@@ -3857,21 -3855,30 +3857,21 @@@ static int wait_dev_supers(struct btrfs
device->commit_total_bytes)
break;

- folio = filemap_get_folio(device->bdev->bd_inode->i_mapping,
- page = find_get_page(device->bdev->bd_mapping,
- bytenr >> PAGE_SHIFT);
- if (!page) {
- errors++;
- if (i == 0)
- primary_failed = true;
++ folio = filemap_get_folio(device->bdev->bd_mapping,
+ bytenr >> PAGE_SHIFT);
+ /* If the folio has been removed, then we know it completed. */
+ if (IS_ERR(folio))
continue;
- }
- /* Page is submitted locked and unlocked once the IO completes */
- wait_on_page_locked(page);
- if (PageError(page)) {
- errors++;
- if (i == 0)
- primary_failed = true;
- }
+ ASSERT(folio_order(folio) == 0);

- /* Drop our reference */
- put_page(page);
-
- /* Drop the reference from the writing run */
- put_page(page);
+ /* Folio will be unlocked once the write completes. */
+ folio_wait_locked(folio);
+ folio_put(folio);
}

- /* log error, force error return */
+ errors += atomic_read(&device->sb_write_errors);
+ if (errors >= BTRFS_SUPER_PRIMARY_WRITE_ERROR)
+ primary_failed = true;
if (primary_failed) {
btrfs_err(device->fs_info, "error writing primary super block to device %llu",
device->devid);


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2024-05-14 01:39:02

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: manual merge of the vfs-brauner tree with the btrfs tree

Hi all,

On Fri, 3 May 2024 11:00:01 +1000 Stephen Rothwell <[email protected]> wrote:
>
> Today's linux-next merge of the vfs-brauner tree got a conflict in:
>
> fs/btrfs/disk-io.c
>
> between commits:
>
> 4a63bd0ffbd2 ("btrfs: convert super block writes to folio in wait_dev_supers()")
> 545799bb1bb9 ("btrfs: count super block write errors in device instead of tracking folio error state")
>
> from the btrfs tree and commit:
>
> db3102368e1b ("use ->bd_mapping instead of ->bd_inode->i_mapping")
>
> from the vfs-brauner tree.
>
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging. You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
>
>
> diff --cc fs/btrfs/disk-io.c
> index e8aca9f0e692,f10e894b0bf5..000000000000
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@@ -3739,9 -3738,10 +3739,9 @@@ static int write_dev_supers(struct btrf
> struct btrfs_super_block *sb, int max_mirrors)
> {
> struct btrfs_fs_info *fs_info = device->fs_info;
> - struct address_space *mapping = device->bdev->bd_inode->i_mapping;
> + struct address_space *mapping = device->bdev->bd_mapping;
> SHASH_DESC_ON_STACK(shash, fs_info->csum_shash);
> int i;
> - int errors = 0;
> int ret;
> u64 bytenr, bytenr_orig;
>
> @@@ -3857,21 -3855,30 +3857,21 @@@ static int wait_dev_supers(struct btrfs
> device->commit_total_bytes)
> break;
>
> - folio = filemap_get_folio(device->bdev->bd_inode->i_mapping,
> - page = find_get_page(device->bdev->bd_mapping,
> - bytenr >> PAGE_SHIFT);
> - if (!page) {
> - errors++;
> - if (i == 0)
> - primary_failed = true;
> ++ folio = filemap_get_folio(device->bdev->bd_mapping,
> + bytenr >> PAGE_SHIFT);
> + /* If the folio has been removed, then we know it completed. */
> + if (IS_ERR(folio))
> continue;
> - }
> - /* Page is submitted locked and unlocked once the IO completes */
> - wait_on_page_locked(page);
> - if (PageError(page)) {
> - errors++;
> - if (i == 0)
> - primary_failed = true;
> - }
> + ASSERT(folio_order(folio) == 0);
>
> - /* Drop our reference */
> - put_page(page);
> -
> - /* Drop the reference from the writing run */
> - put_page(page);
> + /* Folio will be unlocked once the write completes. */
> + folio_wait_locked(folio);
> + folio_put(folio);
> }
>
> - /* log error, force error return */
> + errors += atomic_read(&device->sb_write_errors);
> + if (errors >= BTRFS_SUPER_PRIMARY_WRITE_ERROR)
> + primary_failed = true;
> if (primary_failed) {
> btrfs_err(device->fs_info, "error writing primary super block to device %llu",
> device->devid);

This is now a conflict between the vfs tree and the btrfs tree.

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature